TracktionEngine
Loading...
Searching...
No Matches
engine::AutomatableParameter Class Reference

#include <tracktion_AutomatableParameter.h>

Inheritance diagram for engine::AutomatableParameter:

Classes

struct  ModifierSource
 Base class for things that can be used to modify parameters. More...
struct  ModifierAssignment
 Connects a modifier source to an AutomatableParameter. More...
struct  Listener
struct  ScopedActiveParameter

Public Types

using Ptr = juce::ReferenceCountedObjectPtr<AutomatableParameter>
using Array = juce::ReferenceCountedArray<AutomatableParameter>
Public Types inherited from engine::Selectable
using WeakRef = juce::WeakReference<Selectable>

Public Member Functions

 AutomatableParameter (const juce::String &paramID, const juce::String &name, AutomatableEditItem &, juce::NormalisableRange< float > valueRange)
 ~AutomatableParameter () override
juce::Range< float > getValueRange () const
Plugin * getPlugin () const
Engine & getEngine () const noexcept
Edit & getEdit () const noexcept
Track * getTrack () const noexcept
AutomationCurve & getCurve () const noexcept
void attachToCurrentValue (juce::CachedValue< float > &)
void attachToCurrentValue (juce::CachedValue< int > &)
void attachToCurrentValue (juce::CachedValue< bool > &)
void updateFromAttachedValue ()
void detachFromCurrentValue ()
virtual juce::String getParameterName () const
virtual juce::String getParameterShortName (int) const
virtual juce::String getLabel ()
virtual juce::String getPluginAndParamName () const
virtual juce::String getFullName () const
Selectable * getOwnerSelectable () const
 Returns the thing that you'd select if you wanted to show this param.
EditItemID getOwnerID () const
 Returns the thing that you'd select if you wanted to show this param.
float getCurrentValue () const noexcept
float getCurrentNormalisedValue () const noexcept
virtual juce::String valueToString (float value)
virtual float stringToValue (const juce::String &s)
virtual juce::String getCurrentValueAsString ()
juce::String getCurrentValueAsStringWithLabel ()
void setParameter (float value, juce::NotificationType)
void setNormalisedParameter (float value, juce::NotificationType)
void updateToFollowCurve (TimePosition)
void parameterChangeGestureBegin ()
 Call to indicate this parameter is about to be changed.
void parameterChangeGestureEnd ()
 Call to indicate this parameter has stopped being to be changed.
bool hasAutomationPoints () const noexcept
ModifierAssignment::Ptr addModifier (ModifierSource &, float value=1.0f, float offset=0.0f, float curve=0.5f)
 Creates an assignment for a given source.
bool removeModifier (ModifierAssignment &)
 Removes an assignment.
bool removeModifier (ModifierSource &)
 Removes assignments for a ModifierSource.
bool hasActiveModifierAssignments () const
 Returns true if any ModifierSources are currently in use by assignments.
juce::ReferenceCountedArray< ModifierAssignment > getAssignments () const
 Returns all the current ModifierAssignments.
juce::Array< ModifierSource * > getModifiers () const
 Returns all the current ModifierSources currently in use by assignments.
float getCurrentExplicitValue () const
 This is the value that has been set explicity, either by calling setParameter or the plugin telling us one if its parameters has changed.
float getCurrentBaseValue () const
 This is the current base value of the parameter i.e.
float getCurrentModifierValue () const
 This is the ammount of the modifier that has been applied to the base value to give the current parameter value.
bool isAutomationActive () const
 Returns true if the parameter is being dynamically changed somehow, either through automation or a ModifierAssignment.
void updateStream ()
 Forces the parameter to update its automation stream for reading automation.
void updateFromAutomationSources (TimePosition)
 Updates the parameter and modifier values from its current automation sources.
virtual bool isParameterActive () const
virtual bool isDiscrete () const
virtual int getNumberOfStates () const
virtual float getValueForState (int) const
virtual int getStateForValue (float) const
virtual std::optional< float > getDefaultValue () const
virtual bool hasLabels () const
virtual juce::String getLabelForValue (float) const
virtual float snapToState (float val) const
virtual juce::StringArray getAllLabels () const
bool isCurrentlyRecording () const
 true if the parameter been moved while in an automation record mode.
