Files
InstaDrums/Source/MasterPanel.cpp
hariel1985 a0e83fa0a4 Per-pad FX chain, animated toggles, GR meter, simplified master panel
- FX moved from master bus to per-pad processing:
  each pad has its own Filter, Distortion, EQ, Compressor, Reverb
  via DrumPad::applyPadFx() with temp buffer rendering
- FxPanel now edits the selected pad's FX parameters
- Animated toggle switches with smooth lerp transition and glow
- Per-pad compressor GR meter connected to FxPanel display
- Master panel simplified: Volume/Tune/Pan + Limiter toggle + VU meter
- Master bus chain: Vol/Pan → Output Limiter (0dB brickwall) → VU
- Pointer glow reduced to half intensity (4 layers, narrower spread)
- Smooth 8-layer arc glow with exponential opacity falloff

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 06:42:47 +01:00

89 sor
3.4 KiB
C++

#include "MasterPanel.h"
#include "LookAndFeel.h"
MasterPanel::MasterPanel()
{
masterTitle.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
addAndMakeVisible (masterTitle);
setupKnob (volumeSlider, volumeLabel, "Volume", 0.0, 2.0, 1.0, 0.01);
setupKnob (tuneSlider, tuneLabel, "Tune", -12.0, 12.0, 0.0, 0.1);
setupKnob (panSlider, panLabel, "Pan", -1.0, 1.0, 0.0, 0.01);
limiterToggle.setToggleState (true, juce::dontSendNotification);
limiterToggle.setButtonText ("");
addAndMakeVisible (limiterToggle);
limiterLabel.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::accent);
limiterLabel.setJustificationType (juce::Justification::centredLeft);
addAndMakeVisible (limiterLabel);
addAndMakeVisible (vuMeter);
}
void MasterPanel::setupKnob (juce::Slider& s, juce::Label& l, const juce::String& name,
double min, double max, double val, double step)
{
s.setSliderStyle (juce::Slider::RotaryHorizontalVerticalDrag);
s.setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
s.setRange (min, max, step);
s.setValue (val, juce::dontSendNotification);
s.setDoubleClickReturnValue (true, val);
addAndMakeVisible (s);
l.setText (name, juce::dontSendNotification);
l.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
l.setJustificationType (juce::Justification::centred);
addAndMakeVisible (l);
}
void MasterPanel::paint (juce::Graphics& g)
{
auto bounds = getLocalBounds().toFloat();
g.setColour (InstaDrumsLookAndFeel::bgMedium.darker (0.2f));
g.fillRoundedRectangle (bounds, 4.0f);
g.setColour (InstaDrumsLookAndFeel::bgLight.withAlpha (0.3f));
g.drawRoundedRectangle (bounds, 4.0f, 1.0f);
}
void MasterPanel::resized()
{
auto area = getLocalBounds().reduced (6);
float scale = (float) getHeight() / 52.0f;
float titleSize = std::max (12.0f, 16.0f * scale);
float labelSize = std::max (9.0f, 12.0f * scale);
int labelH = (int) (labelSize + 4);
int toggleW = std::max (28, (int) (36 * scale));
int toggleH = std::max (14, (int) (16 * scale));
masterTitle.setFont (juce::FontOptions (titleSize, juce::Font::bold));
masterTitle.setBounds (area.removeFromLeft ((int) (65 * scale)).reduced (0, 2));
// VU meter on right
vuMeter.setBounds (area.removeFromRight ((int) (28 * scale)).reduced (0, 2));
area.removeFromRight (6);
// Limiter toggle + label
auto limArea = area.removeFromRight ((int) (90 * scale));
{
auto center = limArea.withSizeKeepingCentre (limArea.getWidth(), toggleH + 4);
auto row = center;
limiterToggle.setBounds (row.removeFromLeft (toggleW).withSizeKeepingCentre (toggleW, toggleH));
limiterLabel.setFont (juce::FontOptions (std::max (10.0f, 13.0f * scale), juce::Font::bold));
limiterLabel.setBounds (row);
}
area.removeFromRight (6);
// Master knobs
int knobW = area.getWidth() / 3;
juce::Slider* sliders[] = { &volumeSlider, &tuneSlider, &panSlider };
juce::Label* labels[] = { &volumeLabel, &tuneLabel, &panLabel };
for (int i = 0; i < 3; ++i)
{
labels[i]->setFont (juce::FontOptions (labelSize));
auto col = area.removeFromLeft (knobW);
labels[i]->setBounds (col.removeFromBottom (labelH));
sliders[i]->setBounds (col);
}
}