|
Gin
|
Advanced parameter class with modulation, real-time callbacks, and host automation. More...
#include <gin_parameter.h>
Classes | |
| class | ParameterListener |
| struct | ParamState |
Public Types | |
| using | Ptr = Parameter* |
| using | ConversionFunction = std::function<std::variant<float, juce::String> (const Parameter&, const std::variant<float, juce::String>&)> |
| Bidirectional user value <-> text conversion. | |
Public Member Functions | |
| Parameter (Processor &, juce::String uid, juce::String name, juce::String shortName, juce::String label, float minValue, float maxValue, float intervalValue, float defaultValue, float skewFactor=1.0f, ConversionFunction conversionFunction=nullptr) | |
| Parameter (Processor &, juce::String uid, juce::String name, juce::String shortName, juce::String label, juce::NormalisableRange< float > range, float defaultValue, ConversionFunction conversionFunction=nullptr) | |
| juce::String | getUid () const |
| void | setInternal (bool i) |
| bool | isInternal () const |
| void | setModIndex (int i) |
| int | getModIndex () const |
| void | setModMatrix (IModMatrix *m) |
| IModMatrix * | getModMatrix () const |
| void | setMidiLearn (MidiLearn *m) |
| MidiLearn * | getMidiLearn () const |
| virtual void | prepareToPlay (double, int) |
| virtual void | reset () |
| float | getProcValue () |
| virtual float | getProcValue (int) |
| float | getUserValue () const |
| int | getUserValueInt () const |
| bool | getUserValueBool () const |
| float | getUserDefaultValue () const |
| virtual void | setUserValue (float v) |
| virtual void | setUserValueNotifingHost (float f) |
| void | setUserValueAsUserAction (float f) |
| juce::String | getUserValueText () const |
| juce::String | userValueToText (float val) |
| bool | isOnOff () |
| bool | isOn () |
| virtual bool | isSmoothingActive () |
| void | beginUserAction () |
| void | beginUserTimedAction () |
| void | endUserAction () |
| juce::NormalisableRange< float > | getUserRange () const |
| float | getUserRangeStart () const |
| float | getUserRangeEnd () const |
| void | addListener (ParameterListener *listener) |
| void | removeListener (ParameterListener *listener) |
| ParamState | getState () |
| void | setState (const ParamState &state) |
| juce::String | getParameterID () const override |
| float | getValue () const override |
| bool | getBoolValue () const |
| void | setValue (float newValue) override |
| float | getDefaultValue () const override |
| juce::String | getName (int maximumStringLength) const override |
| juce::String | getShortName () const |
| juce::String | getLabel () const override |
| int | getNumSteps () const override |
| juce::String | getText (float value, int) const override |
| float | getValueForText (const juce::String &text) const override |
| bool | isOrientationInverted () const override |
| bool | isAutomatable () const override |
| bool | isMetaParameter () const override |
| float | getSkew () |
| bool | isSkewSymmetric () |
| Public Member Functions inherited from RealtimeAsyncUpdater | |
| RealtimeAsyncUpdater () | |
| Creates a RealtimeAsyncUpdater. | |
| virtual | ~RealtimeAsyncUpdater () |
| Destructor. | |
| void | triggerAsyncUpdate () |
| Triggers an asynchronous update. | |
| void | cancelPendingUpdate () noexcept |
| Cancels any pending update. | |
| void | handleUpdateNowIfNeeded () |
| Handles the update immediately if one is pending. | |
| bool | isUpdatePending () const noexcept |
| Checks if an update is currently pending. | |
Public Attributes | |
| std::function< float(float)> | conversionFunction |
Protected Member Functions | |
| void | handleAsyncUpdate () override |
| Called asynchronously when an update is triggered. | |
| void | timerCallback () override |
| virtual void | changed () |
Protected Attributes | |
| Processor & | processor |
| const juce::NormalisableRange< float > | range |
| bool | internal = false |
| IModMatrix * | modMatrix = nullptr |
| MidiLearn * | midiLearn = nullptr |
| int | modIndex = -1 |
| std::atomic< float > | value {0.0f} |
| const float | defaultValue = 0.0f |
| const juce::String | uid |
| const juce::String | name |
| const juce::String | shortName |
| const juce::String | label |
| const ConversionFunction | textConversionFunction |
| int | userActionCount = 0 |
| juce::ListenerList< ParameterListener > | listeners |
Advanced parameter class with modulation, real-time callbacks, and host automation.
Parameter provides a comprehensive plugin parameter implementation with features needed for professional audio plugins. It extends JUCE's parameter system with modulation support, user/processing value separation, and real-time safe callbacks.
Value Formats: Parameter values are represented in three formats:
By default, user value and proc value are identical. To provide custom processing values, set the conversionFunction (e.g., converting dB to linear gain).
Parameter Types:
Key Features:
Usage:
| using Parameter::Ptr = Parameter* |
| using Parameter::ConversionFunction = std::function<std::variant<float, juce::String> (const Parameter&, const std::variant<float, juce::String>&)> |
Bidirectional user value <-> text conversion.
Called with a float it returns the display text for that user value; called with a juce::String it returns the user value for that text.
| Parameter::Parameter | ( | Processor & | , |
| juce::String | uid, | ||
| juce::String | name, | ||
| juce::String | shortName, | ||
| juce::String | label, | ||
| float | minValue, | ||
| float | maxValue, | ||
| float | intervalValue, | ||
| float | defaultValue, | ||
| float | skewFactor = 1.0f, | ||
| ConversionFunction | conversionFunction = nullptr ) |
References conversionFunction, defaultValue, label, name, shortName, and uid.
Referenced by Parameter::ParameterListener::valueUpdated().
| Parameter::Parameter | ( | Processor & | , |
| juce::String | uid, | ||
| juce::String | name, | ||
| juce::String | shortName, | ||
| juce::String | label, | ||
| juce::NormalisableRange< float > | range, | ||
| float | defaultValue, | ||
| ConversionFunction | conversionFunction = nullptr ) |
References conversionFunction, defaultValue, label, name, range, shortName, and uid.
| juce::String Parameter::getUid | ( | ) | const |
References uid.
| void Parameter::setInternal | ( | bool | i | ) |
References internal.
| bool Parameter::isInternal | ( | ) | const |
References internal.
| void Parameter::setModIndex | ( | int | i | ) |
References modIndex.
| int Parameter::getModIndex | ( | ) | const |
References modIndex.
| void Parameter::setModMatrix | ( | IModMatrix * | m | ) |
References modMatrix.
| IModMatrix * Parameter::getModMatrix | ( | ) | const |
References modMatrix.
|
virtual |
|
virtual |
| float Parameter::getProcValue | ( | ) |
References conversionFunction, and getUserValue().
|
virtual |
References conversionFunction, and getUserValue().
| float Parameter::getUserValue | ( | ) | const |
Referenced by getProcValue(), getProcValue(), and isOn().
| float Parameter::getUserDefaultValue | ( | ) | const |
References defaultValue.
|
virtual |
|
virtual |
| void Parameter::setUserValueAsUserAction | ( | float | f | ) |
| juce::String Parameter::getUserValueText | ( | ) | const |
References getText(), getValue(), and label.
| bool Parameter::isOnOff | ( | ) |
References range.
| bool Parameter::isOn | ( | ) |
References getUserValue(), and range.
|
virtual |
| void Parameter::beginUserAction | ( | ) |
| void Parameter::beginUserTimedAction | ( | ) |
| void Parameter::endUserAction | ( | ) |
| juce::NormalisableRange< float > Parameter::getUserRange | ( | ) | const |
References range.
| float Parameter::getUserRangeStart | ( | ) | const |
References range.
| float Parameter::getUserRangeEnd | ( | ) | const |
References range.
| void Parameter::addListener | ( | ParameterListener * | listener | ) |
Referenced by MultiParamComponent::watchParam().
| void Parameter::removeListener | ( | ParameterListener * | listener | ) |
Referenced by MultiParamComponent::unwatchParam().
| ParamState Parameter::getState | ( | ) |
| void Parameter::setState | ( | const ParamState & | state | ) |
|
override |
References uid.
|
override |
Referenced by getBoolValue(), and getUserValueText().
| bool Parameter::getBoolValue | ( | ) | const |
References getValue().
|
override |
|
override |
References defaultValue, and range.
|
override |
| juce::String Parameter::getShortName | ( | ) | const |
References shortName.
|
override |
References label.
|
override |
|
override |
References value.
Referenced by getUserValueText(), and userValueToText().
|
override |
|
override |
|
override |
|
override |
| float Parameter::getSkew | ( | ) |
References range.
| bool Parameter::isSkewSymmetric | ( | ) |
References range.
|
overrideprotectedvirtual |
Called asynchronously when an update is triggered.
Override this method to perform your update logic. This will be called on a dedicated background thread (not the message thread).
Implements RealtimeAsyncUpdater.
|
overrideprotected |
|
protectedvirtual |
| std::function<float (float)> Parameter::conversionFunction |
Referenced by getProcValue(), getProcValue(), Parameter(), and Parameter().
|
protected |
|
protected |
|
protected |
Referenced by isInternal(), and setInternal().
|
protected |
Referenced by getModMatrix(), and setModMatrix().
|
protected |
Referenced by getMidiLearn(), and setMidiLearn().
|
protected |
Referenced by getModIndex(), and setModIndex().
|
protected |
Referenced by getText(), getUserValue(), getUserValueBool(), getUserValueInt(), and getValue().
|
protected |
Referenced by getDefaultValue(), getUserDefaultValue(), Parameter(), and Parameter().
|
protected |
Referenced by getParameterID(), getUid(), Parameter(), and Parameter().
|
protected |
Referenced by Parameter(), and Parameter().
|
protected |
Referenced by getShortName(), Parameter(), and Parameter().
|
protected |
Referenced by getLabel(), getUserValueText(), Parameter(), Parameter(), and userValueToText().
|
protected |
|
protected |
|
protected |