ASPiK SDK
Loading...
Searching...
No Matches
PluginParameter Class Reference

The PluginParameter object stores all of the data needed for any type of plugin parameter. It is a large object, but it is not complex as it really just stores LOTS of information about plugin parameters. More...

#include <pluginparameter.h>

Public Member Functions

 PluginParameter (int _controlID, const char *_controlName, const char *_controlUnits, controlVariableType _controlType, double _minValue, double _maxValue, double _defaultValue, taper _controlTaper=taper::kLinearTaper, uint32_t _displayPrecision=2)
 constructor for most knobs and sliders
 
 PluginParameter (int _controlID, const char *_controlName, std::vector< std::string > _stringList, std::string _defaultString)
 one method of constructing a string-list parameter
 
 PluginParameter (int _controlID, const char *_controlName, const char *_commaSeparatedList, std::string _defaultString)
 second method of constructing a string-list parameter
 
 PluginParameter (int _controlID, const char *_controlName, double _meterAttack_ms, double _meterRelease_ms, uint32_t _detectorMode, meterCal _meterCal=meterCal::kLinearMeter)
 method of constructing a meter parameter
 
 PluginParameter (int _controlID, const char *_controlName="", controlVariableType _controlType=controlVariableType::kNonVariableBoundControl)
 method of constructing a non-bound-variable parameter
 
 PluginParameter ()
 simple constructor - you can always use this and then use the massive number of get/set functions to customize in any manner
 
 PluginParameter (const PluginParameter &initGuiControl)
 copy constructor
 
virtual ~PluginParameter ()
 only need to clean out the aux parameters - everything else is self deleting
 
uint32_t getControlID ()
 get ID value
 
void setControlID (uint32_t cid)
 set ID value
 
const char * getControlName ()
 get name as const char*
 
void setControlName (const char *name)
 set name as const char*
 
const char * getControlUnits ()
 get units as const char*
 
void setControlUnits (const char *units)
 set units as const char*
 
controlVariableType getControlVariableType ()
 get variable type associated with parameter
 
void setControlVariableType (controlVariableType ctrlVarType)
 set variable type associated with parameter
 
double getMinValue ()
 get minimum value
 
void setMinValue (double value)
 set minimum value
 
double getMaxValue ()
 get maximum value
 
void setMaxValue (double value)
 set maximum value
 
double getDefaultValue ()
 get default value
 
void setDefaultValue (double value)
 set default value
 
bool getIsDiscreteSwitch ()
 set is switch (not used)
 
void setIsDiscreteSwitch (bool _isDiscreteSwitch)
 get is switch (not used)
 
taper getControlTaper ()
 get taper
 
void setControlTaper (taper ctrlTaper)
 set taper
 
bool isLinearTaper ()
 query: linear taper
 
bool isLogTaper ()
 query: log taper
 
bool isAntiLogTaper ()
 query: antilog taper
 
bool isVoltOctaveTaper ()
 query: volt/octave taper
 
bool isMeterParam ()
 query: meter param?
 
bool isStringListParam ()
 query: string list para,?
 
bool isFloatParam ()
 query: float param?
 
bool isDoubleParam ()
 query: double param?
 
bool isIntParam ()
 query: int param?
 
bool isNonVariableBoundParam ()
 query: non-bound param?
 
uint32_t getDisplayPrecision ()
 get sig digits
 
void setDisplayPrecision (uint32_t precision)
 set sig digits
 
double getMeterAttack_ms ()
 get meter attack time (ballistics)
 
void setMeterAttack_ms (double value)
 set meter attack time (ballistics)
 
double getMeterRelease_ms ()
 get meter release time (ballistics)
 
void setMeterRelease_ms (double value)
 set meter release time (ballistics)
 
uint32_t getDetectorMode ()
 get meter detect mode
 
void setMeterDetectorMode (uint32_t value)
 set meter detect mode
 
bool getLogMeter ()
 query log meter flag
 
void setLogMeter (bool value)
 set log meter flag
 
bool getInvertedMeter ()
 query inverted meter flag
 
