VST 3 SDK: Parameter Struct Reference
Author: Steinberg

VST 3 SDK VST 3.8 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Public Member Functions | List of all members
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)
| Templated variant of advance.
template<typename Proc>
void | flushChanges (Proc p)
| Templated variant of flushChanges.
template<typename Proc>
void | endChanges (Proc p)
| Templated variant of endChanges.
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

  v | the new value of the parameter

## ◆ setParamID()

SMTG_ALWAYS_INLINE void setParamID | ( | ParamID | pid | ) |
| noexcept

Set the ID of the parameter.

Parameters

  pid | the 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

  valueQueue | the queue with the changes

## ◆ advance() [1/3]

SMTG_ALWAYS_INLINE ParamValue advance | ( | int32 | numSamples | ) |
| noexcept

Advance the changes in queue.

Parameters

  numSamples | how 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]

template<typename Proc>

void advance | ( | int32 | numSamples,
|  | Proc | p )

Templated variant of advance.

calls Proc p with the new value if the value changes

## ◆ flushChanges() [2/3]

template<typename Proc>

void flushChanges | ( | Proc | p | ) |

Templated variant of flushChanges.

calls Proc p with the new value if the value changes

## ◆ endChanges() [2/3]

template<typename Proc>

void endChanges | ( | Proc | p | ) |

Templated variant of endChanges.

calls Proc p with the new value if the value changes

## ◆ advance() [3/3]

template<typename Proc>

SMTG_ALWAYS_INLINE void advance | ( | int32 | numSamples,
|  | Proc | p )

## ◆ flushChanges() [3/3]

template<typename Proc>

SMTG_ALWAYS_INLINE void flushChanges | ( | Proc | p | ) |

## ◆ endChanges() [3/3]

template<typename Proc>

SMTG_ALWAYS_INLINE void endChanges | ( | Proc | p | ) |

Empty

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