void midiControllerMoved (float newPosition)
void midiControllerPressed ()
void curveHasChanged ()
juce::String getSelectableDescription () override
 Subclasses must return a description of what they are.
void addListener (Listener *l)
void removeListener (Listener *l)
void automationCurveModifierCreated (EditItemID automationCurveModifierID)
void resetRecordingStatus ()
void startRecordingStatus ()
Public Member Functions inherited from engine::Selectable
 Selectable ()
virtual ~Selectable ()
virtual void selectionStatusChanged (bool isNowSelected)
 Can be overridden to tell this object that it has just been selected or deselected.
virtual void changed ()
 This should be called to send a change notification to any SelectableListeners that are registered with this object.
virtual void selectableAboutToBeDeleted ()
 Called just before the selectable is about to be deleted so any subclasses should still be valid at this point.
void addListener (SelectableListener *)
void removeListener (SelectableListener *)
void addSelectableListener (SelectableListener *)
void removeSelectableListener (SelectableListener *)
void cancelAnyPendingUpdates ()
 If changed() has been called, this will cancel any pending async change notificaions.
void deselect ()
void propertiesChanged ()
void notifyListenersOfDeletion ()
WeakRef getWeakRef ()

Public Attributes

const juce::String paramID
const juce::NormalisableRange< float > valueRange
AutomatableEditItem & automatableEditElement
std::function< juce::String(float)> valueToStringFunction
std::function< float(const juce::String &)> stringToValueFunction
const juce::String paramName
juce::ValueTree parentState
Public Attributes inherited from engine::Selectable
WeakRef::Master masterReference

Protected Member Functions

AutomationSourceList & getAutomationSourceList () const
void setParameterValue (float value, bool isFollowingCurve)
void valueTreePropertyChanged (juce::ValueTree &, const juce::Identifier &) override
void valueTreeChildAdded (juce::ValueTree &, juce::ValueTree &) override
void valueTreeChildRemoved (juce::ValueTree &, juce::ValueTree &, int) override
void valueTreeChildOrderChanged (juce::ValueTree &, int, int) override
void valueTreeParentChanged (juce::ValueTree &) override
void valueTreeRedirected (juce::ValueTree &) override
virtual void parameterChanged (float, bool)

Protected Attributes

std::unique_ptr< AttachedValue > attachedValue
juce::ListenerList< Listener > listeners
SafeSelectable< Edit > editRef
Plugin * plugin = nullptr
Modifier * modifierOwner = nullptr
MacroParameterList * macroOwner = nullptr
std::unique_ptr< AutomationCurveSource > curveSource
std::atomic< float > currentValue { 0.0f }
std::atomic< float > currentParameterValue { 0.0f }
std::atomic< float > currentBaseValue { 0.0f }
std::atomic< float > currentModifierValue { 0.0f }
std::atomic< int > numActiveAutomationSources { 0 }
std::atomic< bool > isRecording { false }
bool updateParametersRecursionCheck = false
AsyncCaller parameterChangedCaller { [this] { listeners.call (&Listener::currentValueChanged, *this); } }
int gestureCount = 0
juce::ValueTree modifiersState
std::unique_ptr< AutomationSourceList > automationSourceList

Additional Inherited Members

Static Public Member Functions inherited from engine::Selectable
static void initialise ()
static bool isSelectableValid (const Selectable *) noexcept
 checks whether this object has been deleted.

Member Typedef Documentation

◆ Ptr

using engine::AutomatableParameter::Ptr = juce::ReferenceCountedObjectPtr<AutomatableParameter>

◆ Array

using engine::AutomatableParameter::Array = juce::ReferenceCountedArray<AutomatableParameter>

Constructor & Destructor Documentation

◆ AutomatableParameter()

◆ ~AutomatableParameter()

engine::AutomatableParameter::~AutomatableParameter ( )
override

Member Function Documentation

◆ getValueRange()

juce::Range< float > engine::AutomatableParameter::getValueRange ( ) const

References valueRange.

◆ getPlugin()

Plugin * engine::AutomatableParameter::getPlugin ( ) const

References plugin.

◆ getEngine()

Engine & engine::AutomatableParameter::getEngine ( ) const
noexcept

◆ getEdit()

Edit & engine::AutomatableParameter::getEdit ( ) const
noexcept

◆ getTrack()

Track * engine::AutomatableParameter::getTrack ( ) const
noexcept

References getTrack().

