Class thl::dsp::dynamics::LevelDetector#
-
class LevelDetector#
The level of one channel as a power (a squared amplitude), sample by sample.
Peak gives x², Rms the mean square through a one-pole of time constant rms window: a sine of peak A reads A² / 2, -3.01 dB under its peak, once the window is long against its period. Linking channels happens on these powers (link_powers(), StereoLink.h), the dB value once after it (utils::power_to_db(), Decibels.h).
Threads: prepare() and set_rms_window_ms() compute a coefficient; all is real-time safe.
Public Functions
-
inline void prepare(double sample_rate)#
-
inline void set_mode(DetectorMode mode)#
A change clears the RMS window, so it does not resume from what it held before.
-
inline DetectorMode mode() const#
-
inline void set_rms_window_ms(float window_ms)#
The RMS window’s time constant in ms (at least one sample).
-
inline void reset()#
-
inline float process(float x)#
The power at the sample
x.A non-finite sample reads as silence, so it cannot leave the RMS window NaN for good.
-
inline void prepare(double sample_rate)#