59 OpenGlSlider(String name) : Slider(name),
parent_(nullptr), modulation_knob_(false), modulation_amount_(0.0f),
60 paint_to_image_(false), active_(true), bipolar_(false), slider_quad_(this) {
81 Slider::valueChanged();
87 parent_ = findParentComponentOfClass<SynthSection>();
88 Slider::parentHierarchyChanged();
94 paint_to_image_ = paint;
112 return modulation_knob_;
118 return !paint_to_image_ && getSliderStyle() == RotaryHorizontalVerticalDrag && !
isTextOrCurve();
124 return !paint_to_image_ && getSliderStyle() == LinearBar && !
isTextOrCurve();
130 return !paint_to_image_ && getSliderStyle() == LinearBarVertical && !
isTextOrCurve();
136 return &image_component_;
142 return &slider_quad_;
177 if (bipolar_ == bipolar)
187 if (active_ == active)
227 return findColour(
Skin::kRotaryArc,
true).interpolatedWith(background, 0.5f);
293 Colour selected_color_;
294 Colour unselected_color_;
295 Colour background_color_;
298 bool modulation_knob_;
299 float modulation_amount_;
300 bool paint_to_image_;
306 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
OpenGlSlider)
370 virtual void mouseDown(
const MouseEvent& e)
override;
371 virtual void mouseDrag(
const MouseEvent& e)
override;
372 virtual void mouseEnter(
const MouseEvent& e)
override;
373 virtual void mouseExit(
const MouseEvent& e)
override;
374 virtual void mouseUp(
const MouseEvent& e)
override;
376 virtual void mouseWheelMove(
const MouseEvent& e,
const MouseWheelDetails& wheel)
override;
377 virtual void focusLost(FocusChangeType cause)
override;
423 virtual double snapValue(
double attemptedValue, DragMode dragMode)
override;
478 setScrollWheelEnabled(enabled);
563 return getLocalBounds();
782 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
SynthSlider)
static CurveLookAndFeel * instance()
Gets the singleton instance of CurveLookAndFeel.
Definition curve_look_and_feel.h:52
The main GUI container for the entire synthesizer interface.
Definition full_interface.h:61
A base component class that integrates JUCE's Component with OpenGL rendering.
Definition open_gl_component.h:20
A component that uses OpenGL to render a cached image of a JUCE component or custom drawing.
Definition open_gl_image_component.h:18
void setComponent(Component *component)
Sets the component to be drawn into the OpenGL image. If not set, uses this component.
Definition open_gl_image_component.h:83
void setActive(bool active)
Sets whether this component is active (rendered) or not.
Definition open_gl_image_component.h:113
void paintEntireComponent(bool paint_entire_component)
Controls whether paintToImage should paint the entire component hierarchy or just itself.
Definition open_gl_image_component.h:125
void setScissor(bool scissor)
Enables or disables scissor testing when drawing the image.
Definition open_gl_image_component.h:89
void setActive(bool active)
Activates or deactivates rendering of this component.
Definition open_gl_multi_quad.h:331
void setTargetComponent(Component *target_component)
Sets a target component to help position the quads.
Definition open_gl_multi_quad.h:358
void setDrawWhenNotVisible(bool draw)
Sets whether to draw even if the component is not visible.
Definition open_gl_multi_quad.h:391
force_inline void setMaxArc(float max_arc)
Sets the maximum arc angle or similar parameter used by some shaders.
Definition open_gl_multi_quad.h:158
void setAlpha(float alpha, bool reset=false)
Sets the alpha blending multiplier, can reset to this alpha.
Definition open_gl_multi_quad.h:382
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
An extended JUCE Slider that leverages OpenGL for rendering.
Definition synth_slider.h:52
void setMaxArc(float arc)
Definition synth_slider.h:147
bool isRotaryQuad() const
Definition synth_slider.h:117
bool isText() const
Definition synth_slider.h:99
virtual Colour getUnselectedColor() const
Definition synth_slider.h:209
virtual float findValue(Skin::ValueId value_id) const
Definition synth_slider.h:269
void setModulationAmount(float modulation)
Definition synth_slider.h:156
bool isBipolar() const
Definition synth_slider.h:168
virtual float getKnobSizeScale() const
Definition synth_slider.h:164
virtual Colour getModColor() const
Definition synth_slider.h:197
float getModulationAmount() const
Definition synth_slider.h:160
virtual void resized() override
Called when the component is resized. Updates colors and display values.
Definition synth_slider.h:73
bool isHorizontalQuad() const
Definition synth_slider.h:123
bool isTextOrCurve() const
Definition synth_slider.h:105
virtual Colour getBackgroundColor() const
Definition synth_slider.h:203
virtual void valueChanged() override
Called when the slider value changes. Redraws the image to reflect the new value.
Definition synth_slider.h:80
virtual Colour getThumbColor() const
Definition synth_slider.h:242
void parentHierarchyChanged() override
Called when the parent hierarchy changes. Used for retrieving parent sections.
Definition synth_slider.h:86
void setActive(bool active=true)
Definition synth_slider.h:186
OpenGlSlider(String name)
Definition synth_slider.h:59
void setColors()
Updates internal colors based on the current skin and state.
Definition synth_slider.cpp:144
int getLinearSliderWidth()
Definition synth_slider.cpp:33
void setDrawWhenNotVisible(bool draw)
Definition synth_slider.h:282
OpenGlComponent * getImageComponent()
Definition synth_slider.h:135
void setSliderDisplayValues()
Sets the slider display values (positions, sizes) based on current style.
Definition synth_slider.cpp:39
void redoImage(bool skip_image=false)
Definition synth_slider.cpp:64
SynthSection * getSectionParent()
Definition synth_slider.h:286
void paintToImage(bool paint)
Definition synth_slider.h:93
virtual Colour getSelectedColor() const
Definition synth_slider.h:223
static constexpr float kRotaryAngle
The default rotary arc angle used for rotary sliders.
Definition synth_slider.h:55
void setAlpha(float alpha, bool reset=false)
Definition synth_slider.h:278
bool isVerticalQuad() const
Definition synth_slider.h:129
void setBipolar(bool bipolar=true)
Definition synth_slider.h:176
void setModulationKnob()
Marks this slider as a modulation knob.
Definition synth_slider.h:152
OpenGlComponent * getQuadComponent()
Definition synth_slider.h:141
bool isModulationKnob() const
Definition synth_slider.h:111
SynthSection * parent_
The parent SynthSection.
Definition synth_slider.h:289
bool isActive() const
Definition synth_slider.h:172
A specialized OpenGlQuad for rendering a slider using OpenGL.
Definition synth_slider.h:25
OpenGlSliderQuad(OpenGlSlider *slider)
Definition synth_slider.h:29
virtual void init(OpenGlWrapper &open_gl) override
Definition synth_slider.cpp:16
void paintBackground(Graphics &g) override
Definition synth_slider.cpp:29
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
ValueId
Identifiers for various UI scaling/spacing values and configuration constants.
Definition skin.h:70
@ kRotaryArcUnselectedDisabled
Definition skin.h:153
@ kLinearSliderThumb
Definition skin.h:161
@ kRotaryArcDisabled
Definition skin.h:151
@ kWidgetBackground
Definition skin.h:173
@ kRotaryArcUnselected
Definition skin.h:152
@ kLinearSliderDisabled
Definition skin.h:159
@ kRotaryArc
Definition skin.h:150
@ kModulationMeterControl
Definition skin.h:178
@ kRotaryHand
Definition skin.h:154
@ kLinearSliderThumbDisabled
Definition skin.h:162
@ kLinearSlider
Definition skin.h:158
@ kLinearSliderUnselected
Definition skin.h:160
An interface class linking the Vital synthesizer backend (SynthBase) with a GUI.
Definition synth_gui_interface.h:56
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
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
Listener interface for receiving slider events such as mouse interactions, modulation changes,...
Definition synth_slider.h:347
virtual void menuFinished(SynthSlider *slider)
Definition synth_slider.h:356
virtual void modulationAmountChanged(SynthSlider *slider)
Definition synth_slider.h:360
virtual void modulationRemoved(SynthSlider *slider)
Definition synth_slider.h:361
virtual void focusLost(SynthSlider *slider)
Definition synth_slider.h:357
virtual void hoverStarted(SynthSlider *slider)
Definition synth_slider.h:350
virtual void mouseUp(SynthSlider *slider)
Definition synth_slider.h:353
virtual void guiChanged(SynthSlider *slider)
Definition synth_slider.h:362
virtual void doubleClick(SynthSlider *slider)
Definition synth_slider.h:358
virtual void beginModulationEdit(SynthSlider *slider)
Definition synth_slider.h:354
virtual ~SliderListener()
Definition synth_slider.h:349
virtual void hoverEnded(SynthSlider *slider)
Definition synth_slider.h:351
virtual void modulationsChanged(const std::string &name)
Definition synth_slider.h:359
virtual void mouseDown(SynthSlider *slider)
Definition synth_slider.h:352
virtual void endModulationEdit(SynthSlider *slider)
Definition synth_slider.h:355
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
float snap_value_
Definition synth_slider.h:738
void setScalingType(vital::ValueDetails::ValueScale scaling_type)
Definition synth_slider.h:460
void setShowPopupOnHover(bool show)
Definition synth_slider.h:629
float knob_size_scale_
Definition synth_slider.h:740
Point< int > mouse_down_position_
Definition synth_slider.h:754
void setKnobSizeScale(float scale)
Definition synth_slider.h:639
double getAdjustedValue(double value)
Definition synth_slider.cpp:430
void setTextEntryWidthPercent(float percent)
Definition synth_slider.h:621
void setModulationBarRight(bool right)
Definition synth_slider.h:657
void textEditorReturnKeyPressed(TextEditor &editor) override
Definition synth_slider.cpp:516
const std::string * getStringLookup() const
Definition synth_slider.h:483
int shift_index_amount_
Definition synth_slider.h:746
virtual bool shouldShowPopup()
Definition synth_slider.h:440
Point< int > last_modulation_edit_position_
Definition synth_slider.h:753
double getValueFromAdjusted(double value)
Definition synth_slider.cpp:466
virtual void parentHierarchyChanged() override
Called when the parent hierarchy changes, updates references to synthesizer.
Definition synth_slider.cpp:499
void setStringLookup(const std::string *lookup)
Definition synth_slider.h:470
void setModulationPlacement(BubbleComponent::BubblePlacement placement)
Definition synth_slider.h:521
void setDisplayMultiply(float multiply)
Definition synth_slider.h:665
BubbleComponent::BubblePlacement popup_placement_
Definition synth_slider.h:742
void setAlternateDisplay(Skin::ValueId id, float value, vital::ValueDetails details)
Definition synth_slider.h:691
bool has_parameter_assignment_
Definition synth_slider.h:736
static constexpr float kDefaultTextEntryWidthPercent
Definition synth_slider.h:329
virtual void focusLost(FocusChangeType cause) override
Definition synth_slider.cpp:370
void setLinearTextEntryBounds()
Sets bounds for text entry in linear mode.
Definition synth_slider.cpp:742
BubbleComponent::BubblePlacement modulation_control_placement_
Definition synth_slider.h:743
virtual void valueChanged() override
Called when the slider value changes. Notifies GUIs.
Definition synth_slider.cpp:375
virtual void mouseDrag(const MouseEvent &e) override
Definition synth_slider.cpp:264
static constexpr float kDefaultTextHeightPercentage
Definition synth_slider.h:337
String formatValue(float value)
Definition synth_slider.cpp:644
Rectangle< int > getModulationArea() const
Definition synth_slider.h:560
void setMouseWheelMovement(double movement)
Definition synth_slider.h:600
vital::ValueDetails * getDisplayDetails()
Definition synth_slider.cpp:767
String popup_prefix_
Definition synth_slider.h:725
Component * extra_modulation_target_
Definition synth_slider.h:765
PopupItems createPopupMenu()
Definition synth_slider.cpp:204
int max_display_characters_
Definition synth_slider.h:744
bool isModulationBypassed() const
Definition synth_slider.h:580
vital::ValueDetails alternate_details_
Definition synth_slider.h:761
String getRawTextFromValue(double value)
Definition synth_slider.cpp:380
bool bypass_modulation_
Definition synth_slider.h:730
void setRotaryTextEntryBounds()
Sets bounds for text entry in rotary mode.
Definition synth_slider.cpp:730
virtual void mouseDown(const MouseEvent &e) override
Mouse event overrides for custom behavior.
Definition synth_slider.cpp:234
bool shift_is_multiplicative_
Definition synth_slider.h:747
static constexpr float kSlowDragMultiplier
Definition synth_slider.h:334
void setDefaultRange()
Sets the default parameter range based on the parameter details.
Definition synth_slider.cpp:621
void setShiftIndexAmount(int shift_amount)
Definition synth_slider.h:625
void useSuffix(bool use)
Definition synth_slider.h:645
void snapToValue(bool snap, float value=0.0)
Definition synth_slider.h:453
SynthSlider(String name)
Definition synth_slider.cpp:155
void textEditorFocusLost(TextEditor &editor) override
Definition synth_slider.cpp:520
float getTextHeightPercentage()
Definition synth_slider.h:588
static constexpr int kDefaultFormatLength
Definition synth_slider.h:327
float findValue(Skin::ValueId value_id) const override
Definition synth_slider.h:681
void setExtraModulationTarget(Component *component)
Definition synth_slider.h:649
String getTextFromValue(double value) override
Definition synth_slider.cpp:404
Rectangle< int > getModulationMeterBounds() const
Definition synth_slider.cpp:673
bool stereo_modulation_
Definition synth_slider.h:729
static constexpr float kRotaryModulationControlPercent
Definition synth_slider.h:339
std::vector< vital::ModulationConnection * > getConnections()
Definition synth_slider.cpp:695
void notifyModulationAmountChanged()
Notifies listeners that modulation amount has changed.
Definition synth_slider.cpp:752
static constexpr int kDefaultFormatDecimalPlaces
Definition synth_slider.h:328
static constexpr float kLinearWidthPercent
Definition synth_slider.h:341
bool isModulationBarRight()
Definition synth_slider.h:661
String getSliderTextFromValue(double value)
Definition synth_slider.cpp:387
void setMaxDisplayCharacters(int characters)
Definition synth_slider.h:604
double mouse_wheel_index_movement_
Definition synth_slider.h:748
bool show_popup_on_hover_
Definition synth_slider.h:724
void setPopupPrefix(String prefix)
Definition synth_slider.h:633
float text_entry_width_percent_
Definition synth_slider.h:749
bool bipolar_modulation_
Definition synth_slider.h:728
float mouseHovering() const
Definition synth_slider.h:592
void setUnits(const String &units)
Definition synth_slider.h:487
void setScrollEnabled(bool enabled)
Definition synth_slider.h:476
void addSliderListener(SliderListener *listener)
Definition synth_slider.cpp:631
void notifyModulationRemoved()
Notifies listeners that a modulation was removed.
Definition synth_slider.cpp:757
float display_exponential_base_
Definition synth_slider.h:758
void setTextEntrySizePercent(float width_percent, float height_percent)
Definition synth_slider.h:613
void setSensitivity(double sensitivity)
Definition synth_slider.h:542
void hidePopup(bool primary)
Definition synth_slider.cpp:640
bool hasModulationArea() const
Definition synth_slider.h:554
std::map< Skin::ValueId, float > value_lookup_
Definition synth_slider.h:752
virtual void mouseExit(const MouseEvent &e) override
Definition synth_slider.cpp:327
void handlePopupResult(int result)
Definition synth_slider.cpp:703
double sensitivity_
Definition synth_slider.h:741
int max_decimal_places_
Definition synth_slider.h:745
virtual double snapValue(double attemptedValue, DragMode dragMode) override
Definition synth_slider.cpp:504
vital::ValueDetails::ValueScale getScalingType() const
Definition synth_slider.h:466
void overrideValue(Skin::ValueId value_id, float value)
Definition synth_slider.h:674
double getSensitivity()
Definition synth_slider.h:546
Component * getExtraModulationTarget()
Definition synth_slider.h:653
float text_entry_height_percent_
Definition synth_slider.h:750
void showPopup(bool primary)
Definition synth_slider.cpp:635
virtual void mouseUp(const MouseEvent &e) override
Definition synth_slider.cpp:302
std::unique_ptr< OpenGlTextEditor > text_entry_
Definition synth_slider.h:767
String getUnits() const
Definition synth_slider.h:491
bool isModulationStereo() const
Definition synth_slider.h:576
BubbleComponent::BubblePlacement getPopupPlacement()
Definition synth_slider.h:527
void setPopupSuffix(const juce::String &suffix)
Definition synth_slider.h:635
static constexpr float kDefaultRotaryDragLength
Definition synth_slider.h:338
void setPopupPlacement(BubbleComponent::BubblePlacement placement)
Definition synth_slider.h:515
SynthGuiInterface * synth_interface_
Definition synth_slider.h:766
static constexpr float kModulationSensitivity
Definition synth_slider.h:331
bool snap_to_value_
Definition synth_slider.h:734
bool scroll_enabled_
Definition synth_slider.h:727
static constexpr float kDefaultSensitivity
Definition synth_slider.h:335
virtual void mouseEnter(const MouseEvent &e) override
Definition synth_slider.cpp:315
virtual void mouseDoubleClick(const MouseEvent &e) override
Definition synth_slider.cpp:337
void setMaxDecimalPlaces(int decimal_places)
Definition synth_slider.h:608
BubbleComponent::BubblePlacement getModulationPlacement()
Definition synth_slider.h:531
void textEditorTextChanged(TextEditor &) override
TextEditor::Listener overrides for handling text entry.
Definition synth_slider.h:426
bool modulation_bar_right_
Definition synth_slider.h:731
float display_multiply_
Definition synth_slider.h:757
void showTextEntry()
Shows the text entry box for manual value entry.
Definition synth_slider.cpp:533
void notifyGuis()
Notifies GUI listeners of a value change.
Definition synth_slider.cpp:668
virtual void mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel) override
Definition synth_slider.cpp:346
String popupSuffix_
Definition synth_slider.h:726
bool hovering_
Definition synth_slider.h:735
void setDisplayExponentialBase(float base)
Definition synth_slider.h:669
static constexpr float kLinearModulationPercent
Definition synth_slider.h:343
void setSliderPositionFromText()
Sets the slider position from the current text in the text editor.
Definition synth_slider.cpp:524
std::vector< SliderListener * > slider_listeners_
Definition synth_slider.h:769
Rectangle< int > modulation_area_
Definition synth_slider.h:732
static constexpr float kTextEntryHeightPercent
Definition synth_slider.h:332
bool use_suffix_
Definition synth_slider.h:737
std::pair< Skin::ValueId, float > alternate_display_setting_
Definition synth_slider.h:760
float getKnobSizeScale() const override
Definition synth_slider.h:641
MenuId
Menu item IDs for the right-click popup menu.
Definition synth_slider.h:317
@ kDefaultValue
Definition synth_slider.h:321
@ kClearModulations
Definition synth_slider.h:323
@ kModulationList
Definition synth_slider.h:324
@ kClearMidiLearn
Definition synth_slider.h:320
@ kManualEntry
Definition synth_slider.h:322
@ kCancel
Definition synth_slider.h:318
@ kArmMidiLearn
Definition synth_slider.h:319
void setTextHeightPercentage(float percentage)
Definition synth_slider.h:584
void notifyModulationsChanged()
Notifies listeners that modulations changed.
Definition synth_slider.cpp:762
double getValueFromText(const String &text) override
Definition synth_slider.cpp:415
vital::ValueDetails details_
Definition synth_slider.h:756
OpenGlComponent * getTextEditorComponent()
Definition synth_slider.h:702
bool isModulationBipolar() const
Definition synth_slider.h:572
float text_height_percentage_
Definition synth_slider.h:739
bool sensitive_mode_
Definition synth_slider.h:733
virtual void drawShadow(Graphics &g)
Definition synth_slider.cpp:553
void setValueFromAdjusted(double value)
Definition synth_slider.cpp:495
void drawRotaryShadow(Graphics &g)
Definition synth_slider.cpp:563
const std::string * string_lookup_
Definition synth_slider.h:763
static constexpr float kDefaultTextEntryHeightPercent
Definition synth_slider.h:330
static constexpr float kLinearHandlePercent
Definition synth_slider.h:342
void setModulationArea(Rectangle< int > area)
Definition synth_slider.h:568
static TextLookAndFeel * instance()
Singleton instance access.
Definition text_look_and_feel.h:106
constexpr mono_float kPi
Pi constant.
Definition common.h:36
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174
Holds metadata about a single parameter (control) in the Vital synthesizer.
Definition synth_parameters.h:23
ValueScale
Describes the scaling mode used to interpret and display parameter values.
Definition synth_parameters.h:28
ValueScale value_scale
The scaling mode of the parameter value.
Definition synth_parameters.h:45
std::string display_units
Units to display next to the parameter (e.g., "Hz", "dB").
Definition synth_parameters.h:47