void setInvertedMeter (bool value)
 set inverted meter flag
 
bool isProtoolsGRMeter ()
 query pro tools GR meter flag
 
void setIsProtoolsGRMeter (bool value)
 set inverted meter flag
 
bool getParameterSmoothing ()
 query parameter smoothing flag
 
void setParameterSmoothing (bool value)
 set inverted meter flag
 
double getSmoothingTimeMsec ()
 query smoothing time
 
void setSmoothingTimeMsec (double value)
 set inverted meter flag
 
smoothingMethod getSmoothingMethod ()
 query smoothing method
 
void setSmoothingMethod (smoothingMethod smoothingMethod)
 set smoothing method
 
bool getIsWritable ()
 query writable control (meter)
 
void setIsWritable (bool value)
 set writable control (meter)
 
bool getEnableVSTSampleAccurateAutomation ()
 query VST3 sample accurate automation
 
void setEnableVSTSampleAccurateAutomation (bool value)
 set VST3 sample accurate automation
 
AuxParameterAttributegetAuxAttribute (uint32_t attributeID)
 get aux data
 
uint32_t setAuxAttribute (uint32_t attributeID, const AuxParameterAttribute &auxParameterAtribute)
 set aux data
 
double getControlValue ()
 the main function to access the underlying atomic double value
 
void setControlValue (double actualParamValue, bool ignoreSmoothing=false)
 the main function to set the underlying atomic double value
 
double setControlValueNormalized (double normalizedValue, bool applyTaper=true, bool ignoreParameterSmoothing=false)
 the main function to set the underlying atomic double value using a normalized value; this is the operation in VST3 and RAFX2
 
std::string getControlValueAsString ()
 the main function to access the underlying atomic double value as a string
 
size_t getStringCount ()
 get the number of individual strings in a string-list control
 
const char * getCommaSeparatedStringList ()
 get the strings in a string-list control as a comma separated list
 
void setCommaSeparatedStringList ()
 convert the string-list into a comma-separated list (during construction)
 
void setStringList (std::vector< std::string > _stringList)
 set the string-list using a vector of strings
 
std::string getStringByIndex (uint32_t index)
 get string-list string by index
 
double getDefaultValueNormalized ()
 get default value as normalied value
 
double getControlValueNormalized (bool applyTaper=true)
 get control value as normalied value
 
double getControlValueWithNormalizedValue (double normalizedValue, bool applyTaper=true)
 get the new control value as if it were set with a normalized value
 
double getNormalizedControlValueWithActualValue (double actualValue)
 get the new normalized control value as if it were set with an actual value
 
double getGUIMin ()
 
double getGUIMax ()
 
int findStringIndex (std::string searchString)
 find a string in the list of a string-list parameter
 
double normToLogNorm (double normalizedValue)
 
double logNormToNorm (double logNormalizedValue)
 
double normToAntiLogNorm (double normalizedValue)
 
double antiLogNormToNorm (double aLogNormalizedValue)
 
void initParamSmoother (double sampleRate)
 initialize or reset the parameter smoother object
 
void updateSampleRate (double sampleRate)
 change any sample-rate dependent members
 
bool smoothParameterValue ()
 perform smoothing operation on data
 
void setBoundVariable (void *boundVariable, boundVariableType dataType)
 save the variable for binding operation
 
boundVariableType getBoundVariableType ()
 get the datatype of the bound variable
 
bool updateInBoundVariable ()
 perform the variable binding update (change the value)
 
bool updateOutBoundVariable ()
 perform the variable binding update on meter data
 
void setParameterUpdateQueue (IParameterUpdateQueue *_parameterUpdateQueue)
 stores the update queue for VST3 sample accuate automation; note this is only used during actual DAW runs with automation engaged
 
IParameterUpdateQueuegetParameterUpdateQueue ()
 retrieves the update queue for VST3 sample accuate automation; note this is only used during actual DAW runs with automation engaged
 
PluginParameteroperator= (const PluginParameter &aPluginParameter)
 

Protected Member Functions

float getAtomicControlValueFloat () const
 set atomic variable with float
 
void setAtomicControlValueFloat (float value)
 get atomic variable as float
 
double getAtomicControlValueDouble () const
 set atomic variable with double
 
void setAtomicControlValueDouble (double value)
 get atomic variable as double
 
void setSmoothedTargetValue (double value)
 set atomic TARGET smoothing variable with double
 
double getSmoothedTargetValue () const
 set atomic TARGET smoothing variable with double
 
double getVoltOctaveControlValueFromNormValue (double normalizedValue)
 get volt/octave control value from a normalized value
 
double getNormalizedLogControlValue ()
 get get log control value in normalized form
 
double getNormalizedAntiLogControlValue ()
 get get anti-log control value in normalized form
 
double getNormalizedVoltOctaveControlValue ()
 get get volt/octave control value in normalized form
 
double getNormalizedControlValueWithActual (double actualValue)
 convert actual control value into normalized value (helper)
 
double getNormalizedControlValue ()
 get control value as normalized value (helper)
 
double getControlValueFromNormalizedValue (double normalizedValue)
 get control value with a normalized value (helper)
 
double getNormalizedDefaultValue ()
 get default value as a normalized value (helper)
 
double getNormalizedLogDefaultValue ()
 get log default value in normalized form
 
double getNormalizedAntiLogDefaultValue ()
 get anti-log default value in normalized form
 
double getNormalizedVoltOctaveDefaultValue ()
 get volt/octave default value in normalized form
 

Protected Attributes

int controlID = -1
 the ID value for the parameter
 
std::string controlName = "ControlName"
 the name string for the parameter
 
std::string controlUnits = "Units"
 the units string for the parameter
 
controlVariableType controlType = controlVariableType::kDouble
 the control type
 
double minValue = 0.0
 the min for the parameter
 
double maxValue = 1.0
 the max for the parameter
 
double defaultValue = 0.0
 the default value for the parameter
 
std::atomic< float > controlValueAtomic
 the underlying atomic variable
 
std::atomic< float > smoothedTargetValueAtomic
 the underlying atomic variable TARGET for smoothing
 
taper controlTaper = taper::kLinearTaper
 the taper
 
uint32_t displayPrecision = 2
 sig digits for display
 
std::vector< std::string > stringList
 string list
 
std::string commaSeparatedStringList
 string list a somma separated string
 
bool appendUnits = true
 flag to append units in GUI controls (use with several built-in custom views)
 
bool isWritable = false
 flag for meter variables
 
bool isDiscreteSwitch = false
 flag for switches (not currently used in ASPiK)
 
double meterAttack_ms = 10.0
 meter attack time in milliseconds
 
double meterRelease_ms = 500.0
 meter release time in milliseconds
 
uint32_t detectorMode = ENVELOPE_DETECT_MODE_RMS
 meter detector mode
 
bool logMeter = false
 meter is log
 
bool invertedMeter = false
 meter is inverted
 
bool protoolsGRMeter = false
 meter is a Pro Tools gain reduction meter
 
bool useParameterSmoothing = false
 enable param smoothing
 
smoothingMethod smoothingType = smoothingMethod::kLPFSmoother
 param smoothing type
 
double smoothingTimeMsec = 100.0
 param smoothing time
 
ParamSmoother< double > paramSmoother
 param smoothing object
 
boundVariableType boundVariableDataType = boundVariableType::kFloat
 bound data type
 
IParameterUpdateQueueparameterUpdateQueue = nullptr
 interface for VST3 sample accurate updates
 
bool enableVSTSampleAccurateAutomation = true
 VST3 sample accurate flag.
 

Detailed Description

The PluginParameter object stores all of the data needed for any type of plugin parameter. It is a large object, but it is not complex as it really just stores LOTS of information about plugin parameters.

PluginParameter Operations:

  • store attributes of plugin parameters (numerous)
  • store the actual parameter value as an atomic double
  • provide access to the atomic double value as needed (and safely)
  • hold the parameter smoother object
  • store infinite amount of auxilliary data in numerous formats (you can easily add your own)
  • consists mainly of attributes and get/set functions for each
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Constructor & Destructor Documentation

◆ PluginParameter() [1/7]

PluginParameter::PluginParameter ( int  _controlID,
const char *  _controlName,
const char *  _controlUnits,
controlVariableType  _controlType,
double  _minValue,
double  _maxValue,
double  _defaultValue,
taper  _controlTaper = taper::kLinearTaper,
uint32_t  _displayPrecision = 2 
)

constructor for most knobs and sliders

constructor for continuous controls

Parameters
_controlIDnumerical control identifier – MUST BE UNIQUE among all parameter ID values
_controlNamename string
_controlUnitsunits string
_controlTypetype
_minValuemin limit
_maxValuemax limit
_defaultValuedefault value at startup
_controlTapertype of gtaper
_displayPrecisionsig digits of precision on GUI display

◆ PluginParameter() [2/7]

PluginParameter::PluginParameter ( int  _controlID,
const char *  _controlName,
std::vector< std::string >  _stringList,
std::string  _defaultString 
)

one method of constructing a string-list parameter

constructor 1 for string-list controls

Parameters
_controlIDnumerical control identifier – MUST BE UNIQUE among all parameter ID values
_controlNamename string
_stringListstring list in std::vector format
_defaultStringdefault string value as std::string

◆ PluginParameter() [3/7]

PluginParameter::PluginParameter ( int  _controlID,
const char *  _controlName,
const char *  _commaSeparatedList,
std::string  _defaultString 
)

second method of constructing a string-list parameter

constructor 2 for string-list controls

Parameters
_controlIDnumerical control identifier – MUST BE UNIQUE among all parameter ID values
_controlNamename string
_commaSeparatedListsimple character string of comma-separated items
_defaultStringdefault string value as std::string

◆ PluginParameter() [4/7]

PluginParameter::PluginParameter ( int  _controlID,
const char *  _controlName,
double  _meterAttack_ms,
double  _meterRelease_ms,
uint32_t  _detectorMode,
meterCal  _meterCal = meterCal::kLinearMeter 
)

method of constructing a meter parameter

constructor for meter controls

Parameters
_controlIDnumerical control identifier – MUST BE UNIQUE among all parameter ID values
_controlNamename string
_meterAttack_msattack time for meter (ballistics)
_meterRelease_msrelease time for meter (ballistics)
_detectorModepeak, ms, rms
_meterCallinear or log calibration

◆ PluginParameter() [5/7]

PluginParameter::PluginParameter ( int  _controlID,
const char *  _controlName = "",
controlVariableType  _controlType = controlVariableType::kNonVariableBoundControl 
)

method of constructing a non-bound-variable parameter

constructor for NonVariableBoundControl

Parameters
_controlIDnumerical control identifier – MUST BE UNIQUE among all parameter ID values
_controlNamename string
_controlTypetype of control

◆ PluginParameter() [6/7]

PluginParameter::PluginParameter ( )

simple constructor - you can always use this and then use the massive number of get/set functions to customize in any manner

empty constructor

◆ PluginParameter() [7/7]

PluginParameter::PluginParameter ( const PluginParameter initGuiControl)

copy constructor

copy constructor

◆ ~PluginParameter()

PluginParameter::~PluginParameter ( )
virtual

only need to clean out the aux parameters - everything else is self deleting

D-TOR

Member Function Documentation

◆ antiLogNormToNorm()

double PluginParameter::antiLogNormToNorm ( double  aLogNormalizedValue)
inline

AntiLog-normalized to normalized version

◆ findStringIndex()

int PluginParameter::findStringIndex ( std::string  searchString)
inline

find a string in the list of a string-list parameter

Returns
index of string in list

◆ getAuxAttribute()

AuxParameterAttribute * PluginParameter::getAuxAttribute ( uint32_t  attributeID)

get aux data

get an aux attribute

Parameters
attributeIDunique identifier of attribute
Returns
a naked pointer to the attribute

◆ getBoundVariableType()

boundVariableType PluginParameter::getBoundVariableType ( )
inline

get the datatype of the bound variable

Returns
boundVariableType

◆ getCommaSeparatedStringList()

const char * PluginParameter::getCommaSeparatedStringList ( )
inline

get the strings in a string-list control as a comma separated list

Returns
comma separated list as a const char*

◆ getControlValue()

double PluginParameter::getControlValue ( )
inline

the main function to access the underlying atomic double value

Returns
the value as a regular double

◆ getControlValueAsString()

std::string PluginParameter::getControlValueAsString ( )

the main function to access the underlying atomic double value as a string

get control value: string

Returns
the value as a std::string
Returns
std::string version of control value

◆ getControlValueFromNormalizedValue()

double PluginParameter::getControlValueFromNormalizedValue ( double  normalizedValue)
inlineprotected

get control value with a normalized value (helper)

Parameters
normalizedValuethe normalized value
Returns
actual version

◆ getControlValueNormalized()

double PluginParameter::getControlValueNormalized ( bool  applyTaper = true)
inline

get control value as normalied value

Returns
control value in normalized form

◆ getControlValueWithNormalizedValue()

double PluginParameter::getControlValueWithNormalizedValue ( double  normalizedValue,
bool  applyTaper = true 
)
inline

get the new control value as if it were set with a normalized value

Returns
control value as if it were set with a normalized value

◆ getDefaultValueNormalized()

double PluginParameter::getDefaultValueNormalized ( )
inline

get default value as normalied value

Returns
default value in normalized form

◆ getGUIMax()

double PluginParameter::getGUIMax ( )
inline

get the maximum GUI value for string-list params

◆ getGUIMin()

double PluginParameter::getGUIMin ( )
inline

get the minimum GUI value - this is ALWAYS 0.0 for VSTGUI4

◆ getNormalizedAntiLogControlValue()

double PluginParameter::getNormalizedAntiLogControlValue ( )
inlineprotected

get get anti-log control value in normalized form

Returns
anti-log control value in normalized form

◆ getNormalizedAntiLogDefaultValue()

double PluginParameter::getNormalizedAntiLogDefaultValue ( )
inlineprotected

get anti-log default value in normalized form

Returns
normalized version

◆ getNormalizedControlValue()

double PluginParameter::getNormalizedControlValue ( )
inlineprotected

get control value as normalized value (helper)

Returns
normalized version

◆ getNormalizedControlValueWithActual()

double PluginParameter::getNormalizedControlValueWithActual ( double  actualValue)
inlineprotected

convert actual control value into normalized value (helper)

Parameters
actualValuethe actual value
Returns
normalized version

◆ getNormalizedControlValueWithActualValue()

double PluginParameter::getNormalizedControlValueWithActualValue ( double  actualValue)
inline

get the new normalized control value as if it were set with an actual value

Returns
control value as if it were set with a normalized value

◆ getNormalizedDefaultValue()

double PluginParameter::getNormalizedDefaultValue ( )
inlineprotected

get default value as a normalized value (helper)

Returns
normalized version

◆ getNormalizedLogControlValue()

double PluginParameter::getNormalizedLogControlValue ( )
inlineprotected

get get log control value in normalized form

Returns
log control value in normalized form

◆ getNormalizedLogDefaultValue()

double PluginParameter::getNormalizedLogDefaultValue ( )
inlineprotected

get log default value in normalized form

Returns
normalized version

◆ getNormalizedVoltOctaveControlValue()

double PluginParameter::getNormalizedVoltOctaveControlValue ( )
inlineprotected

get get volt/octave control value in normalized form

Returns
volt/octave control value in normalized form

◆ getNormalizedVoltOctaveDefaultValue()

double PluginParameter::getNormalizedVoltOctaveDefaultValue ( )
inlineprotected

get volt/octave default value in normalized form

Returns
normalized version

◆ getParameterUpdateQueue()

IParameterUpdateQueue * PluginParameter::getParameterUpdateQueue ( )
inline

retrieves the update queue for VST3 sample accuate automation; note this is only used during actual DAW runs with automation engaged

Returns
IParameterUpdateQueue*

◆ getStringByIndex()

