The ParameterAttachment is a class you can use to have a value synchronised with an AudioProcessorParameter. More...
Inherits Listener, and AsyncUpdater.
Public Member Functions | |
ParameterAttachment () | |
virtual | ~ParameterAttachment () override |
ValueType | getValue () const |
Thread safe way to read the current value. More... | |
ValueType | getNormalisedValue () const |
Thread safe way to read the normalised value of the current value. More... | |
void | setValue (ValueType newValue) |
Set the value from a not normalised range.min..range.max value. More... | |
void | setNormalisedValue (ValueType newValue) |
Set the value from a normalised 0..1 value. More... | |
void | attachToParameter (juce::RangedAudioParameter *parameterToUse) |
Make this value attached to the parameter with the supplied parameterID. More... | |
void | detachFromParameter () |
void | beginGesture () |
Make sure to call this before you send changes (e.g. More... | |
void | endGesture () |
Make sure to call this after finishing your changes (e.g. More... | |
void | parameterValueChanged (int parameterIndex, float newValue) override |
void | parameterGestureChanged (int parameterIndex, bool gestureIsStarting) override |
void | handleAsyncUpdate () override |
Public Attributes | |
std::function< void()> | onParameterChanged |
Set this lambda to be called from whatever thread is updating the parameter. More... | |
std::function< void()> | onParameterChangedAsync |
Set this lambda to be called from the message thread via AsyncUpdater. More... | |
The ParameterAttachment is a class you can use to have a value synchronised with an AudioProcessorParameter.
It takes care of updating either way, keeps the value thread safe in an atomic and allows setting lambdas to be executed when the value changes.
|
overridevirtual |
ValueType getValue | ( | ) | const |
Thread safe way to read the current value.
ValueType getNormalisedValue | ( | ) | const |
Thread safe way to read the normalised value of the current value.
void setValue | ( | ValueType | newValue | ) |
Set the value from a not normalised range.min..range.max value.
References ParameterAttachment< ValueType >::parameterValueChanged().
void setNormalisedValue | ( | ValueType | newValue | ) |
Set the value from a normalised 0..1 value.
References ParameterAttachment< ValueType >::parameterValueChanged().
Referenced by XYDragComponent::mouseDrag().
void attachToParameter | ( | juce::RangedAudioParameter * | parameterToUse | ) |
Make this value attached to the parameter with the supplied parameterID.
References ParameterAttachment< ValueType >::detachFromParameter().
void detachFromParameter | ( | ) |
void beginGesture | ( | ) |
Make sure to call this before you send changes (e.g.
from mouseDown of your UI widget), otherwise the hosts automation will battle with your value changes.
void endGesture | ( | ) |
Make sure to call this after finishing your changes (e.g.
from mouseDown of your UI widget), this way the automation can take back control (like e.g. latch mode).
Referenced by XYDragComponent::mouseUp().
|
override |
|
override |
|
override |
std::function<void()> onParameterChanged |
Set this lambda to be called from whatever thread is updating the parameter.
Referenced by ParameterAttachment< ValueType >::parameterValueChanged().
std::function<void()> onParameterChangedAsync |
Set this lambda to be called from the message thread via AsyncUpdater.
Referenced by ParameterAttachment< ValueType >::handleAsyncUpdate(), ParameterAttachment< ValueType >::parameterValueChanged(), and XYDragComponent::XYDragComponent().