VST 3 SDK VST 3.7
SDK for developing VST plug-in
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. More...
 
void setParamID (ParamID pid) noexcept
 Set the ID of the parameter. More...
 
ParamID getParamID () const noexcept
 Get the ID of the parameter. More...
 
ParamValue getValue () const noexcept
 Get the current value of the parameter. More...
 
bool hasChanges () const noexcept
 Are there any pending changes. More...
 
void beginChanges (IParamValueQueue *valueQueue) noexcept
 Begin change sequence. More...
 
ParamValue advance (int32 numSamples) noexcept
 Advance the changes in queue. More...
 
ParamValue flushChanges () noexcept
 Flush all changes in the queue. More...
 
ParamValue endChanges () noexcept
 End change sequence. More...
 
template<typename Proc >
void advance (int32 numSamples, Proc p)
 Templated variant of advance. More...
 
template<typename Proc >
void flushChanges (Proc p)
 Templated variant of flushChanges. More...
 
template<typename Proc >
void endChanges (Proc p)
 Templated variant of endChanges. More...
 
template<typename Proc >
SMTG_ALWAYS_INLINE void advance (int32 numSamples, Proc p)
 
template<typename Proc >
SMTG_ALWAYS_INLINE void flushChanges (Proc p)
 
template<typename Proc >
SMTG_ALWAYS_INLINE void endChanges (Proc p)
 

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

◆ Parameter()

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

Member Function Documentation

◆ setValue()

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

◆ setParamID()

SMTG_ALWAYS_INLINE void setParamID ( ParamID  pid)
noexcept

Set the ID of the parameter.

Parameters
pidthe new ID of the parameter

◆ getParamID()

SMTG_ALWAYS_INLINE ParamID getParamID ( ) const
noexcept

Get the ID of the parameter.

Returns
ID of the parameter

◆ getValue()

SMTG_ALWAYS_INLINE ParamValue getValue ( ) const
noexcept

Get the current value of the parameter.

Returns
current value

◆ hasChanges()

SMTG_ALWAYS_INLINE bool hasChanges ( ) const
noexcept

Are there any pending changes.

Returns
true when there are changes

◆ beginChanges()

SMTG_ALWAYS_INLINE void beginChanges ( IParamValueQueue valueQueue)
noexcept

Begin change sequence.

Parameters
valueQueuethe queue with the changes

◆ advance() [1/3]

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

◆ flushChanges() [1/3]

SMTG_ALWAYS_INLINE ParamValue flushChanges ( )
noexcept

Flush all changes in the queue.

Returns
value after flushing

◆ endChanges() [1/3]

SMTG_ALWAYS_INLINE ParamValue endChanges ( )
noexcept

End change sequence.

Returns
value after flushing all possible pending changes

◆ advance() [2/3]

void advance ( int32  numSamples,
Proc  p 
)

Templated variant of advance.

calls Proc p with the new value if the value changes

◆ flushChanges() [2/3]

void flushChanges ( Proc  p)

Templated variant of flushChanges.

calls Proc p with the new value if the value changes

◆ endChanges() [2/3]

void endChanges ( Proc  p)

Templated variant of endChanges.

calls Proc p with the new value if the value changes

◆ advance() [3/3]

SMTG_ALWAYS_INLINE void advance ( int32  numSamples,
Proc  p 
)

◆ flushChanges() [3/3]

SMTG_ALWAYS_INLINE void flushChanges ( Proc  p)

◆ endChanges() [3/3]

SMTG_ALWAYS_INLINE void endChanges ( Proc  p)
Empty

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