22#ifndef SBL_DSP_PRIMITIVES_CRITICAL_DAMP_HPP_
23#define SBL_DSP_PRIMITIVES_CRITICAL_DAMP_HPP_
48 float n = ms * rate_hz * 0.001f;
71 state1_ += coeff_ * (target - state1_);
72 state2_ += coeff_ * (state1_ - state2_);
84 void process(
float* buf, uint16_t frames,
float target) {
85 for (uint16_t i = 0; i < frames; ++i) {
91 float value()
const {
return state2_; }
110 float state1_ = 0.0f;
111 float state2_ = 0.0f;
float value() const
Current output value.
void set_time_ms(float ms, float rate_hz)
Set settling time in milliseconds.
void reset()
Reset to zero.
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 coefficient() const
Current per-pole coefficient.
void reset(float val)
Reset to specific value (both stages)
Fast analytical approximations (Audio Stack — Atoms)
constexpr float one_minus_exp_neg(float x)
Stateful, single-concern building blocks.