86 std::pair<vital::Output*, vital::Output*> getOutputs(
const vital::output_map& mono_modulations,
87 const std::string& name) {
89 mono_modulations.at(name),
101 std::pair<vital::Output*, vital::Output*> getOutputs(
const vital::output_map& mono_modulations,
103 const std::string& name) {
105 mono_modulations.at(name),
106 poly_modulations.at(name)
113 setFillCenter(-1.0f);
117 current_resonance_value_ = 0.0;
118 current_cutoff_value_ = 0.0;
119 current_formant_x_value_ = 0.0;
120 current_formant_y_value_ = 0.0;
122 cutoff_slider_ =
nullptr;
123 resonance_slider_ =
nullptr;
124 formant_x_slider_ =
nullptr;
125 formant_y_slider_ =
nullptr;
126 filter_mix_slider_ =
nullptr;
127 blend_slider_ =
nullptr;
128 transpose_slider_ =
nullptr;
129 formant_transpose_slider_ =
nullptr;
130 formant_resonance_slider_ =
nullptr;
131 formant_spread_slider_ =
nullptr;
132 last_filter_style_ = 0;
136 line_data_ = std::make_unique<float[]>(2 * kResolution);
138 response_buffer_ = 0;
139 vertex_array_object_ = 0;
141 for (
int i = 0; i < kResolution; ++i) {
142 float t = i / (kResolution - 1.0f);
143 line_data_[2 * i] = 2.0f * t - 1.0f;
144 line_data_[2 * i + 1] = (i / kCombAlternatePeriod) % 2;
147 analog_filter_.setSampleRate(kDefaultVisualSampleRate);
148 comb_filter_.setSampleRate(kDefaultVisualSampleRate);
149 digital_filter_.setSampleRate(kDefaultVisualSampleRate);
150 diode_filter_.setSampleRate(kDefaultVisualSampleRate);
151 dirty_filter_.setSampleRate(kDefaultVisualSampleRate);
152 formant_filter_.setSampleRate(kDefaultVisualSampleRate);
153 ladder_filter_.setSampleRate(kDefaultVisualSampleRate);
154 phaser_filter_.setSampleRate(kDefaultVisualSampleRate);
158 std::string prefix = std::string(
"filter_") + suffix.toStdString() +
"_";
160 filter_mix_outputs_ = getOutputs(mono_modulations, prefix +
"mix");
161 midi_cutoff_outputs_ = getOutputs(mono_modulations, prefix +
"cutoff");
162 resonance_outputs_ = getOutputs(mono_modulations, prefix +
"resonance");
163 blend_outputs_ = getOutputs(mono_modulations, prefix +
"blend");
164 transpose_outputs_ = getOutputs(mono_modulations, prefix +
"blend_transpose");
165 interpolate_x_outputs_ = getOutputs(mono_modulations, prefix +
"formant_x");
166 interpolate_y_outputs_ = getOutputs(mono_modulations, prefix +
"formant_y");
167 formant_transpose_outputs_ = getOutputs(mono_modulations, prefix +
"formant_transpose");
168 formant_resonance_outputs_ = getOutputs(mono_modulations, prefix +
"formant_resonance");
169 formant_spread_outputs_ = getOutputs(mono_modulations, prefix +
"formant_spread");
174 std::string prefix = std::string(
"filter_") + std::to_string(index) +
"_";
176 filter_mix_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"mix");
177 midi_cutoff_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"cutoff");
178 resonance_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"resonance");
179 blend_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"blend");
180 transpose_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"blend_transpose");
181 interpolate_x_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"formant_x");
182 interpolate_y_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"formant_y");
183 formant_transpose_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"formant_transpose");
184 formant_resonance_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"formant_resonance");
185 formant_spread_outputs_ = getOutputs(mono_modulations, poly_modulations, prefix +
"formant_spread");
193 const GLchar* varyings[] = {
"response_out" };
194 open_gl.
context.extensions.glGenVertexArrays(1, &vertex_array_object_);
195 open_gl.
context.extensions.glBindVertexArray(vertex_array_object_);
197 GLsizeiptr data_size =
static_cast<GLsizeiptr
>(
kResolution *
sizeof(float));
198 open_gl.
context.extensions.glGenBuffers(1, &line_buffer_);
199 open_gl.
context.extensions.glBindBuffer(GL_ARRAY_BUFFER, line_buffer_);
200 open_gl.
context.extensions.glBufferData(GL_ARRAY_BUFFER, 2 * data_size, line_data_.get(), GL_STATIC_DRAW);
202 open_gl.
context.extensions.glGenBuffers(1, &response_buffer_);
203 open_gl.
context.extensions.glBindBuffer(GL_ARRAY_BUFFER, response_buffer_);
204 open_gl.
context.extensions.glBufferData(GL_ARRAY_BUFFER, data_size,
nullptr, GL_STATIC_READ);
209 shaders_[i].shader = shader;
212 shaders_[i].position =
getAttribute(open_gl, *shader,
"position");
214 shaders_[i].mix =
getUniform(open_gl, *shader,
"mix");
215 shaders_[i].midi_cutoff =
getUniform(open_gl, *shader,
"midi_cutoff");
216 shaders_[i].resonance =
getUniform(open_gl, *shader,
"resonance");
217 shaders_[i].drive =
getUniform(open_gl, *shader,
"drive");
218 shaders_[i].db24 =
getUniform(open_gl, *shader,
"db24");
220 shaders_[i].formant_cutoff =
getUniform(open_gl, *shader,
"formant_cutoff");
221 shaders_[i].formant_resonance =
getUniform(open_gl, *shader,
"formant_resonance");
222 shaders_[i].formant_spread =
getUniform(open_gl, *shader,
"formant_spread");
223 shaders_[i].formant_low =
getUniform(open_gl, *shader,
"low");
224 shaders_[i].formant_band =
getUniform(open_gl, *shader,
"band");
225 shaders_[i].formant_high =
getUniform(open_gl, *shader,
"high");
227 for (
int s = 0; s < FilterResponseShader::kMaxStages; ++s) {
228 String stage = String(
"stage") + String(s);
229 shaders_[i].stages[s] =
getUniform(open_gl, *shader, stage.toRawUTF8());
236 drawFilterResponse(open_gl);
243 open_gl.
context.extensions.glDeleteBuffers(1, &line_buffer_);
244 open_gl.
context.extensions.glDeleteBuffers(1, &response_buffer_);
246 vertex_array_object_ = 0;
248 response_buffer_ = 0;
251 shaders_[i].shader =
nullptr;
252 shaders_[i].position =
nullptr;
254 shaders_[i].mix =
nullptr;
255 shaders_[i].midi_cutoff =
nullptr;
256 shaders_[i].resonance =
nullptr;
257 shaders_[i].drive =
nullptr;
258 shaders_[i].db24 =
nullptr;
260 shaders_[i].formant_cutoff =
nullptr;
261 shaders_[i].formant_resonance =
nullptr;
262 shaders_[i].formant_spread =
nullptr;
263 shaders_[i].formant_low =
nullptr;
264 shaders_[i].formant_band =
nullptr;
265 shaders_[i].formant_high =
nullptr;
267 for (
int s = 0; s < FilterResponseShader::kMaxStages; ++s)
268 shaders_[i].stages[s] =
nullptr;
283void FilterResponse::setFilterSettingsFromPosition(Point<int> position) {
284 Point<int> delta = position - last_mouse_position_;
285 last_mouse_position_ = position;
286 double width = getWidth();
287 double height = getHeight();
288 current_cutoff_value_ += delta.x * cutoff_slider_->getRange().getLength() / width;
289 current_formant_x_value_ += delta.x * formant_x_slider_->getRange().getLength() / width;
290 current_resonance_value_ -= delta.y * resonance_slider_->getRange().getLength() / height;
291 current_formant_y_value_ -= delta.y * formant_y_slider_->getRange().getLength() / height;
292 current_cutoff_value_ = cutoff_slider_->getRange().clipValue(current_cutoff_value_);
293 current_formant_x_value_ = formant_x_slider_->getRange().clipValue(current_formant_x_value_);
294 current_resonance_value_ = resonance_slider_->getRange().clipValue(current_resonance_value_);
295 current_formant_y_value_ = formant_y_slider_->getRange().clipValue(current_formant_y_value_);
298 formant_x_slider_->setValue(current_formant_x_value_);
300 formant_y_slider_->setValue(current_formant_y_value_);
304 cutoff_slider_->setValue(current_cutoff_value_);
306 resonance_slider_->setValue(current_resonance_value_);
312 last_mouse_position_ = e.getPosition();
313 current_resonance_value_ = resonance_slider_->getValue();
314 current_cutoff_value_ = cutoff_slider_->getValue();
315 current_formant_x_value_ = formant_x_slider_->getValue();
316 current_formant_y_value_ = formant_y_slider_->getValue();
329 setFilterSettingsFromPosition(e.getPosition());
335 OpenGlLineRenderer::mouseExit(e);
339 MouseWheelDetails horizontal_details = wheel;
340 horizontal_details.deltaY = 0.0f;
341 MouseWheelDetails vertical_details = wheel;
342 vertical_details.deltaX = 0.0f;
355 std::pair<vital::Output*, vital::Output*> outputs,
vital::poly_float default_value) {
356 if (!active_ || !animate_ || !outputs.first->owner->enabled())
357 return default_value;
359 return outputs.first->trigger_value;
360 return outputs.first->trigger_value + outputs.second->trigger_value;
366 vital::poly_float mix = getOutputsTotal(filter_mix_outputs_, filter_mix_slider_->getValue());
368 vital::poly_float resonance_percent = getOutputsTotal(resonance_outputs_, resonance_slider_->getValue());
369 vital::poly_float pass_blend = getOutputsTotal(blend_outputs_, blend_slider_->getValue());
371 vital::poly_float transpose = getOutputsTotal(transpose_outputs_, transpose_slider_->getValue());
372 vital::poly_float interpolate_x = getOutputsTotal(interpolate_x_outputs_, formant_x_slider_->getValue());
373 vital::poly_float interpolate_y = getOutputsTotal(interpolate_y_outputs_, formant_y_slider_->getValue());
376 transpose = getOutputsTotal(formant_transpose_outputs_, formant_transpose_slider_->getValue());
377 resonance_percent = getOutputsTotal(formant_resonance_outputs_, formant_resonance_slider_->getValue());
378 pass_blend = getOutputsTotal(formant_spread_outputs_, formant_spread_slider_->getValue());
398 bool new_type = last_filter_model_ != model || last_filter_style_ != filter_state_.
style;
399 last_filter_style_ = filter_state_.
style;
400 last_filter_model_ = model;
402 return (~equal).anyMask() || new_type;
405bool FilterResponse::isStereoState() {
421 return (~equal).anyMask();
427 shaders_[shader].shader->use();
429 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
430 shaders_[shader].resonance->set(
resonance);
431 shaders_[shader].drive->set(analog_filter_.
getDrive()[index]);
434 shaders_[shader].stages[0]->set(analog_filter_.
getLowAmount()[index]);
435 shaders_[shader].stages[1]->set(analog_filter_.
getBandAmount()[index]);
436 shaders_[shader].stages[2]->set(analog_filter_.
getHighAmount()[index]);
437 shaders_[shader].stages[3]->set(analog_filter_.
getLowAmount24(filter_state_.
style)[index]);
442 shaders_[shader].shader->use();
444 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
445 shaders_[shader].resonance->set(
resonance);
446 shaders_[shader].drive->set(comb_filter_.
getDrive()[index]);
448 shaders_[shader].stages[0]->set(comb_filter_.
getLowAmount()[index]);
449 shaders_[shader].stages[1]->set(comb_filter_.
getHighAmount()[index]);
455 shaders_[shader].shader->use();
457 shaders_[shader].midi_cutoff->set(digital_filter_.
getMidiCutoff()[index]);
458 shaders_[shader].resonance->set(
resonance);
459 shaders_[shader].drive->set(digital_filter_.
getDrive()[index]);
462 shaders_[shader].stages[0]->set(digital_filter_.
getLowAmount()[index]);
463 shaders_[shader].stages[1]->set(digital_filter_.
getBandAmount()[index]);
464 shaders_[shader].stages[2]->set(digital_filter_.
getHighAmount()[index]);
465 shaders_[shader].stages[3]->set(digital_filter_.
getLowAmount24(filter_state_.
style)[index]);
470 shaders_[shader].shader->use();
471 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
472 shaders_[shader].resonance->set(diode_filter_.
getResonance()[index]);
473 shaders_[shader].drive->set(diode_filter_.
getDrive()[index]);
479 shaders_[shader].shader->use();
481 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
482 shaders_[shader].resonance->set(
resonance);
483 shaders_[shader].drive->set(dirty_filter_.
getDrive()[index]);
486 shaders_[shader].stages[0]->set(dirty_filter_.
getLowAmount()[index]);
487 shaders_[shader].stages[1]->set(dirty_filter_.
getBandAmount()[index]);
488 shaders_[shader].stages[2]->set(dirty_filter_.
getHighAmount()[index]);
493 shaders_[shader].shader->use();
522 shaders_[shader].formant_low->set(low0[index], low1[index], low2[index], low3[index]);
523 shaders_[shader].formant_band->set(band0[index], band1[index], band2[index], band3[index]);
524 shaders_[shader].formant_high->set(high0[index], high1[index], high2[index], high3[index]);
528 shaders_[shader].shader->use();
529 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
530 shaders_[shader].resonance->set(ladder_filter_.
getResonance()[index]);
531 shaders_[shader].drive->set(ladder_filter_.
getDrive()[index]);
533 for (
int s = 0; s < FilterResponseShader::kMaxStages; ++s)
534 shaders_[shader].stages[s]->set(ladder_filter_.
getStageScale(s)[index]);
538 shaders_[shader].shader->use();
539 shaders_[shader].midi_cutoff->set(filter_state_.
midi_cutoff[index]);
540 shaders_[shader].resonance->set(phaser_filter_.
getResonance()[index]);
543 shaders_[shader].stages[0]->set(phaser_filter_.
getPeak1Amount()[index]);
544 shaders_[shader].stages[1]->set(phaser_filter_.
getPeak3Amount()[index]);
545 shaders_[shader].stages[2]->set(phaser_filter_.
getPeak5Amount()[index]);
548 shaders_[shader].mix->set(mix_[index]);
551void FilterResponse::bind(FilterShader shader, OpenGLContext& open_gl_context) {
552 open_gl_context.extensions.glBindVertexArray(vertex_array_object_);
553 open_gl_context.extensions.glBindBuffer(GL_ARRAY_BUFFER, line_buffer_);
555 OpenGLShaderProgram::Attribute* position = shaders_[shader].position.get();
556 open_gl_context.extensions.glVertexAttribPointer(position->attributeID, 2, GL_FLOAT,
557 GL_FALSE, 2 *
sizeof(
float),
nullptr);
558 open_gl_context.extensions.glEnableVertexAttribArray(position->attributeID);
560 open_gl_context.extensions.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, response_buffer_);
563void FilterResponse::unbind(FilterShader shader, OpenGLContext& open_gl_context) {
564 OpenGLShaderProgram::Attribute* position = shaders_[shader].position.get();
565 open_gl_context.extensions.glDisableVertexAttribArray(position->attributeID);
566 open_gl_context.extensions.glBindBuffer(GL_ARRAY_BUFFER, 0);
567 open_gl_context.extensions.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
570void FilterResponse::drawFilterResponse(
OpenGlWrapper& open_gl) {
572 bool new_response = setupFilterState(model);
573 new_response = new_response || isStereoState();
575 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
579 Colour color_line = line_right_color_;
580 Colour color_fill_to = fill_right_color_;
582 Colour color_fill_from = color_fill_to.withMultipliedAlpha(1.0f - fill_fade);
592 loadShader(shader, model, 1);
593 renderLineResponse(open_gl);
601 color_line = line_left_color_;
602 color_fill_to = fill_left_color_;
604 color_line = line_disabled_color_;
605 color_fill_to = fill_disabled_color_;
607 color_fill_from = color_fill_to.withMultipliedAlpha(1.0f - fill_fade);
611 loadShader(shader, model, 0);
612 renderLineResponse(open_gl);
619 unbind(shader, open_gl.
context);
624void FilterResponse::renderLineResponse(
OpenGlWrapper& open_gl) {
626 open_gl.
context.extensions.glBeginTransformFeedback(GL_POINTS);
628 open_gl.
context.extensions.glEndTransformFeedback();
630 void* buffer = open_gl.
context.extensions.glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0,
633 float* response_data = (
float*)buffer;
634 float width = getWidth();
635 float y_adjust = getHeight() / 2.0f;
638 setYAt(i, y_adjust * (1.0f - response_data[i]));
641 open_gl.
context.extensions.glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
Displays the frequency response of various filter models in Vital.
Definition filter_response.h:26
void mouseDrag(const MouseEvent &e) override
Handles mouse drag events, allowing interactive adjustment of filter parameters.
Definition filter_response.cpp:328
void destroy(OpenGlWrapper &open_gl) override
Destroys the OpenGL resources used by this component.
Definition filter_response.cpp:240
void mouseDown(const MouseEvent &e) override
Handles mouse down events, initiating user interaction with filter parameters.
Definition filter_response.cpp:311
FilterShader
An enumeration of different filter shader programs used for rendering.
Definition filter_response.h:43
@ kLadder
Definition filter_response.h:46
@ kPositiveFlange
Definition filter_response.h:51
@ kComb
Definition filter_response.h:50
@ kDigital
Definition filter_response.h:47
@ kNumFilterShaders
Definition filter_response.h:54
@ kDiode
Definition filter_response.h:48
@ kNegativeFlange
Definition filter_response.h:52
@ kFormant
Definition filter_response.h:49
@ kPhase
Definition filter_response.h:53
@ kDirty
Definition filter_response.h:45
@ kAnalog
Definition filter_response.h:44
void paintBackground(Graphics &g) override
Draws the background of the component (e.g. coloring, grid lines).
Definition filter_response.cpp:272
virtual ~FilterResponse()
Destructor.
Definition filter_response.cpp:188
void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Handles mouse wheel events for fine-tuning filter parameters.
Definition filter_response.cpp:338
void mouseExit(const MouseEvent &e) override
Handles mouse exit events, finalizing interactive changes and hiding tooltips.
Definition filter_response.cpp:332
void render(OpenGlWrapper &open_gl, bool animate) override
Renders the filter response curve to the screen.
Definition filter_response.cpp:234
FilterResponse(String suffix, const vital::output_map &mono_modulations)
Constructs a FilterResponse given a suffix and modulation outputs for a single filter configuration.
Definition filter_response.cpp:157
static constexpr int kResolution
Number of points used for drawing the filter response curve.
Definition filter_response.h:29
void init(OpenGlWrapper &open_gl) override
Initializes the OpenGL resources for the filter response visualization.
Definition filter_response.cpp:190
static bool setViewPort(Component *component, Rectangle< int > bounds, OpenGlWrapper &open_gl)
Sets the OpenGL viewport to match a specified rectangle within a component.
Definition open_gl_component.cpp:42
const vital::StatusOutput * num_voices_readout_
StatusOutput for voice count lookups.
Definition open_gl_component.h:258
static std::unique_ptr< OpenGLShaderProgram::Attribute > getAttribute(const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
Retrieves an attribute from the shader program if it exists.
Definition open_gl_component.h:79
void renderCorners(OpenGlWrapper &open_gl, bool animate, Colour color, float rounding)
Renders the corner shapes using the given color and rounding amount.
Definition open_gl_component.cpp:153
force_inline void checkGlError()
Checks for and asserts that there are no OpenGL errors.
Definition open_gl_component.h:231
float findValue(Skin::ValueId value_id)
Finds a float value from the skin associated with this component's parent.
Definition open_gl_component.cpp:173
static std::unique_ptr< OpenGLShaderProgram::Uniform > getUniform(const OpenGlWrapper &open_gl, const OpenGLShaderProgram &program, const char *name)
Retrieves a uniform from the shader program if it exists.
Definition open_gl_component.h:64
A component for rendering lines with optional filling and boost effects using OpenGL.
Definition open_gl_line_renderer.h:16
virtual void init(OpenGlWrapper &open_gl) override
Initializes OpenGL resources for rendering the line.
Definition open_gl_line_renderer.cpp:78
virtual void destroy(OpenGlWrapper &open_gl) override
Destroys OpenGL resources allocated by this line renderer.
Definition open_gl_line_renderer.cpp:468
force_inline void setFillCenter(float fill_center)
Sets the vertical center for the fill area.
Definition open_gl_line_renderer.h:138
virtual void render(OpenGlWrapper &open_gl, bool animate) override
Renders the line using OpenGL.
Definition open_gl_line_renderer.cpp:464
force_inline void setYAt(int index, float val)
Sets the y-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:98
force_inline void setXAt(int index, float val)
Sets the x-coordinate of a point, marking data as dirty.
Definition open_gl_line_renderer.h:105
force_inline void setFillColors(Colour fill_color_from, Colour fill_color_to)
Sets a gradient fill from one color to another.
Definition open_gl_line_renderer.h:132
force_inline void setLineWidth(float width)
Sets the line width in pixels.
Definition open_gl_line_renderer.h:66
force_inline void setColor(Colour color)
Sets the line color.
Definition open_gl_line_renderer.h:63
VertexShader
An enumeration of all available vertex shaders.
Definition shaders.h:27
@ kNumVertexShaders
Definition shaders.h:49
@ kDirtyFilterResponseVertex
Definition shaders.h:40
@ kDigitalFilterResponseVertex
Definition shaders.h:38
@ kDiodeFilterResponseVertex
Definition shaders.h:39
@ kAnalogFilterResponseVertex
Definition shaders.h:34
@ kFormantFilterResponseVertex
Definition shaders.h:41
@ kPhaserFilterResponseVertex
Definition shaders.h:43
@ kLadderFilterResponseVertex
Definition shaders.h:42
@ kPositiveFlangeFilterResponseVertex
Definition shaders.h:36
@ kCombFilterResponseVertex
Definition shaders.h:35
@ kNegativeFlangeFilterResponseVertex
Definition shaders.h:37
@ kColorFragment
Definition shaders.h:63
OpenGLShaderProgram * getShaderProgram(VertexShader vertex_shader, FragmentShader fragment_shader, const GLchar **varyings=nullptr)
Retrieves or creates an OpenGLShaderProgram from a given vertex and fragment shader pair.
Definition shaders.cpp:953
@ kWidgetLineWidth
Definition skin.h:105
@ kWidgetFillCenter
Definition skin.h:107
@ kWidgetFillFade
Definition skin.h:108
@ kWidgetPrimaryDisabled
Definition skin.h:167
@ kWidgetPrimary2
Definition skin.h:166
@ kWidgetPrimary1
Definition skin.h:165
@ kWidgetBackground
Definition skin.h:173
@ kWidgetSecondary1
Definition skin.h:168
@ kWidgetSecondaryDisabled
Definition skin.h:170
@ kWidgetSecondary2
Definition skin.h:169
void hidePopup(bool primary)
Definition synth_slider.cpp:640
void showPopup(bool primary)
Definition synth_slider.cpp:635
virtual void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Definition synth_slider.cpp:346
poly_float getResonance()
Getter for the feedback parameter controlling comb/flange feedback amount.
Definition comb_filter.h:172
poly_float getHighAmount()
Getter for the high-frequency gain used in filter blending.
Definition comb_filter.h:186
void setupFilter(const FilterState &filter_state) override
Sets up the CombFilter state based on a FilterState struct.
Definition comb_filter.cpp:229
poly_float getFilterMidiCutoff()
Getter for the primary filter MIDI cutoff.
Definition comb_filter.h:193
poly_float getLowAmount()
Getter for the low-frequency gain used in filter blending.
Definition comb_filter.h:179
poly_float getFilter2MidiCutoff()
Getter for the secondary filter MIDI cutoff (used in band-spread style).
Definition comb_filter.h:200
FeedbackStyle
Types of feedback for the comb filter (comb, positive/negative flange).
Definition comb_filter.h:24
@ kComb
Standard comb filtering.
Definition comb_filter.h:25
@ kPositiveFlange
Positive flanging effect.
Definition comb_filter.h:26
poly_float getDrive()
Getter for the drive (scale) parameter controlling input amplitude scaling.
Definition comb_filter.h:165
static FeedbackStyle getFeedbackStyle(int style)
Converts an integer to a valid FeedbackStyle, wrapping around kNumFeedbackStyles.
Definition comb_filter.h:47
A state-variable filter (SVF) implementation, supporting multiple filter types (12/24 dB,...
Definition digital_svf.h:17
poly_float getMidiCutoff() const
Retrieves the current MIDI-based cutoff frequency.
Definition digital_svf.h:345
poly_float getResonance() const
Retrieves the current resonance value (inverted if needed).
Definition digital_svf.h:351
void setupFilter(const FilterState &filter_state) override
Configures this SVF based on a FilterState (cutoff, resonance, style, etc.).
Definition digital_svf.cpp:237
poly_float getBandAmount() const
Retrieves the current band-frequency mix portion.
Definition digital_svf.h:363
poly_float getHighAmount24(int style) const
Helper for a 24 dB filter style that may swap low/high in a dual notch band.
Definition digital_svf.h:389
poly_float getLowAmount24(int style) const
Helper for a 24 dB filter style that may swap low/high in a dual notch band.
Definition digital_svf.h:377
poly_float getHighAmount() const
Retrieves the current high-frequency mix portion.
Definition digital_svf.h:369
poly_float getLowAmount() const
Retrieves the current low-frequency mix portion.
Definition digital_svf.h:357
poly_float getDrive() const
Retrieves the final drive (post drive compensation) used in the filter.
Definition digital_svf.h:339
poly_float getHighPassAmount()
Gets the current high-pass amount.
Definition diode_filter.h:137
poly_float getHighPassRatio()
Gets the current high-pass ratio.
Definition diode_filter.h:131
poly_float getResonance()
Gets the current resonance setting of the filter.
Definition diode_filter.h:119
void setupFilter(const FilterState &filter_state) override
Sets up filter parameters from the given FilterState.
Definition diode_filter.cpp:131
poly_float getDrive()
Gets the current drive setting of the filter.
Definition diode_filter.h:125
force_inline poly_float getBandAmount()
Gets the band-pass blend amount.
Definition dirty_filter.h:180
force_inline poly_float getLowAmount()
Gets the low-pass blend amount.
Definition dirty_filter.h:175
force_inline poly_float getResonance()
Gets the current resonance value adjusted by coefficient and drive.
Definition dirty_filter.h:158
void setupFilter(const FilterState &filter_state) override
Sets up the filter's internal state (cutoff, resonance, drive, blend) from the given FilterState.
Definition dirty_filter.cpp:396
force_inline poly_float getDrive()
Gets the current drive value adjusted based on resonance.
Definition dirty_filter.h:166
force_inline poly_float getLowAmount24(int style)
For 24 dB mode, gets the low amount depending on filter style.
Definition dirty_filter.h:190
force_inline poly_float getHighAmount()
Gets the high-pass blend amount.
Definition dirty_filter.h:185
force_inline poly_float getHighAmount24(int style)
For 24 dB mode, gets the high amount depending on filter style.
Definition dirty_filter.h:199
poly_float getResonance()
Retrieves the current resonance setting.
Definition ladder_filter.h:125
poly_float getStageScale(int index)
Retrieves the scale value for one of the filter’s output stages.
Definition ladder_filter.h:132
void setupFilter(const FilterState &filter_state) override
Configures the filter parameters based on a FilterState.
Definition ladder_filter.cpp:126
poly_float getDrive()
Retrieves the current drive setting.
Definition ladder_filter.h:119
poly_float getPeak1Amount()
Gets the current peak1 (lowest peak cluster) mix amount.
Definition phaser_filter.h:120
poly_float getResonance()
Gets the current resonance value.
Definition phaser_filter.h:108
poly_float getPeak3Amount()
Gets the current peak3 (second peak cluster) mix amount.
Definition phaser_filter.h:126
poly_float getPeak5Amount()
Gets the current peak5 (highest peak cluster) mix amount.
Definition phaser_filter.h:132
void setupFilter(const FilterState &filter_state) override
Sets up the filter parameters (resonance, drive, peaks) based on the FilterState.
Definition phaser_filter.cpp:71
poly_float getLowAmount24(int style)
For 24 dB modes, gets the low amount depending on the style.
Definition sallen_key_filter.h:172
poly_float getLowAmount()
Gets the low-pass blend amount.
Definition sallen_key_filter.h:157
poly_float getDrive()
Gets the current drive value.
Definition sallen_key_filter.h:152
poly_float getHighAmount24(int style)
For 24 dB modes, gets the high amount depending on the style.
Definition sallen_key_filter.h:181
poly_float getHighAmount()
Gets the high-pass blend amount.
Definition sallen_key_filter.h:167
void setupFilter(const FilterState &filter_state) override
Sets up the filter parameters (cutoff, resonance, drive) and mode from a given FilterState.
Definition sallen_key_filter.cpp:320
poly_float getBandAmount()
Gets the band-pass blend amount.
Definition sallen_key_filter.h:162
poly_float getResonance()
Gets the current resonance value.
Definition sallen_key_filter.h:147
force_inline poly_float value() const
Returns the current status value.
Definition synth_module.h:49
poly_float transpose
Transpose in semitones (applied to midi_cutoff)
Definition synth_filter.h:120
poly_float interpolate_x
Interpolation X coordinate (e.g., for formant filters)
Definition synth_filter.h:118
poly_float interpolate_y
Interpolation Y coordinate (e.g., for formant filters)
Definition synth_filter.h:119
poly_float pass_blend
Blend parameter in [0..2], controlling pass type.
Definition synth_filter.h:117
int style
Filter style enum (e.g., k12Db, k24Db)
Definition synth_filter.h:116
poly_float midi_cutoff
MIDI note-based cutoff value.
Definition synth_filter.h:110
poly_float resonance_percent
Resonance parameter in [0..1].
Definition synth_filter.h:112
@ k12Db
Definition synth_filter.h:75
#define VITAL_ASSERT(x)
Definition common.h:11
const poly_mask kFullMask
A mask covering all lanes of a poly_float vector.
Definition synth_constants.h:257
FilterModel
Identifiers for different filter models available in Vital’s filters.
Definition synth_constants.h:194
@ kDirty
Definition synth_constants.h:196
@ kDigital
Definition synth_constants.h:198
@ kAnalog
Definition synth_constants.h:195
@ kPhase
Definition synth_constants.h:202
@ kFormant
Definition synth_constants.h:200
@ kDiode
Definition synth_constants.h:199
@ kLadder
Definition synth_constants.h:197
@ kComb
Definition synth_constants.h:201
force_inline poly_float clamp(poly_float value, mono_float min, mono_float max)
Clamps each lane of a vector to [min, max].
Definition poly_utils.h:306
force_inline poly_float max(poly_float left, poly_float right)
Returns the maximum of two poly_floats lane-by-lane.
Definition poly_utils.h:327
force_inline bool equal(poly_float left, poly_float right)
Checks if two poly_floats are equal lane-by-lane. Returns true if all lanes match.
Definition poly_utils.h:341
force_inline poly_float swapStereo(poly_float value)
Swaps the left and right channels of a stereo poly_float.
Definition poly_utils.h:411
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
OpenGLContext & context
The OpenGLContext for current rendering.
Definition shaders.h:181
Shaders * shaders
Pointer to the Shaders instance providing compiled shaders.
Definition shaders.h:182
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
static force_inline mask_simd_type vector_call equal(simd_type one, simd_type two)
Compares two SIMD float registers for equality, element-wise.
Definition poly_values.h:954
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...
Provides various utility functions, classes, and constants for audio, math, and general-purpose opera...