Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::Ramp Class Reference

A linear ramp to a target over a fixed number of frames. More...

Detailed Description

A linear ramp to a target over a fixed number of frames.

The de-zipper for a scalar port: a new target starts a straight line from the current value and arrives after the ramp's length in frames, whatever the block size. Setting the same target again does not restart a ramp in progress. head() is set() for a port: the first value a ramp is given is arrived at at once, so a component does not sweep from its constructor's value to its first setting. Below the signal transport; the length is frames, set by the component that owns it.

Definition at line 25 of file ramp.hpp.

#include <ramp.hpp>

Public Member Functions

 Ramp (float value=0.0f)
 A ramp at rest at a value, with a length of 1 frame.
 
void set_length (uint16_t frames)
 Set how many frames a ramp takes.
 
void set (float target)
 Head for a target from the current value.
 
void head (float target)
 set(), except that the first value given since construction, by head() or jump(), is arrived at at once.
 
void jump (float value)
 Arrive at a value at once.
 
float step ()
 One frame.
 
float value () const
 The current value.
 
float target () const
 The value the ramp heads for.
 
bool ramping () const
 True while a ramp is in progress.
 

Constructor & Destructor Documentation

◆ Ramp()

sbl::dsp::Ramp::Ramp ( float  value = 0.0f)
inlineexplicit

A ramp at rest at a value, with a length of 1 frame.

Parameters
valueInitial value and target; it does not count as given for head()

Definition at line 32 of file ramp.hpp.

Member Function Documentation

◆ set_length()

void sbl::dsp::Ramp::set_length ( uint16_t  frames)
inline

Set how many frames a ramp takes.

Parameters
framesRamp length in frames; 0 counts as 1

Definition at line 39 of file ramp.hpp.

Referenced by sbl::dsp::DryWet::DryWet(), sbl::dsp::Svf::Svf(), sbl::dsp::Vca::Vca(), and sbl::dsp::Vco::Vco().

◆ set()

void sbl::dsp::Ramp::set ( float  target)
inline

Head for a target from the current value.

The same target again leaves a ramp in progress alone.

Parameters
targetThe value to arrive at after the ramp's length

Definition at line 48 of file ramp.hpp.

References target().

Referenced by head(), sbl::dsp::BlepOsc< Kernel >::process(), sbl::dsp::BlepOsc< Kernel >::set_blend(), sbl::dsp::BlepOsc< Kernel >::set_saw_knee(), and sbl::dsp::BlepOsc< Kernel >::set_triangle_peak().

◆ head()

void sbl::dsp::Ramp::head ( float  target)
inline

set(), except that the first value given since construction, by head() or jump(), is arrived at at once.

For a scalar port: the first call jumps, later calls ramp.

Parameters
targetThe value to head for

Definition at line 64 of file ramp.hpp.

References jump(), set(), and target().

Referenced by sbl::dsp::Vca::process(), sbl::dsp::Svf::process(), and sbl::dsp::DryWet::process().

◆ jump()

void sbl::dsp::Ramp::jump ( float  value)
inline

◆ step()

float sbl::dsp::Ramp::step ( )
inline

One frame.

Returns
The value after this step
Context
Audio thread; real-time safe.

Definition at line 90 of file ramp.hpp.

Referenced by sbl::dsp::BlepOsc< Kernel >::process(), sbl::dsp::Vca::process(), sbl::dsp::Svf::process(), and sbl::dsp::DryWet::process().

◆ value()

float sbl::dsp::Ramp::value ( ) const
inline

◆ target()

float sbl::dsp::Ramp::target ( ) const
inline

◆ ramping()

bool sbl::dsp::Ramp::ramping ( ) const
inline

True while a ramp is in progress.

Definition at line 105 of file ramp.hpp.

Referenced by sbl::dsp::PmPulse::process().


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