NAP
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
RampedValue< T > Class Template Reference

#include <audio/utility/rampedvalue.h>

Public Member Functions

 RampedValue (const T &initValue)
 
void setValue (const T &value)
 
void ramp (const T &destination, int stepCount, RampMode mode=RampMode::Linear)
 
void stop ()
 
getNextValue ()
 
getValue () const
 
bool isRamping () const
 

Public Attributes

nap::Signal< T > destinationReachedSignal
 
mIncrement
 
mFactor
 

Static Public Attributes

static constexpr T smallestFactor = 0.0001f
 

Description

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

Used to make linear or exponential ramps up and down of a value in steps. The length of the ramp and the kind of ramp can be specified for each ramp.

Collaboration diagram for RampedValue< T >:
[legend]

Constructor & Destructor Documentation

◆ RampedValue()

RampedValue ( const T &  initValue)

Member Function Documentation

◆ 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.

◆ ramp()

void ramp ( const T &  destination,
int  stepCount,
RampMode  mode = RampMode::Linear 
)

Start a ramp

Parameters
destinationthe finishing value
stepCountthe number of steps
modethe ramp interpolation mode

◆ setValue()

void setValue ( const T &  value)

Stop the current ramp and set a value directly

◆ stop()

void stop ( )

Stop the current ramp.

Member Data Documentation

◆ destinationReachedSignal

nap::Signal<T> destinationReachedSignal

Signal emitted when the destination of a ramp has been reached.

◆ mFactor

T mFactor

◆ mIncrement

T mIncrement

◆ smallestFactor

constexpr T smallestFactor = 0.0001f
staticconstexpr