Vital
Loading...
Searching...
No Matches
ModulationAmountKnob Class Reference

A specialized SynthSlider that represents a single modulation amount control. More...

#include <modulation_manager.h>

Inheritance diagram for ModulationAmountKnob:
SynthSlider OpenGlSlider

Classes

class  Listener
 Interface for objects interested in ModulationAmountKnob events. More...
 

Public Types

enum  MenuOptions { kDisconnect = 0xff , kToggleBypass , kToggleBipolar , kToggleStereo }
 Options in the context menu of the modulation amount knob. More...
 
- Public Types inherited from SynthSlider
enum  MenuId {
  kCancel = 0 , kArmMidiLearn , kClearMidiLearn , kDefaultValue ,
  kManualEntry , kClearModulations , kModulationList
}
 Menu item IDs for the right-click popup menu. More...
 

Public Member Functions

 ModulationAmountKnob (String name, int index)
 Constructs a ModulationAmountKnob.
 
void mouseDown (const MouseEvent &e) override
 Mouse event overrides for custom behavior.
 
void mouseUp (const MouseEvent &e) override
 
void mouseExit (const MouseEvent &e) override
 
void handleModulationMenuCallback (int result)
 Handles a selection from the modulation context menu.
 
void makeVisible (bool visible)
 Toggles the knob's visibility smoothly or immediately.
 
void hideImmediately ()
 Hides the knob immediately without animations.
 
void setCurrentModulator (bool current)
 Marks this knob as representing the currently selected modulator.
 
void setDestinationComponent (Component *component, const std::string &name)
 Associates the knob with a destination component (slider or UI element).
 
Colour getInternalColor ()
 Returns the internal color for drawing this knob.
 
void setSource (const std::string &name)
 Sets the source parameter name for this modulation.
 
Colour withBypassSaturation (Colour color) const
 
virtual Colour getUnselectedColor () const override
 
virtual Colour getSelectedColor () const override
 
virtual Colour getThumbColor () const override
 
void setBypass (bool bypass)
 
void setStereo (bool stereo)
 
void setBipolar (bool bipolar)
 
bool isBypass ()
 
bool isStereo ()
 
bool isBipolar ()
 
bool enteringValue ()
 
bool isCurrentModulator ()
 
int index ()
 
void setAux (String name)
 Sets an auxiliary modulation name for this knob (for chained modulations).
 
bool hasAux ()
 Checks if this knob currently has an auxiliary modulation.
 
void removeAux ()
 Removes the auxiliary modulation connection.
 
String getOriginalName ()
 Gets the knob's original name before auxiliary assignment.
 
force_inline bool hovering () const
 Checks if the mouse is currently hovering over this knob.
 
void addModulationAmountListener (Listener *listener)
 Adds a listener interested in this knob's modulation events.
 
- Public Member Functions inherited from SynthSlider
 SynthSlider (String name)
 
virtual void mouseDrag (const MouseEvent &e) override
 
virtual void mouseEnter (const MouseEvent &e) override
 
virtual void mouseDoubleClick (const MouseEvent &e) override
 
virtual void mouseWheelMove (const MouseEvent &e, const MouseWheelDetails &wheel) override
 
virtual void focusLost (FocusChangeType cause) override
 
virtual void valueChanged () override
 Called when the slider value changes. Notifies GUIs.
 
String getRawTextFromValue (double value)
 
String getSliderTextFromValue (double value)
 
String getTextFromValue (double value) override
 
double getValueFromText (const String &text) override
 
double getAdjustedValue (double value)
 
double getValueFromAdjusted (double value)
 
void setValueFromAdjusted (double value)
 
virtual void parentHierarchyChanged () override
 Called when the parent hierarchy changes, updates references to synthesizer.
 
virtual double snapValue (double attemptedValue, DragMode dragMode) override
 
void textEditorTextChanged (TextEditor &) override
 TextEditor::Listener overrides for handling text entry.
 
void textEditorReturnKeyPressed (TextEditor &editor) override
 
void textEditorFocusLost (TextEditor &editor) override
 
void setSliderPositionFromText ()
 Sets the slider position from the current text in the text editor.
 
void showTextEntry ()
 Shows the text entry box for manual value entry.
 
virtual bool shouldShowPopup ()
 
virtual void drawShadow (Graphics &g)
 
void drawRotaryShadow (Graphics &g)
 
