|
DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
|
Per-channel 4x-oversampled inter-sample peak estimator. More...
#include <TruePeakDetector.h>
Public Member Functions | |
| void | reset () noexcept |
| Clears all channel histories. Safe on the audio thread. | |
| T | processSample (T sample, int channel) noexcept |
| Feeds one sample and returns the local true-peak estimate. | |
| T | getTailPeak (int channel) const noexcept |
| Measures the zero-extended interpolation tail of one channel. Evaluates getTaps()-1 zero frames on a stack copy of that channel's state. Does not advance or clear live history. Call from the stream owner, not concurrently with processing/reset. Allocation-free and bounded work. Returns only the tail peak; combine with the maximum already observed. | |
Static Public Member Functions | |
| static constexpr int | getLatency () noexcept |
| Group delay of the interpolation FIR in samples (per phase). | |
| static constexpr int | getTaps () noexcept |
| Input samples one estimate is computed from (taps per phase). | |
Per-channel 4x-oversampled inter-sample peak estimator.
Real-time safe: the polyphase coefficients are compile-time constants and processing is a fixed 48-multiply routine per sample. The reading is the maximum of the four official interpolation phases and the raw |sample| (the raw sample can only pull the estimate toward the true analog peak, never above it).
| T | Sample type (float or double). |
| MaxChannels | Number of independent channel histories. |
Definition at line 47 of file TruePeakDetector.h.
|
inlinestaticconstexprnoexcept |
Group delay of the interpolation FIR in samples (per phase).
Definition at line 96 of file TruePeakDetector.h.
|
inlinenoexcept |
Measures the zero-extended interpolation tail of one channel. Evaluates getTaps()-1 zero frames on a stack copy of that channel's state. Does not advance or clear live history. Call from the stream owner, not concurrently with processing/reset. Allocation-free and bounded work. Returns only the tail peak; combine with the maximum already observed.
Definition at line 84 of file TruePeakDetector.h.
|
inlinestaticconstexprnoexcept |
Input samples one estimate is computed from (taps per phase).
The reading returned for sample n was formed from x[n-getTaps()+1] .. x[n]. A caller that wants to change a reported peak has to change all of them: a gain applied to only part of that span does not scale the estimate by that gain.
Definition at line 106 of file TruePeakDetector.h.
|
inlinenoexcept |
Feeds one sample and returns the local true-peak estimate.
The result is the maximum of |sample| and the absolute values of the four official Annex 2 interpolation phases evaluated at this position (together they tile the 4x-oversampled reconstruction grid).
| sample | Input sample. |
| channel | Channel index (0-based; clamped into range). |
Definition at line 68 of file TruePeakDetector.h.
|
inlinenoexcept |
Clears all channel histories. Safe on the audio thread.
Definition at line 51 of file TruePeakDetector.h.