|
TracktionEngine
|
A real-time-safe stereo field analyser: phase correlation, stereo balance and stereo width, over a short sliding window and over the whole measurement. More...
#include <tracktion_StereoFieldAnalyser.h>
Classes | |
| struct | Readings |
| A snapshot of the analyser's current readings. More... | |
Public Member Functions | |
| StereoFieldAnalyser ()=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 analysis block if it's at least half full, so a file's tail contributes to the measurement. | |
| void | requestReset () noexcept |
| Asks for the measurement, window history and held extremes to be restarted. | |
| Readings | getReadings () const noexcept |
| Returns the current readings. | |
A real-time-safe stereo field analyser: phase correlation, stereo balance and stereo width, over a short sliding window and over the whole measurement.
Everything is derived from running sums of l*l, r*r and l*r, updated on the same 100ms block cadence as LoudnessMeter's gating blocks with a 400ms sliding window for the "current" readings. For buffers with more than two channels, the first pair is measured (standard correlation-meter practice); for mono, the single channel is treated as both sides, so the readings describe a perfectly centred signal.
Real-time contract (identical to LoudnessMeter):
|
default |
| void engine::StereoFieldAnalyser::prepare | ( | double | sampleRate, |
| int | numChannels, | ||
| int | maxBlockSize | ||
| ) |
Allocates for the given format and resets the measurement.
Must be called before process(), and never whilst processing. Only the first two channels are analysed, but it's fine to prepare and feed wider buffers.
| maxBlockSize | accepted for signature parity with LoudnessMeter::prepare - the analyser has no per-block working buffers, so any block length may be passed to process() |
|
noexcept |
Processes a block of audio, updating the published readings.
Real-time safe: no allocation, no locks. The block can be any length.
|
noexcept |
Processes a block of audio from raw channel pointers.
|
noexcept |
For offline use: finishes a partially-filled analysis block if it's at least half full, so a file's tail contributes to the measurement.
Call this after the last process() call, not during streaming.
|
noexcept |
Asks for the measurement, window history and held extremes to be restarted.
Picked up by the processing thread at the start of its next block, so this never blocks.
|
noexcept |
Returns the current readings.
Lock-free, callable from any thread.