6#ifndef SBL_DSP_SMOOTHING_SLEW_HPP_
7#define SBL_DSP_SMOOTHING_SLEW_HPP_
34 if (!(time_constant_frames > 0.0f)) {
37 return 1.0f - std::exp(-1.0f / time_constant_frames);
71 const float k = target_ > y_ ? rise_ : fall_;
72 y_ += k * (target_ - y_);
83 void process(
float* out, uint16_t frames) {
84 for (uint16_t i = 0; i < frames; ++i) {
107 float target_ = 0.0f;
One-pole slew toward a target, with separate rise and fall time constants.
float target() const
The current target.
float value() const
The current output.
void set_fall(float time_constant_frames)
Set the fall time constant.
void set_target(float target)
Set where the output heads.
void set_rise(float time_constant_frames)
Set the rise time constant.
void reset(float value=0.0f)
The output and the target jump to a value.
float process()
One frame.
static float coefficient_for(float time_constant_frames)
The coefficient for a time constant in frames: 1 - e^(-1 / tau).
void process(float *out, uint16_t frames)
A buffer of frames.