TracktionEngine
Loading...
Searching...
No Matches
engine::ParameterWithStateValue Struct Reference

A helper class that creates an AutomatableParameter and links it to a CachedValue, to make it easier to create and manage parameters whose values are stored as a property in a plugin's ValueTree state. More...

#include <tracktion_ParameterHelpers.h>

Public Member Functions

 ParameterWithStateValue ()=default
 ParameterWithStateValue (Plugin &, const juce::String &paramID, const juce::Identifier &propertyName, const juce::String &description, float defaultValue, juce::NormalisableRange< float > valueRange, std::function< juce::String(float)> valueToStringFunction={}, std::function< float(const juce::String &)> stringToValueFunction={})
 ~ParameterWithStateValue ()
 ParameterWithStateValue (ParameterWithStateValue &&)=default
ParameterWithStateValue & operator= (ParameterWithStateValue &&)=default
AutomatableParameter & getParameter ()
juce::CachedValue< float > & getCachedValue ()
float getCurrentValue () const
 Returns the current value from the AutomatableParameter.
void setParameter (float newValue, juce::NotificationType)
 Sets a new value via the AutomatableParameter.
void reset ()
 Releases the parameter and CachedValue.
void setFromValueTree (const juce::ValueTree &)
 Copies the matching property from the given ValueTree to this parameter.

Public Attributes

AutomatableParameter::Ptr parameter
std::unique_ptr< juce::CachedValue< float > > value

Detailed Description

A helper class that creates an AutomatableParameter and links it to a CachedValue, to make it easier to create and manage parameters whose values are stored as a property in a plugin's ValueTree state.

Constructor & Destructor Documentation

◆ ParameterWithStateValue() [1/3]

engine::ParameterWithStateValue::ParameterWithStateValue ( )
default

◆ ParameterWithStateValue() [2/3]

engine::ParameterWithStateValue::ParameterWithStateValue ( Plugin & ,
const juce::String & paramID,
const juce::Identifier & propertyName,
const juce::String & description,
float defaultValue,
juce::NormalisableRange< float > valueRange,
std::function< juce::String(float)> valueToStringFunction = {},
std::function< float(const juce::String &)> stringToValueFunction = {} )

◆ ~ParameterWithStateValue()

engine::ParameterWithStateValue::~ParameterWithStateValue ( )

◆ ParameterWithStateValue() [3/3]

engine::ParameterWithStateValue::ParameterWithStateValue ( ParameterWithStateValue && )
default

Member Function Documentation

◆ operator=()

ParameterWithStateValue & engine::ParameterWithStateValue::operator= ( ParameterWithStateValue && )
default

◆ getParameter()

AutomatableParameter & engine::ParameterWithStateValue::getParameter ( )

References parameter.

◆ getCachedValue()

juce::CachedValue< float > & engine::ParameterWithStateValue::getCachedValue ( )

References value.

◆ getCurrentValue()

float engine::ParameterWithStateValue::getCurrentValue ( ) const

Returns the current value from the AutomatableParameter.

References parameter.

◆ setParameter()

void engine::ParameterWithStateValue::setParameter ( float newValue,
juce::NotificationType  )

Sets a new value via the AutomatableParameter.

◆ reset()

void engine::ParameterWithStateValue::reset ( )

Releases the parameter and CachedValue.

◆ setFromValueTree()

void engine::ParameterWithStateValue::setFromValueTree ( const juce::ValueTree & )

Copies the matching property from the given ValueTree to this parameter.

Member Data Documentation

◆ parameter

AutomatableParameter::Ptr engine::ParameterWithStateValue::parameter

Referenced by getCurrentValue(), and getParameter().

◆ value

std::unique_ptr<juce::CachedValue<float> > engine::ParameterWithStateValue::value

Referenced by getCachedValue().


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