Class thl::dsp::sampler::FadeCurve#
-
class FadeCurve#
Quarter-sine crossfade table.
at(k) = sin(k / length * pi / 2)for integer k in [0, length]. Becausecos(t * pi/2) == sin((1 - t) * pi/2), one table serves the fade in and the fade out exactly: no interpolation and no sin/cos on the audio thread.- Real-Time Safety
prepare() allocates; every other member is real-time safe.
Public Functions
-
inline void prepare(size_t length)#
Build the table for a fade of
lengthsteps (at least 1).
-
inline size_t length() const#
-
inline float at(double t) const#
Gain at fade position t in [0, 1] (nearest step): 0 -> 0, 1 -> 1.