Vital
Loading...
Searching...
No Matches
filter_section.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4#include "synth_section.h"
5#include "preset_selector.h"
6
9class SynthButton;
10class SynthSlider;
11class TextSelector;
12class TextSlider;
13
26public:
30 static constexpr int kBlendLabelPaddingY = 4;
31
39 class Listener {
40 public:
44 virtual ~Listener() { }
45
50 virtual void filterSerialSelected(FilterSection* section) = 0;
51
58 virtual void oscInputToggled(FilterSection* section, int index, bool on) = 0;
59
65 virtual void sampleInputToggled(FilterSection* section, bool on) = 0;
66 };
67
73 FilterSection(String suffix, const vital::output_map& mono_modulations);
74
81 FilterSection(int index, const vital::output_map& mono_modulations, const vital::output_map& poly_modulations);
82
87
95
100 void paintBackground(Graphics& g) override;
101
106 void paintBackgroundShadow(Graphics& g) override { if (isActive()) paintTabShadow(g); }
107
113 void positionTopBottom();
114
120 void positionLeftRight();
121
127 void resized() override;
128
133 void buttonClicked(Button* clicked_button) override;
134
139 void setAllValues(vital::control_map& controls) override;
140
146 void prevClicked() override;
147
153 void nextClicked() override;
154
159 void textMouseDown(const MouseEvent& e) override;
160
165 Path getLeftMorphPath();
166
171 Path getRightMorphPath();
172
177 void setActive(bool active) override;
178
183 void addListener(Listener* listener) { listeners_.push_back(listener); }
184
189 void setFilterSelected(int menu_id);
190
194 void clearFilterInput() { filter_input_->setToggleState(false, sendNotification); }
195
201 void setOscillatorInput(int oscillator_index, bool input);
202
207 void setSampleInput(bool input);
208
209private:
217 FilterSection(String name, String suffix);
218
222 void showModelKnobs();
223
227 void setFilterText();
228
232 void setLabelText();
233
237 void notifyFilterChange();
238
242 std::vector<Listener*> listeners_;
243
244 std::string model_name_;
245 std::string style_name_;
246 int current_model_;
247 int current_style_;
248 bool specify_input_;
249
250 std::unique_ptr<SynthButton> filter_on_;
251 std::unique_ptr<PresetSelector> preset_selector_;
252 std::unique_ptr<FilterResponse> filter_response_;
253 std::unique_ptr<SynthSlider> mix_;
254 std::unique_ptr<SynthSlider> cutoff_;
255 std::unique_ptr<SynthSlider> resonance_;
256 std::unique_ptr<SynthSlider> blend_;
257 std::unique_ptr<SynthSlider> keytrack_;
258 std::unique_ptr<SynthSlider> drive_;
259
260 std::unique_ptr<SynthSlider> formant_x_;
261 std::unique_ptr<SynthSlider> formant_y_;
262 std::unique_ptr<SynthSlider> formant_transpose_;
263 std::unique_ptr<SynthSlider> formant_resonance_;
264 std::unique_ptr<SynthSlider> formant_spread_;
265
266 std::unique_ptr<OpenGlToggleButton> osc1_input_;
267 std::unique_ptr<OpenGlToggleButton> osc2_input_;
268 std::unique_ptr<OpenGlToggleButton> osc3_input_;
269 std::unique_ptr<OpenGlToggleButton> sample_input_;
270 std::unique_ptr<SynthButton> filter_input_;
271
272 std::unique_ptr<PlainTextComponent> filter_label_1_;
273 std::unique_ptr<PlainTextComponent> filter_label_2_;
274
275 std::unique_ptr<SynthSlider> blend_transpose_;
276
277 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FilterSection)
278};
Displays the frequency response of various filter models in Vital.
Definition filter_response.h:26
An interface for objects that need to respond to changes in the FilterSection.
Definition filter_section.h:39
virtual ~Listener()
Virtual destructor.
Definition filter_section.h:44
virtual void sampleInputToggled(FilterSection *section, bool on)=0
Called when the sample input toggle button changes state.
virtual void oscInputToggled(FilterSection *section, int index, bool on)=0
Called when an oscillator input toggle button changes state.
virtual void filterSerialSelected(FilterSection *section)=0
Called when the filter input button toggles to a serial filter topology.
A graphical user interface component representing a filter section in the synthesizer.
Definition filter_section.h:25
void paintBackgroundShadow(Graphics &g) override
Paints a background shadow for the filter section, if active.
Definition filter_section.h:106
void setSampleInput(bool input)
Sets the sample input state.
Definition filter_section.cpp:543
void positionTopBottom()
Positions UI elements in a top-bottom orientation.
Definition filter_section.cpp:313
void textMouseDown(const MouseEvent &e) override
Called when the user interacts with the text component of the preset selector.
Definition filter_section.cpp:493
void addListener(Listener *listener)
Adds a listener to be notified of filter section events.
Definition filter_section.h:183
void resized() override
Called when the component is resized.
Definition filter_section.cpp:398
void setFilterResponseSliders()
Connects the filter's sliders to the filter response display.
Definition filter_section.cpp:255
void positionLeftRight()
Positions UI elements in a left-right orientation.
Definition filter_section.cpp:363
Path getLeftMorphPath()
Returns a path that represents the left morph shape icon based on the current model/style.
Definition filter_section.cpp:612
FilterSection(String suffix, const vital::output_map &mono_modulations)
Constructs a FilterSection with a given suffix for parameter naming, using only mono modulations.
Definition filter_section.cpp:191
void setAllValues(vital::control_map &controls) override
Sets all parameter values for this filter section.
Definition filter_section.cpp:458
void paintBackground(Graphics &g) override
Paints the background of the filter section.
Definition filter_section.cpp:274
~FilterSection()
Destructor.
Definition filter_section.cpp:253
Path getRightMorphPath()
Returns a path that represents the right morph shape icon based on the current model/style.
Definition filter_section.cpp:626
void buttonClicked(Button *clicked_button) override
Called when a button is clicked.
Definition filter_section.cpp:428
static constexpr int kBlendLabelPaddingY
Vertical padding used for label placement relative to the blend slider.
Definition filter_section.h:30
void nextClicked() override
Called when the next button on the preset selector is clicked.
Definition filter_section.cpp:482
void clearFilterInput()
Clears the internal filter input toggle state.
Definition filter_section.h:194
void setFilterSelected(int menu_id)
Sets the filter model and style based on a given menu ID.
Definition filter_section.cpp:516
void prevClicked() override
Called when the previous button on the preset selector is clicked.
Definition filter_section.cpp:471
void setActive(bool active) override
Sets the active state of this filter section.
Definition filter_section.cpp:606
void setOscillatorInput(int oscillator_index, bool input)
Sets the oscillator input state for a given oscillator index.
Definition filter_section.cpp:533
A ToggleButton that uses an OpenGlButtonComponent for its rendering.
Definition synth_button.h:342
Interface for objects that want to be notified of PresetSelector events.
Definition preset_selector.h:24
A specialized OpenGlToggleButton with additional functionality for the Vital synth.
Definition synth_button.h:450
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
bool isActive() const
Checks if the section is currently active.
Definition synth_section.h:683
virtual void paintTabShadow(Graphics &g)
Paints a tab-like shadow effect around the component.
Definition synth_section.cpp:188
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
A specialized SynthSlider that displays a popup menu of text options.
Definition text_selector.h:14
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229
std::map< std::string, Value * > control_map
Maps parameter names to Value pointers representing synth control parameters.
Definition synth_types.h:214
Declares the PresetSelector class which provides a UI component for selecting presets.