|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
One-pole slew toward a target, with separate rise and fall time constants. More...
One-pole slew toward a target, with separate rise and fall time constants.
y += k (target - y) per frame, k the rise coefficient when the target is above y and the fall coefficient when below. Below the signal transport: the time constants are in frames, set by the component or app that owns it. Until a time constant is set, its coefficient is 1 and the output jumps to the target.
#include <slew.hpp>
Public Member Functions | |
| void | set_rise (float time_constant_frames) |
| Set the rise time constant. | |
| void | set_fall (float time_constant_frames) |
| Set the fall time constant. | |
| void | set_target (float target) |
| Set where the output heads. | |
| float | process () |
| One frame. | |
| void | process (float *out, uint16_t frames) |
| A buffer of frames. | |
| void | reset (float value=0.0f) |
| The output and the target jump to a value. | |
| float | value () const |
| The current output. | |
| float | target () const |
| The current target. | |
Static Public Member Functions | |
| static float | coefficient_for (float time_constant_frames) |
| The coefficient for a time constant in frames: 1 - e^(-1 / tau). | |
|
inlinestatic |
The coefficient for a time constant in frames: 1 - e^(-1 / tau).
The step response reaches 1 - 1/e after tau frames.
| time_constant_frames | tau, in frames |
Definition at line 33 of file slew.hpp.
Referenced by set_fall(), and set_rise().
|
inline |
Set the rise time constant.
| time_constant_frames | tau in frames, as coefficient_for() takes it |
Definition at line 46 of file slew.hpp.
References coefficient_for().
|
inline |
Set the fall time constant.
| time_constant_frames | tau in frames, as coefficient_for() takes it |
Definition at line 54 of file slew.hpp.
References coefficient_for().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |