15 release_ = std::make_unique<SynthSlider>(
"compressor_release");
17 release_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
19 mix_ = std::make_unique<SynthSlider>(
"compressor_mix");
21 mix_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
23 attack_ = std::make_unique<SynthSlider>(
"compressor_attack");
25 attack_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
27 low_gain_ = std::make_unique<SynthSlider>(
"compressor_low_gain");
29 low_gain_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
30 low_gain_->setBipolar(
true);
32 band_gain_ = std::make_unique<SynthSlider>(
"compressor_band_gain");
34 band_gain_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
35 band_gain_->setBipolar(
true);
37 high_gain_ = std::make_unique<SynthSlider>(
"compressor_high_gain");
39 high_gain_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
40 high_gain_->setBipolar(
true);
42 enabled_bands_ = std::make_unique<TextSelector>(
"compressor_enabled_bands");
44 enabled_bands_->setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
48 compressor_editor_ = std::make_unique<CompressorEditor>();
49 addAndMakeVisible(compressor_editor_.get());
52 on_ = std::make_unique<SynthButton>(
"compressor_on");
80 Rectangle<int> bounds = getLocalBounds().withLeft(title_width);
85 int editor_x = knobs_area.getRight();
86 int editor_width = time_area.getX() - editor_x - widget_margin;
87 int knob_y2 = section_height - widget_margin;
89 placeKnobsInArea(Rectangle<int>(knobs_area.getX(), knob_y2, knobs_area.getWidth(), section_height),
90 { low_gain_.get(), band_gain_.get(), high_gain_.get() });
92 int bands_width = band_gain_->getRight() - low_gain_->getX();
93 enabled_bands_->setBounds(settings_area.getX(), widget_margin, bands_width, section_height - 2 * widget_margin);
94 int mix_x = enabled_bands_->getRight();
95 placeKnobsInArea(Rectangle<int>(mix_x, 0, knobs_area.getRight() - mix_x, section_height), { mix_.get() });
97 attack_->setBounds(time_area.getX(), 0, time_area.getWidth(), section_height - widget_margin);
98 release_->setBounds(time_area.getX(), knob_y2, time_area.getWidth(), section_height - widget_margin);
100 int editor_height = getHeight() - 2 * widget_margin;
101 compressor_editor_->setBounds(editor_x, widget_margin, editor_width, editor_height);
108 compressor_editor_->setAllValues(controls);
109 setCompressorActiveBands();
114 compressor_editor_->setActive(active);
118 if (changed_slider == enabled_bands_.get())
119 setCompressorActiveBands();
123void CompressorSection::setCompressorActiveBands() {
124 int enabled_bands = enabled_bands_->getValue();
129 compressor_editor_->setLowBandActive(low_enabled);
130 compressor_editor_->setHighBandActive(high_enabled);
131 low_gain_->setActive(low_enabled);
132 high_gain_->setActive(high_enabled);
CompressorSection(const String &name)
Definition compressor_section.cpp:14
void setAllValues(vital::control_map &controls) override
Definition compressor_section.cpp:106
~CompressorSection()
Destructor.
void paintBackground(Graphics &g) override
Definition compressor_section.cpp:61
void resized() override
Resizes and lays out the compressor's knobs and editor.
Definition compressor_section.cpp:75
void setActive(bool active) override
Definition compressor_section.cpp:112
void sliderValueChanged(Slider *changed_slider) override
Definition compressor_section.cpp:117
@ kWidgetMargin
Definition skin.h:103
@ kCompressor
Definition skin.h:47
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
Rectangle< int > getDividedAreaBuffered(Rectangle< int > full_area, int num_sections, int section, int buffer)
Divides an area into equal sections with buffering, returns the specified section.
Definition synth_section.cpp:776
void drawTextComponentBackground(Graphics &g, Rectangle< int > bounds, bool extend_to_label)
Draws a background for a text component area.
Definition synth_section.cpp:319
void placeKnobsInArea(Rectangle< int > area, std::vector< Component * > knobs)
Definition synth_section.cpp:601
void addSlider(SynthSlider *slider, bool show=true, bool listen=true)
Definition synth_section.cpp:445
virtual void resized() override
Called when the component is resized. Arranges layout of child components.
Definition synth_section.cpp:35
virtual void setActive(bool active)
Sets the active state of this section and sub-sections.
Definition synth_section.cpp:806
void drawLabelForComponent(Graphics &g, String text, Component *component, bool text_component=false)
Draws a label for a given component.
Definition synth_section.h:548
void setLabelFont(Graphics &g)
Sets the Graphics context font and color for labels.
Definition synth_section.cpp:740
void addButton(OpenGlToggleButton *button, bool show=true)
Definition synth_section.cpp:428
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
virtual void paintBackground(Graphics &g)
Paints the background of the section. Calls paintContainer, heading, knobs, children.
Definition synth_section.cpp:77
float getKnobSectionHeight()
Definition synth_section.cpp:633
void setActivator(SynthButton *activator)
Definition synth_section.cpp:504
void addOpenGlComponent(OpenGlComponent *open_gl_component, bool to_beginning=false)
Definition synth_section.cpp:489
virtual void sliderValueChanged(Slider *moved_slider) override
Called when a slider value changes. Updates the synth parameter accordingly.
Definition synth_section.cpp:391
virtual void setAllValues(vital::control_map &controls)
Sets values for all known parameters from a control map.
Definition synth_section.cpp:827
Rectangle< int > getDividedAreaUnbuffered(Rectangle< int > full_area, int num_sections, int section, int buffer)
Divides an area into equal sections without extra buffering, returns the specified section.
Definition synth_section.cpp:768
float getTitleWidth()
Definition synth_section.cpp:629
void setSkinOverride(Skin::SectionOverride skin_override)
Definition synth_section.h:303
static TextLookAndFeel * instance()
Singleton instance access.
Definition text_look_and_feel.h:106
@ kHighBand
Only high band active.
Definition compressor.h:219
@ kLowBand
Only low band active.
Definition compressor.h:218
@ kMultiband
All three bands active.
Definition compressor.h:217
Declares the CompressorSection class, providing a UI for a multiband compressor.
const std::string kCompressorBandNames[]
Full names for compressor band modes.
Definition synth_strings.h:59
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...