![]() |
fsh::stk
fantastic spatial holophonic synthesis toolkit
|
Smoothed value tracking with separate attack/decay times. More...
#include <EnvelopeFollower.h>
Classes | |
struct | Params |
Parameters for EnvelopeFollower. More... | |
Public Member Functions | |
auto | getNextValue () -> double |
Calculate the next value between the current value and the target. | |
void | setTargetValue (double) |
Set the target. | |
void | setSampleRate (double) |
Set the sample rate. This must be set before using the EnvelopeFollower. | |
void | setParams (const Params &) |
Set the parameters. Will fall back on default values if not set. | |
void | reset (double val=0.0) |
Reset both the current and target values to the specified value, or to zero if none is provided. | |
Smoothed value tracking with separate attack/decay times.
Can be used as a general simple attack/decay envelope, or for avoiding audible clicks on sudden parameter changes.
This class provides a simple exponential curve between its current value and a target value, specified with setTargetValue(). If the target is lower than the current value, the EnvelopeFollower will use the attack time to reach the target, and conversely the release time if the target is lower.
Note that
Before using an EnvelopeFollower, you must set the sample rate using setSampleRate(). You may also want to set the attack and release times using setParams(), but these will fall back on very short default values.