std::string PluginParameter::getStringByIndex ( uint32_t  index)

get string-list string by index

get a string-list string using the index

Parameters
indexof string in list
Returns
std::string version of single string

◆ getStringCount()

size_t PluginParameter::getStringCount ( )
inline

get the number of individual strings in a string-list control

Returns
number of strings

◆ getVoltOctaveControlValueFromNormValue()

double PluginParameter::getVoltOctaveControlValueFromNormValue ( double  normalizedValue)
inlineprotected

get volt/octave control value from a normalized value

Parameters
normalizedValuethe normalized version
Returns
volt/octave version

◆ initParamSmoother()

void PluginParameter::initParamSmoother ( double  sampleRate)
inline

initialize or reset the parameter smoother object

Parameters
sampleRatefs (needed for coefficient calc)

◆ logNormToNorm()

double PluginParameter::logNormToNorm ( double  logNormalizedValue)
inline

Log-normalized to normalized version (reverse-convex transform)

◆ normToAntiLogNorm()

double PluginParameter::normToAntiLogNorm ( double  normalizedValue)
inline

normalized to AntiLog-normalized version

◆ normToLogNorm()

double PluginParameter::normToLogNorm ( double  normalizedValue)
inline

normalized to Log-normalized version (convex transform)

◆ operator=()

PluginParameter & PluginParameter::operator= ( const PluginParameter aPluginParameter)
inline

overloaded = operator (standard C++ fare)

◆ setAuxAttribute()

uint32_t PluginParameter::setAuxAttribute ( uint32_t  attributeID,
const AuxParameterAttribute auxParameterAtribute 
)

set aux data

set an aux attribute

Parameters
attributeIDunique identifier of attribute
auxParameterAtributeinformation about the aux attribute
Returns
the index of the new attribute

◆ setBoundVariable()

void PluginParameter::setBoundVariable ( void *  boundVariable,
boundVariableType  dataType 
)
inline

save the variable for binding operation

Parameters
boundVariablenaked pointer to bound variable
dataTypedata type for casting

◆ setCommaSeparatedStringList()

void PluginParameter::setCommaSeparatedStringList ( )

convert the string-list into a comma-separated list (during construction)

set comma-separated version of string list (internally called)

◆ setControlValue()

void PluginParameter::setControlValue ( double  actualParamValue,
bool  ignoreSmoothing = false 
)
inline

the main function to set the underlying atomic double value

Parameters
actualParamValueparameter value as a regular double
ignoreSmoothingflag to ignore smoothing operation and write directly to atomic double

◆ setControlValueNormalized()

double PluginParameter::setControlValueNormalized ( double  normalizedValue,
bool  applyTaper = true,
bool  ignoreParameterSmoothing = false 
)
inline

the main function to set the underlying atomic double value using a normalized value; this is the operation in VST3 and RAFX2

Parameters
normalizedValueparameter value as a regular double
applyTaperadd the control taper during the operation
ignoreParameterSmoothingflag to ignore smoothing operation and write directly to atomic double

◆ setParameterUpdateQueue()

void PluginParameter::setParameterUpdateQueue ( IParameterUpdateQueue _parameterUpdateQueue)
inline

stores the update queue for VST3 sample accuate automation; note this is only used during actual DAW runs with automation engaged

Parameters
_parameterUpdateQueuethe update queue to store

◆ smoothParameterValue()

bool PluginParameter::smoothParameterValue ( )
inline

perform smoothing operation on data

Returns
true if data was actually smoothed, false otherwise (data that has reached its terminal value will not be smoothed any further)

◆ updateInBoundVariable()

bool PluginParameter::updateInBoundVariable ( )
inline

perform the variable binding update (change the value)

Returns
boundVariableType

◆ updateOutBoundVariable()

bool PluginParameter::updateOutBoundVariable ( )
inline

perform the variable binding update on meter data

Returns
true if variable was udpated, false otherwise

◆ updateSampleRate()

void PluginParameter::updateSampleRate ( double  sampleRate)
inline

change any sample-rate dependent members

Parameters
sampleRatefs (needed for coefficient calc)

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