|
| | LoudnessMeter ()=default |
| |
| void | prepare (double sampleRate, int numChannels, int maxBlockSize) |
| | Allocates for the given format and resets the measurement.
|
| |
| void | process (choc::buffer::ChannelArrayView< const float > block) noexcept |
| | Processes a block of audio, updating the published readings.
|
| |
| void | process (const float *const *channels, int numChannels, int numSamples) noexcept |
| | Processes a block of audio from raw channel pointers.
|
| |
| void | flush () noexcept |
| | For offline use: finishes a partially-filled gating block if it's at least half full, so a file's tail contributes to the measurement.
|
| |
| void | requestReset () noexcept |
| | Asks for the integrated measurement, held maxima and peaks to be restarted.
|
| |
| Readings | getReadings () const noexcept |
| | Returns the current readings.
|
| |
A real-time-safe EBU R128 / ITU-R BS.1770-4 loudness meter.
It measures momentary (400ms), short-term (3s) and gated integrated loudness, loudness range (EBU Tech 3342) and 4x-oversampled true peak and sample peak, and can be driven either from an audio callback or from an offline file pass.
Real-time contract:
- prepare() does all of the allocation and must not be called while processing.
- process() is allocation- and lock-free, and takes no locks internally.
- getReadings() may be called from any thread (typically a UI timer) while process() is running on the audio thread. It returns one internally consistent snapshot, via a seqlock: the write side stays wait-free, and the read side only retries if it collides with a publish.
Unlike a straight offline implementation, the integrated measurement doesn't keep the whole history of gating blocks: momentary powers are accumulated into a fixed 0.1 LU histogram (the libebur128 approach), so the memory is constant and the gated result is recomputed in constant time every 100ms. Only the two gate decisions are quantised, to at most the 0.1 LU bin width, which is far inside the EBU R128 tolerance. Loudness range works the same way, from a second histogram of short-term loudness.