Referenced by getTrack().

◆ getCurve()

AutomationCurve & engine::AutomatableParameter::getCurve ( ) const
noexcept

References getCurve().

Referenced by getCurve(), and hasAutomationPoints().

◆ attachToCurrentValue() [1/3]

void engine::AutomatableParameter::attachToCurrentValue ( juce::CachedValue< float > & )

◆ attachToCurrentValue() [2/3]

void engine::AutomatableParameter::attachToCurrentValue ( juce::CachedValue< int > & )

◆ attachToCurrentValue() [3/3]

void engine::AutomatableParameter::attachToCurrentValue ( juce::CachedValue< bool > & )

◆ updateFromAttachedValue()

void engine::AutomatableParameter::updateFromAttachedValue ( )

◆ detachFromCurrentValue()

void engine::AutomatableParameter::detachFromCurrentValue ( )

◆ getParameterName()

virtual juce::String engine::AutomatableParameter::getParameterName ( ) const
virtual

◆ getParameterShortName()

virtual juce::String engine::AutomatableParameter::getParameterShortName ( int ) const
virtual

Reimplemented in engine::ExternalAutomatableParameter.

References paramName.

◆ getLabel()

virtual juce::String engine::AutomatableParameter::getLabel ( )
virtual

◆ getPluginAndParamName()

virtual juce::String engine::AutomatableParameter::getPluginAndParamName ( ) const
virtual

◆ getFullName()

virtual juce::String engine::AutomatableParameter::getFullName ( ) const
virtual

◆ getOwnerSelectable()

Selectable * engine::AutomatableParameter::getOwnerSelectable ( ) const

Returns the thing that you'd select if you wanted to show this param.

References engine::Selectable::Selectable().

◆ getOwnerID()

EditItemID engine::AutomatableParameter::getOwnerID ( ) const

Returns the thing that you'd select if you wanted to show this param.

◆ getCurrentValue()

float engine::AutomatableParameter::getCurrentValue ( ) const
noexcept

◆ getCurrentNormalisedValue()

float engine::AutomatableParameter::getCurrentNormalisedValue ( ) const
noexcept

References currentValue, and valueRange.

◆ valueToString()

virtual juce::String engine::AutomatableParameter::valueToString ( float value)
virtual

◆ stringToValue()

virtual float engine::AutomatableParameter::stringToValue ( const juce::String & s)
virtual

◆ getCurrentValueAsString()

virtual juce::String engine::AutomatableParameter::getCurrentValueAsString ( )
virtual

◆ getCurrentValueAsStringWithLabel()

juce::String engine::AutomatableParameter::getCurrentValueAsStringWithLabel ( )

◆ setParameter()

void engine::AutomatableParameter::setParameter ( float value,
juce::NotificationType  )

◆ setNormalisedParameter()

void engine::AutomatableParameter::setNormalisedParameter ( float value,
juce::NotificationType  )

◆ updateToFollowCurve()

void engine::AutomatableParameter::updateToFollowCurve ( TimePosition )

◆ parameterChangeGestureBegin()

void engine::AutomatableParameter::parameterChangeGestureBegin ( )

Call to indicate this parameter is about to be changed.

◆ parameterChangeGestureEnd()

void engine::AutomatableParameter::parameterChangeGestureEnd ( )

Call to indicate this parameter has stopped being to be changed.

◆ hasAutomationPoints()

bool engine::AutomatableParameter::hasAutomationPoints ( ) const
noexcept

References getCurve().

◆ addModifier()

ModifierAssignment::Ptr engine::AutomatableParameter::addModifier ( ModifierSource & ,
float value = 1.0f,
float offset = 0.0f,
float curve = 0.5f )

Creates an assignment for a given source.

Parameters
valuethe value of the assignment 0 - 1
offsetthe offset of the assignment 0 - 1
curvethe curve of the assignment 0 - 1 where 0.5 is a linear mapping

◆ removeModifier() [1/2]

bool engine::AutomatableParameter::removeModifier ( ModifierAssignment & )

Removes an assignment.

N.B. the passed in assignment is likely to be deleted after this call.

Returns
true if the ModifierAssignment was removed

◆ removeModifier() [2/2]

bool engine::AutomatableParameter::removeModifier ( ModifierSource & )

Removes assignments for a ModifierSource.

Returns
true if the ModifierSource was removed

◆ hasActiveModifierAssignments()

bool engine::AutomatableParameter::hasActiveModifierAssignments ( ) const

Returns true if any ModifierSources are currently in use by assignments.

◆ getAssignments()

juce::ReferenceCountedArray< ModifierAssignment > engine::AutomatableParameter::getAssignments ( ) const

Returns all the current ModifierAssignments.

Referenced by engine::getAssignmentsForSource(), and engine::getAssignmentsOfType().

◆ getModifiers()

juce::Array< ModifierSource * > engine::AutomatableParameter::getModifiers ( ) const

Returns all the current ModifierSources currently in use by assignments.

Referenced by engine::getModifiersOfType().

◆ getCurrentExplicitValue()

float engine::AutomatableParameter::getCurrentExplicitValue ( ) const

This is the value that has been set explicity, either by calling setParameter or the plugin telling us one if its parameters has changed.

References currentParameterValue.

◆ getCurrentBaseValue()

float engine::AutomatableParameter::getCurrentBaseValue ( ) const

This is the current base value of the parameter i.e.

either the explicit value or the automation curve value.

References currentBaseValue.

◆ getCurrentModifierValue()

float engine::AutomatableParameter::getCurrentModifierValue ( ) const

This is the ammount of the modifier that has been applied to the base value to give the current parameter value.

References currentModifierValue.

◆ isAutomationActive()

bool engine::AutomatableParameter::isAutomationActive ( ) const

Returns true if the parameter is being dynamically changed somehow, either through automation or a ModifierAssignment.

◆ updateStream()

void engine::AutomatableParameter::updateStream ( )

Forces the parameter to update its automation stream for reading automation.

◆ updateFromAutomationSources()

void engine::AutomatableParameter::updateFromAutomationSources ( TimePosition )

Updates the parameter and modifier values from its current automation sources.

◆ isParameterActive()

virtual bool engine::AutomatableParameter::isParameterActive ( ) const
virtual

◆ isDiscrete()

virtual bool engine::AutomatableParameter::isDiscrete ( ) const
virtual

◆ getNumberOfStates()

virtual int engine::AutomatableParameter::getNumberOfStates ( ) const
virtual

◆ getValueForState()

virtual float engine::AutomatableParameter::getValueForState ( int ) const
virtual

◆ getStateForValue()

virtual int engine::AutomatableParameter::getStateForValue ( float ) const
virtual

◆ getDefaultValue()

virtual std::optional< float > engine::AutomatableParameter::getDefaultValue ( ) const
virtual

◆ hasLabels()

virtual bool engine::AutomatableParameter::hasLabels ( ) const
virtual

◆ getLabelForValue()

virtual juce::String engine::AutomatableParameter::getLabelForValue ( float ) const
virtual

◆ snapToState()

virtual float engine::AutomatableParameter::snapToState ( float val) const
virtual

◆ getAllLabels()

virtual juce::StringArray engine::AutomatableParameter::getAllLabels ( ) const
virtual

◆ isCurrentlyRecording()

bool engine::AutomatableParameter::isCurrentlyRecording ( ) const

true if the parameter been moved while in an automation record mode.

References isRecording.

◆ midiControllerMoved()

void engine::AutomatableParameter::midiControllerMoved ( float newPosition)

◆ midiControllerPressed()

void engine::AutomatableParameter::midiControllerPressed ( )

◆ curveHasChanged()

void engine::AutomatableParameter::curveHasChanged ( )

◆ getSelectableDescription()

juce::String engine::AutomatableParameter::getSelectableDescription ( )
overridevirtual

Subclasses must return a description of what they are.

Implements engine::Selectable.

◆ addListener()

void engine::AutomatableParameter::addListener ( Listener * l)

References listeners.

◆ removeListener()

void engine::AutomatableParameter::removeListener ( Listener * l)

References listeners.

◆ automationCurveModifierCreated()

void engine::AutomatableParameter::automationCurveModifierCreated ( EditItemID automationCurveModifierID)

Connects an AutomationCurveModifier's assignment that was added before the modifier was created, e.g. by a redo that re-adds them in that order.

◆ resetRecordingStatus()

void engine::AutomatableParameter::resetRecordingStatus ( )

◆ startRecordingStatus()

void engine::AutomatableParameter::startRecordingStatus ( )

◆ getAutomationSourceList()

AutomationSourceList & engine::AutomatableParameter::getAutomationSourceList ( ) const
protected

◆ setParameterValue()

void engine::AutomatableParameter::setParameterValue ( float value,
bool isFollowingCurve )
protected

◆ valueTreePropertyChanged()

void engine::AutomatableParameter::valueTreePropertyChanged ( juce::ValueTree & ,
const juce::Identifier &  )
overrideprotected

◆ valueTreeChildAdded()

void engine::AutomatableParameter::valueTreeChildAdded ( juce::ValueTree & ,
juce::ValueTree &  )
overrideprotected

◆ valueTreeChildRemoved()

void engine::AutomatableParameter::valueTreeChildRemoved ( juce::ValueTree & ,
juce::ValueTree & ,
int  )
overrideprotected

◆ valueTreeChildOrderChanged()

void engine::AutomatableParameter::valueTreeChildOrderChanged ( juce::ValueTree & ,
int ,
int  )
overrideprotected

◆ valueTreeParentChanged()

void engine::AutomatableParameter::valueTreeParentChanged ( juce::ValueTree & )
overrideprotected

◆ valueTreeRedirected()

void engine::AutomatableParameter::valueTreeRedirected ( juce::ValueTree & )
overrideprotected

◆ parameterChanged()

virtual void engine::AutomatableParameter::parameterChanged ( float ,
bool  )
protectedvirtual

Member Data Documentation

◆ paramID

const juce::String engine::AutomatableParameter::paramID

Referenced by AutomatableParameter().

◆ valueRange

◆ automatableEditElement

AutomatableEditItem& engine::AutomatableParameter::automatableEditElement

◆ valueToStringFunction

std::function<juce::String(float)> engine::AutomatableParameter::valueToStringFunction

Referenced by valueToString().

◆ stringToValueFunction

std::function<float(const juce::String&)> engine::AutomatableParameter::stringToValueFunction

◆ paramName

const juce::String engine::AutomatableParameter::paramName

◆ parentState

juce::ValueTree engine::AutomatableParameter::parentState

◆ attachedValue

std::unique_ptr<AttachedValue> engine::AutomatableParameter::attachedValue
protected

◆ listeners

juce::ListenerList<Listener> engine::AutomatableParameter::listeners
protected

◆ editRef

SafeSelectable<Edit> engine::AutomatableParameter::editRef
protected

◆ plugin

Plugin* engine::AutomatableParameter::plugin = nullptr
protected

Referenced by getPlugin().

◆ modifierOwner

Modifier* engine::AutomatableParameter::modifierOwner = nullptr
protected

◆ macroOwner

MacroParameterList* engine::AutomatableParameter::macroOwner = nullptr
protected

◆ curveSource

std::unique_ptr<AutomationCurveSource> engine::AutomatableParameter::curveSource
protected

◆ currentValue

std::atomic<float> engine::AutomatableParameter::currentValue { 0.0f }
protected

◆ currentParameterValue

std::atomic<float> engine::AutomatableParameter::currentParameterValue { 0.0f }
protected

◆ currentBaseValue

std::atomic<float> engine::AutomatableParameter::currentBaseValue { 0.0f }
protected

Referenced by getCurrentBaseValue().

◆ currentModifierValue

std::atomic<float> engine::AutomatableParameter::currentModifierValue { 0.0f }
protected

Referenced by getCurrentModifierValue().

◆ numActiveAutomationSources

std::atomic<int> engine::AutomatableParameter::numActiveAutomationSources { 0 }
mutableprotected

◆ isRecording

std::atomic<bool> engine::AutomatableParameter::isRecording { false }
protected

Referenced by isCurrentlyRecording().

◆ updateParametersRecursionCheck

bool engine::AutomatableParameter::updateParametersRecursionCheck = false
protected

◆ parameterChangedCaller

AsyncCaller engine::AutomatableParameter::parameterChangedCaller { [this] { listeners.call (&Listener::currentValueChanged, *this); } }
protected

◆ gestureCount

int engine::AutomatableParameter::gestureCount = 0
protected

◆ modifiersState

juce::ValueTree engine::AutomatableParameter::modifiersState
protected

◆ automationSourceList

std::unique_ptr<AutomationSourceList> engine::AutomatableParameter::automationSourceList
mutableprotected

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