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

Detailed Description

Definition at line 31 of file critical_damp.hpp.

#include <critical_damp.hpp>

Public Member Functions

void set_time_ms (float ms, float rate_hz)
 Set settling time in milliseconds.
 
void set_coefficient (float a)
 Set coefficient directly (advanced use)
 
float process (float target)
 Process one sample toward target.
 
void process (float *buf, uint16_t frames, float target)
 Fill buffer with smoothed trajectory toward target.
 
float value () const
 Current output value.
 
float coefficient () const
 Current per-pole coefficient.
 
void reset ()
 Reset to zero.
 
void reset (float val)
 Reset to specific value (both stages)
 

Member Function Documentation

◆ set_time_ms()

void sbl::dsp::primitives::CriticalDamp::set_time_ms ( float  ms,
float  rate_hz 
)
inline

Set settling time in milliseconds.

Note
All public methods are ISR-safe — bounded computation, no I/O.
Parameters
msTime for 95% settling (0 = instant)
rate_hzUpdate rate in Hz (e.g., 1000 for block-rate, 48000 for audio-rate)

Computes the per-pole coefficient for a two-stage cascade. The combined system reaches 95% of a step change in ms milliseconds.

Definition at line 43 of file critical_damp.hpp.

References sbl::dsp::math::one_minus_exp_neg().

◆ set_coefficient()

void sbl::dsp::primitives::CriticalDamp::set_coefficient ( float  a)
inline

Set coefficient directly (advanced use)

Parameters
aPer-pole coefficient [0, 1]

Definition at line 63 of file critical_damp.hpp.

◆ process() [1/2]

float sbl::dsp::primitives::CriticalDamp::process ( float  target)
inline

Process one sample toward target.

Parameters
targetThe value to approach
Returns
Smoothed value

Definition at line 70 of file critical_damp.hpp.

Referenced by sbl::dsp::modules::Ladder::process(), sbl::dsp::widgets::Svf::process(), and process().

◆ process() [2/2]

void sbl::dsp::primitives::CriticalDamp::process ( float *  buf,
uint16_t  frames,
float  target 
)
inline

Fill buffer with smoothed trajectory toward target.

Parameters
bufOutput buffer (filled with per-sample smoothed values)
framesNumber of samples
targetTarget value

Useful for generating per-sample coefficient ramps inside filter widgets.

Definition at line 84 of file critical_damp.hpp.

References process().

◆ value()

float sbl::dsp::primitives::CriticalDamp::value ( ) const
inline

Current output value.

Definition at line 91 of file critical_damp.hpp.

◆ coefficient()

float sbl::dsp::primitives::CriticalDamp::coefficient ( ) const
inline

Current per-pole coefficient.

Definition at line 94 of file critical_damp.hpp.

◆ reset() [1/2]

void sbl::dsp::primitives::CriticalDamp::reset ( )
inline

◆ reset() [2/2]

void sbl::dsp::primitives::CriticalDamp::reset ( float  val)
inline

Reset to specific value (both stages)

Definition at line 103 of file critical_damp.hpp.


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