49 last_mouse_position_ = e.getPosition();
55 Point<int> delta = e.getPosition() - last_mouse_position_;
56 last_mouse_position_ = e.getPosition();
58 float cutoff_range = cutoff_slider_->getMaximum() - cutoff_slider_->getMinimum();
59 cutoff_slider_->setValue(cutoff_slider_->getValue() + delta.x * cutoff_range / getWidth());
60 float resonance_range = resonance_slider_->getMaximum() - resonance_slider_->getMinimum();
61 resonance_slider_->setValue(resonance_slider_->getValue() - delta.y * resonance_range / getHeight());
82 struct FilterResponseShader {
83 static constexpr int kMaxStages = 5;
84 OpenGLShaderProgram* shader;
85 std::unique_ptr<OpenGLShaderProgram::Attribute> position;
87 std::unique_ptr<OpenGLShaderProgram::Uniform> mix;
88 std::unique_ptr<OpenGLShaderProgram::Uniform> midi_cutoff;
89 std::unique_ptr<OpenGLShaderProgram::Uniform> resonance;
90 std::unique_ptr<OpenGLShaderProgram::Uniform> drive;
91 std::unique_ptr<OpenGLShaderProgram::Uniform> db24;
92 std::unique_ptr<OpenGLShaderProgram::Uniform> stages[kMaxStages];
98 void drawFilterResponse(
OpenGlWrapper& open_gl,
bool animate);
104 void setupFilterState();
107 void loadShader(
int index);
111 void bind(OpenGLContext& open_gl_context);
115 void unbind(OpenGLContext& open_gl_context);
122 Point<int> last_mouse_position_;
134 FilterResponseShader response_shader_;
135 std::unique_ptr<float[]> line_data_;
136 GLuint vertex_array_object_;
138 GLuint response_buffer_;
189 std::unique_ptr<SynthButton> on_;
190 std::unique_ptr<TextSelector> type_;
191 std::unique_ptr<TextSelector> filter_order_;
192 std::unique_ptr<SynthSlider> drive_;
193 std::unique_ptr<SynthSlider> mix_;
194 std::unique_ptr<SynthSlider> filter_cutoff_;
195 std::unique_ptr<SynthSlider> filter_resonance_;
196 std::unique_ptr<SynthSlider> filter_blend_;
197 std::unique_ptr<DistortionViewer> distortion_viewer_;
198 std::unique_ptr<DistortionFilterResponse> filter_response_;
An OpenGL renderer showing the frequency response of the distortion's filter.
Definition distortion_section.h:23
void render(OpenGlWrapper &open_gl, bool animate) override
Definition distortion_section.cpp:170
virtual ~DistortionFilterResponse()
void destroy(OpenGlWrapper &open_gl) override
Definition distortion_section.cpp:175
void init(OpenGlWrapper &open_gl) override
Definition distortion_section.cpp:135
void setCutoffSlider(SynthSlider *slider)
Definition distortion_section.h:66
static constexpr int kResolution
Resolution of the filter response line.
Definition distortion_section.h:25
void setResonanceSlider(SynthSlider *slider)
Definition distortion_section.h:70
static constexpr int kDefaultVisualSampleRate
Default sample rate for visualization calculations.
Definition distortion_section.h:26
void mouseDrag(const MouseEvent &e) override
Definition distortion_section.h:54
DistortionFilterResponse(const vital::output_map &mono_modulations)
Definition distortion_section.cpp:104
void mouseDown(const MouseEvent &e) override
Definition distortion_section.h:48
void setBlendSlider(SynthSlider *slider)
Definition distortion_section.h:74
void setActive(bool active)
Definition distortion_section.h:78
A UI section for configuring a distortion effect, including type, drive, mix, and filtering.
Definition distortion_section.h:149
virtual ~DistortionSection()
Destructor.
void setActive(bool active) override
Definition distortion_section.cpp:418
void paintBackgroundShadow(Graphics &g) override
Definition distortion_section.h:167
void sliderValueChanged(Slider *changed_slider) override
Definition distortion_section.cpp:424
static constexpr int kViewerResolution
Resolution for visualizing distortion line.
Definition distortion_section.h:151
void paintBackground(Graphics &g) override
Definition distortion_section.cpp:369
void setAllValues(vital::control_map &controls) override
Definition distortion_section.cpp:431
void resized() override
Resizes and lays out child components.
Definition distortion_section.cpp:384
DistortionSection(String name, const vital::output_map &mono_modulations)
Definition distortion_section.cpp:314
void setFilterActive(bool active)
Definition distortion_section.cpp:436
Definition distortion_section.cpp:17
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
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 slider-based UI component that displays selectable tabs.
Definition tab_selector.h:16
A specialized SynthSlider that displays a popup menu of text options.
Definition text_selector.h:14
A state-variable filter (SVF) implementation, supporting multiple filter types (12/24 dB,...
Definition digital_svf.h:17
Holds the parameters necessary to configure a SynthFilter at runtime.
Definition synth_filter.h:92
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
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Holds and manages a buffer of samples (poly_float) for a Processor's output.
Definition processor.h:35
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600