void snapToValue (bool snap, float value=0.0)
 
void setScalingType (vital::ValueDetails::ValueScale scaling_type)
 
vital::ValueDetails::ValueScale getScalingType () const
 
void setStringLookup (const std::string *lookup)
 
void setScrollEnabled (bool enabled)
 
const std::string * getStringLookup () const
 
void setUnits (const String &units)
 
String getUnits () const
 
String formatValue (float value)
 
void setDefaultRange ()
 Sets the default parameter range based on the parameter details.
 
void addSliderListener (SliderListener *listener)
 
void showPopup (bool primary)
 
void hidePopup (bool primary)
 
void setPopupPlacement (BubbleComponent::BubblePlacement placement)
 
void setModulationPlacement (BubbleComponent::BubblePlacement placement)
 
BubbleComponent::BubblePlacement getPopupPlacement ()
 
BubbleComponent::BubblePlacement getModulationPlacement ()
 
void notifyGuis ()
 Notifies GUI listeners of a value change.
 
void handlePopupResult (int result)
 
void setSensitivity (double sensitivity)
 
double getSensitivity ()
 
Rectangle< int > getModulationMeterBounds () const
 
bool hasModulationArea () const
 
Rectangle< int > getModulationArea () const
 
void setModulationArea (Rectangle< int > area)
 
bool isModulationBipolar () const
 
bool isModulationStereo () const
 
bool isModulationBypassed () const
 
void setTextHeightPercentage (float percentage)
 
float getTextHeightPercentage ()
 
float mouseHovering () const
 
std::vector< vital::ModulationConnection * > getConnections ()
 
void setMouseWheelMovement (double movement)
 
void setMaxDisplayCharacters (int characters)
 
void setMaxDecimalPlaces (int decimal_places)
 
void setTextEntrySizePercent (float width_percent, float height_percent)
 
void setTextEntryWidthPercent (float percent)
 
void setShiftIndexAmount (int shift_amount)
 
void setShowPopupOnHover (bool show)
 
void setPopupPrefix (String prefix)
 
void setPopupSuffix (const juce::String &suffix)
 
void setKnobSizeScale (float scale)
 
float getKnobSizeScale () const override
 
void useSuffix (bool use)
 
void setExtraModulationTarget (Component *component)
 
Component * getExtraModulationTarget ()
 
void setModulationBarRight (bool right)
 
bool isModulationBarRight ()
 
void setDisplayMultiply (float multiply)
 
void setDisplayExponentialBase (float base)
 
void overrideValue (Skin::ValueId value_id, float value)
 
float findValue (Skin::ValueId value_id) const override
 
void setAlternateDisplay (Skin::ValueId id, float value, vital::ValueDetails details)
 
vital::ValueDetailsgetDisplayDetails ()
 
OpenGlComponentgetTextEditorComponent ()
 
- Public Member Functions inherited from OpenGlSlider
 OpenGlSlider (String name)
 
virtual void resized () override
 Called when the component is resized. Updates colors and display values.
 
void parentHierarchyChanged () override
 Called when the parent hierarchy changes. Used for retrieving parent sections.
 
void paintToImage (bool paint)
 
bool isText () const
 
bool isTextOrCurve () const
 
bool isModulationKnob () const
 
bool isRotaryQuad () const
 
bool isHorizontalQuad () const
 
bool isVerticalQuad () const
 
OpenGlComponentgetImageComponent ()
 
OpenGlComponentgetQuadComponent ()
 
void setMaxArc (float arc)
 
void setModulationKnob ()
 Marks this slider as a modulation knob.
 
void setModulationAmount (float modulation)
 
float getModulationAmount () const
 
bool isBipolar () const
 
bool isActive () const
 
void setBipolar (bool bipolar=true)
 
void setActive (bool active=true)
 
virtual Colour getModColor () const
 
virtual Colour getBackgroundColor () const
 
int getLinearSliderWidth ()
 
void setSliderDisplayValues ()
 Sets the slider display values (positions, sizes) based on current style.
 
void redoImage (bool skip_image=false)
 
void setColors ()
 Updates internal colors based on the current skin and state.
 
void setAlpha (float alpha, bool reset=false)
 
void setDrawWhenNotVisible (bool draw)
 
SynthSectiongetSectionParent ()
 

Additional Inherited Members

- Static Public Attributes inherited from SynthSlider
static constexpr int kDefaultFormatLength = 5
 
static constexpr int kDefaultFormatDecimalPlaces = 5
 
static constexpr float kDefaultTextEntryWidthPercent = 0.9f
 
static constexpr float kDefaultTextEntryHeightPercent = 0.35f
 
static constexpr float kModulationSensitivity = 0.003f
 
static constexpr float kTextEntryHeightPercent = 0.6f
 
static constexpr float kSlowDragMultiplier = 0.1f
 
static constexpr float kDefaultSensitivity = 1.0f
 
static constexpr float kDefaultTextHeightPercentage = 0.7f
 
static constexpr float kDefaultRotaryDragLength = 200.0f
 
static constexpr float kRotaryModulationControlPercent = 0.26f
 
static constexpr float kLinearWidthPercent = 0.26f
 
static constexpr float kLinearHandlePercent = 1.2f
 
static constexpr float kLinearModulationPercent = 0.1f
 
- Static Public Attributes inherited from OpenGlSlider
static constexpr float kRotaryAngle = 0.8f * vital::kPi
 The default rotary arc angle used for rotary sliders.
 
- Protected Member Functions inherited from SynthSlider
PopupItems createPopupMenu ()
 
void setRotaryTextEntryBounds ()
 Sets bounds for text entry in rotary mode.
 
void setLinearTextEntryBounds ()
 Sets bounds for text entry in linear mode.
 
void notifyModulationAmountChanged ()
 Notifies listeners that modulation amount has changed.
 
void notifyModulationRemoved ()
 Notifies listeners that a modulation was removed.
 
void notifyModulationsChanged ()
 Notifies listeners that modulations changed.
 
- Protected Attributes inherited from SynthSlider
bool show_popup_on_hover_
 
String popup_prefix_
 
String popupSuffix_
 
bool scroll_enabled_
 
bool bipolar_modulation_
 
bool stereo_modulation_
 
bool bypass_modulation_
 
bool modulation_bar_right_
 
Rectangle< int > modulation_area_
 
bool sensitive_mode_
 
bool snap_to_value_
 
bool hovering_
 
bool has_parameter_assignment_
 
bool use_suffix_
 
float snap_value_
 
float text_height_percentage_
 
float knob_size_scale_
 
double sensitivity_
 
BubbleComponent::BubblePlacement popup_placement_
 
BubbleComponent::BubblePlacement modulation_control_placement_
 
int max_display_characters_
 
int max_decimal_places_
 
int shift_index_amount_
 
bool shift_is_multiplicative_
 
double mouse_wheel_index_movement_
 
float text_entry_width_percent_
 
float text_entry_height_percent_
 
std::map< Skin::ValueId, float > value_lookup_
 
Point< int > last_modulation_edit_position_
 
Point< int > mouse_down_position_
 
vital::ValueDetails details_
 
float display_multiply_
 
float display_exponential_base_
 
std::pair< Skin::ValueId, float > alternate_display_setting_
 
vital::ValueDetails alternate_details_
 
const std::string * string_lookup_
 
Component * extra_modulation_target_
 
SynthGuiInterfacesynth_interface_
 
std::unique_ptr< OpenGlTextEditortext_entry_
 
std::vector< SliderListener * > slider_listeners_
 
- Protected Attributes inherited from OpenGlSlider
SynthSectionparent_
 The parent SynthSection.
 

Detailed Description

A specialized SynthSlider that represents a single modulation amount control.

ModulationAmountKnob provides popup menus for removing, bypassing, and changing modulation parameters (bipolar, stereo). It can also represent auxiliary connections (chained modulation paths).

Member Enumeration Documentation

◆ MenuOptions

Options in the context menu of the modulation amount knob.

Enumerator
kDisconnect 

Removes the modulation connection.

kToggleBypass 

Toggles bypassing the modulation.

kToggleBipolar 

Toggles bipolar (positive and negative) modulation.

kToggleStereo 

Toggles stereo modulation mode.

Constructor & Destructor Documentation

◆ ModulationAmountKnob()

ModulationAmountKnob::ModulationAmountKnob ( String name,
int index )

Constructs a ModulationAmountKnob.

Parameters
nameThe name of the knob.
indexThe index identifying this modulation connection.

Member Function Documentation

◆ addModulationAmountListener()

void ModulationAmountKnob::addModulationAmountListener ( Listener * listener)
inline

Adds a listener interested in this knob's modulation events.

Parameters
listenerA pointer to a Listener.

◆ enteringValue()

bool ModulationAmountKnob::enteringValue ( )
inline

◆ getInternalColor()

Colour ModulationAmountKnob::getInternalColor ( )

Returns the internal color for drawing this knob.

Returns
A Colour object.

◆ getOriginalName()

String ModulationAmountKnob::getOriginalName ( )
inline

Gets the knob's original name before auxiliary assignment.

Returns
The original name as a String.

◆ getSelectedColor()

virtual Colour ModulationAmountKnob::getSelectedColor ( ) const
inlineoverridevirtual

Gets the color for the selected portion of the slider.

Returns
The selected color.

Reimplemented from OpenGlSlider.

◆ getThumbColor()

virtual Colour ModulationAmountKnob::getThumbColor ( ) const
inlineoverridevirtual

Gets the color for the thumb/handle.

Returns
The thumb color.

Reimplemented from OpenGlSlider.

◆ getUnselectedColor()

virtual Colour ModulationAmountKnob::getUnselectedColor ( ) const
inlineoverridevirtual

Gets the color for the unselected portion of the slider.

Returns
The unselected color.

Reimplemented from OpenGlSlider.

◆ handleModulationMenuCallback()

void ModulationAmountKnob::handleModulationMenuCallback ( int result)

Handles a selection from the modulation context menu.

Parameters
resultThe menu option chosen.

◆ hasAux()

bool ModulationAmountKnob::hasAux ( )
inline

Checks if this knob currently has an auxiliary modulation.

Returns
True if auxiliary modulation is active.

◆ hideImmediately()

void ModulationAmountKnob::hideImmediately ( )

Hides the knob immediately without animations.

◆ hovering()

force_inline bool ModulationAmountKnob::hovering ( ) const
inline

Checks if the mouse is currently hovering over this knob.

Returns
True if hovering.

◆ index()

int ModulationAmountKnob::index ( )
inline

◆ isBipolar()

bool ModulationAmountKnob::isBipolar ( )
inline

◆ isBypass()

bool ModulationAmountKnob::isBypass ( )
inline

◆ isCurrentModulator()

bool ModulationAmountKnob::isCurrentModulator ( )
inline

◆ isStereo()

bool ModulationAmountKnob::isStereo ( )
inline

◆ makeVisible()

void ModulationAmountKnob::makeVisible ( bool visible)

Toggles the knob's visibility smoothly or immediately.

Parameters
visibleTrue to show, false to hide.

◆ mouseDown()

void ModulationAmountKnob::mouseDown ( const MouseEvent & e)
overridevirtual

Mouse event overrides for custom behavior.

Reimplemented from SynthSlider.

◆ mouseExit()

void ModulationAmountKnob::mouseExit ( const MouseEvent & e)
overridevirtual

Reimplemented from SynthSlider.

◆ mouseUp()

void ModulationAmountKnob::mouseUp ( const MouseEvent & e)
overridevirtual

Reimplemented from SynthSlider.

◆ removeAux()

void ModulationAmountKnob::removeAux ( )
inline

Removes the auxiliary modulation connection.

◆ setAux()

void ModulationAmountKnob::setAux ( String name)
inline

Sets an auxiliary modulation name for this knob (for chained modulations).

Parameters
nameThe auxiliary modulation name.

◆ setBipolar()

void ModulationAmountKnob::setBipolar ( bool bipolar)
inline

◆ setBypass()

void ModulationAmountKnob::setBypass ( bool bypass)
inline

◆ setCurrentModulator()

void ModulationAmountKnob::setCurrentModulator ( bool current)

Marks this knob as representing the currently selected modulator.

Parameters
currentTrue if this knob is for the current modulator.

◆ setDestinationComponent()

void ModulationAmountKnob::setDestinationComponent ( Component * component,
const std::string & name )

Associates the knob with a destination component (slider or UI element).

Parameters
componentThe component representing the modulation destination.
nameThe destination parameter name.

◆ setSource()

void ModulationAmountKnob::setSource ( const std::string & name)

Sets the source parameter name for this modulation.

Parameters
nameThe source parameter name.

◆ setStereo()

void ModulationAmountKnob::setStereo ( bool stereo)
inline

◆ withBypassSaturation()

Colour ModulationAmountKnob::withBypassSaturation ( Colour color) const
inline

The documentation for this class was generated from the following files: