DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::TruePeakDetector< T, MaxChannels > Class Template Reference

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.
 
processSample (T sample, int channel) noexcept
 Feeds one sample and returns the local true-peak estimate.
 

Static Public Member Functions

static constexpr int getLatency () noexcept
 Group delay of the interpolation FIR in samples (per phase).
 

Detailed Description

template<FloatType T, int MaxChannels = 16>
class dspark::TruePeakDetector< T, MaxChannels >

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).

Template Parameters
TSample type (float or double).
MaxChannelsNumber of independent channel histories.

Definition at line 47 of file TruePeakDetector.h.

Member Function Documentation

◆ getLatency()

template<FloatType T, int MaxChannels = 16>
static constexpr int dspark::TruePeakDetector< T, MaxChannels >::getLatency ( )
inlinestaticconstexprnoexcept

Group delay of the interpolation FIR in samples (per phase).

Definition at line 101 of file TruePeakDetector.h.

◆ processSample()

template<FloatType T, int MaxChannels = 16>
T dspark::TruePeakDetector< T, MaxChannels >::processSample ( sample,
int  channel 
)
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).

Parameters
sampleInput sample.
channelChannel index (0-based; clamped into range).
Returns
True-peak magnitude (>= |sample|).

Definition at line 68 of file TruePeakDetector.h.

◆ reset()

template<FloatType T, int MaxChannels = 16>
void dspark::TruePeakDetector< T, MaxChannels >::reset ( )
inlinenoexcept

Clears all channel histories. Safe on the audio thread.

Definition at line 51 of file TruePeakDetector.h.


The documentation for this class was generated from the following file: