NAP
Public Member Functions | List of all members
LinearSmoothedValue< T > Class Template Reference

#include <audio/utility/linearsmoothedvalue.h>

Public Member Functions

 LinearSmoothedValue (const T &initValue, int stepCount)
 
void reset (const T &initValue)
 
void setStepCount (int stepCount)
 
void setValue (const T &destination)
 
getNextValue ()
 
getValue () const
 
getDestination () const
 
bool isRamping () const
 

Description

template<typename T>
class nap::audio::LinearSmoothedValue< T >

Used to smooth changed to a value linearly over time, using a fixed smoothing time.

Constructor & Destructor Documentation

◆ LinearSmoothedValue()

LinearSmoothedValue ( const T &  initValue,
int  stepCount 
)

Member Function Documentation

◆ getDestination()

T getDestination ( ) const

◆ getNextValue()

T getNextValue ( )

Take the next step in the current ramp. Should only be called from the audio thread.

◆ getValue()

T getValue ( ) const

Returns the current value. Should only be called from the audio thread

◆ isRamping()

bool isRamping ( ) const

Returns true when currently playing a ramp. Should only be called from the audio thread.

◆ reset()

void reset ( const T &  initValue)

Quit all smoothing in progress and reset output to the passed value. Don't call this while getNextValue() can be called.

Parameters
initValuethe new output value.

◆ setStepCount()

void setStepCount ( int  stepCount)

Change the number of steps the value takes to reach a new destination.

◆ setValue()

void setValue ( const T &  destination)

Start a ramp

Parameters
destinationthe finishing value