LMMS
Loading...
Searching...
No Matches
dsp::inertia< Ramp > Class Template Reference

#include <inertia.h>

Public Member Functions

 inertia (const Ramp &_ramp, float init_value=0.f)
void set_now (float _value)
 Set value immediately (no inertia).
void set_inertia (float source)
 Set with inertia.
float get (float source)
 Get smoothed value of given source value.
float get ()
 Get smoothed value assuming no new input.
void step ()
 Do one inertia step, without returning the new value and without changing destination value.
void step_many (unsigned int steps)
 Do many inertia steps, without returning the new value and without changing destination value.
float get_last () const
 Get last smoothed value, without affecting anything.
bool active () const
 Is it still ramping?

Public Attributes

float old_value
float value
unsigned int count
Ramp ramp

Detailed Description

template<class Ramp>
class dsp::inertia< Ramp >

Generic inertia using ramping algorithm specified as template argument. The basic idea is producing smooth(ish) output for discrete input, using specified algorithm to go from last output value to input value. It is not the same as classic running average lowpass filter, because ramping time is finite and pre-determined (it calls ramp algorithm's length() function to obtain the expected ramp length)

Constructor & Destructor Documentation

◆ inertia()

template<class Ramp>
dsp::inertia< Ramp >::inertia ( const Ramp & _ramp,
float init_value = 0.f )
inline

Member Function Documentation

◆ active()

template<class Ramp>
bool dsp::inertia< Ramp >::active ( ) const
inline

Is it still ramping?

◆ get() [1/2]

template<class Ramp>
float dsp::inertia< Ramp >::get ( )
inline

Get smoothed value assuming no new input.

◆ get() [2/2]

template<class Ramp>
float dsp::inertia< Ramp >::get ( float source)
inline

Get smoothed value of given source value.

◆ get_last()

template<class Ramp>
float dsp::inertia< Ramp >::get_last ( ) const
inline

Get last smoothed value, without affecting anything.

◆ set_inertia()

template<class Ramp>
void dsp::inertia< Ramp >::set_inertia ( float source)
inline

Set with inertia.

◆ set_now()

template<class Ramp>
void dsp::inertia< Ramp >::set_now ( float _value)
inline

Set value immediately (no inertia).

◆ step()

template<class Ramp>
void dsp::inertia< Ramp >::step ( )
inline

Do one inertia step, without returning the new value and without changing destination value.

◆ step_many()

template<class Ramp>
void dsp::inertia< Ramp >::step_many ( unsigned int steps)
inline

Do many inertia steps, without returning the new value and without changing destination value.

Member Data Documentation

◆ count

template<class Ramp>
unsigned int dsp::inertia< Ramp >::count

◆ old_value

template<class Ramp>
float dsp::inertia< Ramp >::old_value

◆ ramp

template<class Ramp>
Ramp dsp::inertia< Ramp >::ramp

◆ value

template<class Ramp>
float dsp::inertia< Ramp >::value

The documentation for this class was generated from the following file: