VST 3 SDK  VST 3.7
SDK for developing VST plug-in
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
Parameter Struct Reference

Utility class to handle sample accurate parameter changes coming from IParamValueQueue. More...

#include <sampleaccurate.h>

Public Member Functions

 Parameter (ParamID pid=0, ParamValue initValue=0.) noexcept
 
void setValue (ParamValue v) noexcept
 Set the value of the parameter.
 
void setParamID (ParamID pid) noexcept
 Set the ID of the parameter.
 
ParamID getParamID () const noexcept
 Get the ID of the parameter.
 
ParamValue getValue () const noexcept
 Get the current value of the parameter.
 
bool hasChanges () const noexcept
 Are there any pending changes.
 
void beginChanges (IParamValueQueue *valueQueue) noexcept
 Begin change sequence.
 
ParamValue advance (int32 numSamples) noexcept
 Advance the changes in queue.
 
ParamValue flushChanges () noexcept
 Flush all changes in the queue.
 
ParamValue endChanges () noexcept
 End change sequence.
 
template<typename Proc >
void advance (int32 numSamples, Proc p) noexcept
 Templated variant of advance.
 
template<typename Proc >
void flushChanges (Proc p) noexcept
 Templated variant of flushChanges.
 
template<typename Proc >
void endChanges (Proc p) noexcept
 Templated variant of endChanges.
 

Detailed Description

Utility class to handle sample accurate parameter changes coming from IParamValueQueue.

The normal use case is to setup the Parameter class once for a specific ParamID and then only use it in the realtime process method.

If there's a change for the parameter in the inputParameterChanges of the ProcessData structure the Parameters beginChange method should be called with the valueQueue of the parmID and then while processing the current audio block the parameter should be advanced as many samples as you would like to handle parameter changes. In the end the endChanges method must be called to cleanup internal data structures. For convenience the endChanges method can be called without a previous beginChanges call.

Constructor & Destructor Documentation

SMTG_ALWAYS_INLINE Parameter ( ParamID  pid = 0,
ParamValue  initValue = 0. 
)
noexcept

Member Function Documentation

SMTG_ALWAYS_INLINE void setValue ( ParamValue  v)
noexcept

Set the value of the parameter.

When this is called during the beginChanges() and endChanges() sequence, the changes in the value queue are ignored

Parameters
vthe new value of the parameter
SMTG_ALWAYS_INLINE void setParamID ( ParamID  pid)
noexcept

Set the ID of the parameter.

Parameters
pidthe new ID of the parameter
SMTG_ALWAYS_INLINE ParamID getParamID ( ) const
noexcept

Get the ID of the parameter.

Returns
ID of the parameter
SMTG_ALWAYS_INLINE ParamValue getValue ( ) const
noexcept

Get the current value of the parameter.

Returns
current value
SMTG_ALWAYS_INLINE bool hasChanges ( ) const
noexcept

Are there any pending changes.

Returns
true when there are changes
SMTG_ALWAYS_INLINE void beginChanges ( IParamValueQueue valueQueue)
noexcept

Begin change sequence.

Parameters
valueQueuethe queue with the changes
SMTG_ALWAYS_INLINE ParamValue advance ( int32  numSamples)
noexcept

Advance the changes in queue.

Parameters
numSampleshow many samples to advance in the queue
Returns
current value
SMTG_ALWAYS_INLINE ParamValue flushChanges ( )
noexcept

Flush all changes in the queue.

Returns
value after flushing
SMTG_ALWAYS_INLINE ParamValue endChanges ( )
noexcept

End change sequence.

Returns
value after flushing all possible pending changes
SMTG_ALWAYS_INLINE void advance ( int32  numSamples,
Proc  p 
)
noexcept

Templated variant of advance.

calls Proc p with the new value if the value changes

SMTG_ALWAYS_INLINE void flushChanges ( Proc  p)
noexcept

Templated variant of flushChanges.

calls Proc p with the new value if the value changes

SMTG_ALWAYS_INLINE void endChanges ( Proc  p)
noexcept

Templated variant of endChanges.

calls Proc p with the new value if the value changes

Empty

Copyright ©2022 Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.