28 freq.setSliderStyle(juce::Slider::RotaryVerticalDrag);
29 q.setSliderStyle(juce::Slider::RotaryVerticalDrag);
30 gain.setSliderStyle(juce::Slider::RotaryVerticalDrag);
32 freq.setTextBoxStyle(juce::Slider::TextBoxBelow,
true, 50, 20);
33 q.setTextBoxStyle(juce::Slider::TextBoxBelow,
true, 50, 20);
34 gain.setTextBoxStyle(juce::Slider::TextBoxBelow,
true, 50, 20);
36 freq.setColour(juce::Slider::ColourIds::textBoxOutlineColourId, juce::Colour(0x00000000));
37 q.setColour(juce::Slider::ColourIds::textBoxOutlineColourId, juce::Colour(0x00000000));
38 gain.setColour(juce::Slider::ColourIds::textBoxOutlineColourId, juce::Colour(0x00000000));
40 juce::String filterIDPrefix = processor.PID_FILTER_PREFIX + std::to_string(index);
42 freq.setComponentID(filterIDPrefix + processor.PID_FILTER_FREQ_SUFFIX);
43 q.setComponentID(filterIDPrefix + processor.PID_FILTER_Q_SUFFIX);
44 gain.setComponentID(filterIDPrefix + processor.PID_FILTER_GAIN_SUFFIX);
47 freqLabel.setText(
"frequency", juce::NotificationType::dontSendNotification);
48 freqLabel.setJustificationType(juce::Justification::centredBottom);
50 qLabel.setText(
"q factor", juce::NotificationType::dontSendNotification);
51 qLabel.setJustificationType(juce::Justification::centredBottom);
53 gainLabel.setText(
"amplitude", juce::NotificationType::dontSendNotification);
54 gainLabel.setJustificationType(juce::Justification::centredBottom);
56 freqLabel.attachToComponent(&freq,
false);
57 qLabel.attachToComponent(&q,
false);
58 gainLabel.attachToComponent(&gain,
false);
61 freqAttachment.reset(
new SliderAttachment(processor.parameters,
62 freq.getComponentID(),
65 qAttachment.reset(
new SliderAttachment(processor.parameters,
69 gainAttachment.reset(
new SliderAttachment(processor.parameters,
70 gain.getComponentID(),
74 freq.setNumDecimalPlacesToDisplay(0);
75 freq.setTextValueSuffix(
" Hz");
77 q.setNumDecimalPlacesToDisplay(2);
79 gain.setNumDecimalPlacesToDisplay(2);
80 gain.setTextValueSuffix(
" dB");
83 freq.setSkewFactor(1.0,
false);
84 q.setSkewFactor(1.0,
false);
85 gain.setSkewFactor(0.5,
false);
88 addAndMakeVisible(freq);
90 addAndMakeVisible(gain);
96 g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
98 g.setColour(juce::Colours::white);
101 juce::Rectangle<
int> bounds(getLocalBounds());
102 getLookAndFeel().drawGroupComponentOutline(g, bounds.getWidth(), bounds.getHeight(), getText(),
103 juce::Justification(juce::Justification::centredTop), *
this);
115 juce::Rectangle<
int> bounds(getLocalBounds());
117 int height = bounds.getHeight();
118 int padding = (
int)(height * 0.06);
119 bounds.reduce(padding, padding);
122 auto cells = getComponentCells(bounds);
124 freq.setBounds(cells[0]);
125 q.setBounds(cells[1]);
126 gain.setBounds(cells[2]);
float getParam(const juce::AudioProcessorValueTreeState ¶ms, const juce::String &blockId) const
Internal method used to get (and check) a parameter's value.
UIFilterBlock(AudioProcessor &processor, int index, const juce::String &displayedName=juce::String())
Constructs a UIFilterBlock object.
void resized() override
Manages the layout of UIFilterBlock when the block is resized.