|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
High-performance brickwall lookahead limiter. More...
#include <Limiter.h>
Public Types | |
| enum class | TruePeakPrecision { Standard , High } |
| enum class | Precision { Standard , High } |
| enum class | HoldMode { Deepest , EveryPeak } |
Public Member Functions | |
| ~Limiter ()=default | |
| void | prepare (double sampleRate, int numChannels=2, double initialLookaheadMs=-1.0) |
| Allocates memory and prepares the limiter for processing. | |
| void | prepare (const AudioSpec &spec) |
| Prepares from AudioSpec (unified API). | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes an AudioBufferView in-place. | |
| T | processSample (T input, int channel) noexcept |
| Processes a single sample of one channel. | |
| void | reset () noexcept |
| Resets the internal state (delays, gain reduction). RT-Safe. | |
| void | setCeiling (T dB) noexcept |
| Sets the absolute output ceiling. | |
| void | setRelease (T ms) noexcept |
| Sets the base release time. | |
| void | setLookahead (T ms) noexcept |
| Sets the lookahead time dynamically. | |
| void | setMaxLookahead (T ms) noexcept |
| Keeps a latency for the lookahead to move inside. | |
| T | getMaxLookahead () const noexcept |
| Latency kept for the lookahead in milliseconds (0: none; see setMaxLookahead()). | |
| void | setTruePeak (bool enabled) noexcept |
| Enables ISP true-peak detection. RT-Safe. | |
| void | setTruePeakPrecision (TruePeakPrecision precision) noexcept |
| Selects the true-peak reading (see TruePeakPrecision). RT-Safe. | |
| TruePeakPrecision | getTruePeakPrecision () const noexcept |
| void | setPrecision (Precision precision) noexcept |
| Selects how finely the gain computer works (see Precision). RT-Safe. | |
| Precision | getPrecision () const noexcept |
| void | setAdaptiveRelease (bool enabled) noexcept |
| Enables program-dependent adaptive release. RT-Safe. The release time grows with how long peaks have been asking for reduction: up to 3x after 200 ms of sustained limiting. | |
| void | setHold (T ms) noexcept |
| Sets how long the reduction is held after the last peak that asked for it, before the release starts. RT-Safe. | |
| T | getHold () const noexcept |
| void | setHoldMode (HoldMode mode) noexcept |
| Selects the hold behaviour (see HoldMode). RT-Safe. | |
| HoldMode | getHoldMode () const noexcept |
| void | setSafetyClip (bool enabled) noexcept |
| Enables the post-limiter soft-knee safety clipper. RT-Safe. | |
| bool | isTruePeakEnabled () const noexcept |
| bool | isAdaptiveReleaseEnabled () const noexcept |
| bool | isSafetyClipEnabled () const noexcept |
| T | getLookahead () const noexcept |
| int | getLatency () const noexcept |
| Reports the processing latency (the lookahead) in samples. | |
| T | getGainReductionDb () const noexcept |
| Current gain reduction in dB (metering). | |
| std::vector< uint8_t > | getState () const |
| Serializes the parameter state (setup/UI threads; allocates). | |
| bool | setState (const uint8_t *data, size_t size) |
| Restores parameters from a blob (tolerant; rejects foreign ids). | |
Protected Types | |
| using | TpEstimator = TruePeakEstimator< T > |
| using | TpAnalyzer = TruePeakAnalyzer< T > |
Protected Member Functions | |
| void | detectTruePeak (const T *x, int n, int ch, T *peak, T *annex, T *slow) noexcept |
| T | alignHighReadings (T samplePeak, T annex, T slow) noexcept |
| void | resetHighAlignment () noexcept |
| void | seedHighTruePeakHistory () noexcept |
| void | seedTruePeakHistory () noexcept |
| int | lookaheadSamplesFor (T ms, bool truePeak, bool highPrecision, bool points) const noexcept |
| void | readPoints (T x, int ch, T *points) noexcept |
| void | seedPointHistory (bool fromDelayLines) noexcept |
| void | applyLookaheadTarget () noexcept |
| int | latencyFor (int lookahead, bool truePeak, bool highPrecision, bool points) const noexcept |
| void | syncKeptLatency () noexcept |
| T | heldGain (int look, int &delay) noexcept |
| void | configureGainComputer () noexcept |
| DSPARK_NOINLINE void | resumBoxes () noexcept |
| DSPARK_NOINLINE void | restartHoldBlock (int64_t firstFrame) noexcept |
| void | resetGainComputer () noexcept |
| void | restartGainComputerAt (double g) noexcept |
| void | advanceGain (T peak, T ceiling, bool adaptive, T relMs) noexcept |
| void | advanceGainPoints (const T *points, T ceiling, bool adaptive, T relMs) noexcept |
| void | stepGain (double required, bool adaptive, T relMs) noexcept |
| void | syncParameters () noexcept |
| void | updateHoldSamples () noexcept |
| void | updateReleaseCoefficient () noexcept |
| T | applySafetyClipper (T out, T clipCeil) const noexcept |
Protected Attributes | |
| TpEstimator | tpEstimator_ |
| Kernel and phase scratch. | |
| std::vector< typename TpEstimator::Channel > | tpChannels_ |
| Per channel history. | |
| std::unique_ptr< TpAnalyzer > | tpAnalyzer_ |
| High-precision kernels and scratch (prepare()). | |
| std::vector< typename TpAnalyzer::Channel > | tpHighChannels_ |
| Per channel history of the high-precision reading. | |
| bool | prepared_ = false |
| double | sampleRate_ = 48000.0 |
| T | invSampleRate_ = T(1.0 / 48000.0) |
| int | numChannels_ = 2 |
| int | lookaheadSamples_ = 96 |
| Audio-side lookahead (consumed from lookaheadMs_). | |
| int | maxLimitSamples_ = 96000 |
| Adaptive-release duration cap (2 s). | |
| std::atomic< T > | ceilingDb_ { T(-0.3) } |
| std::atomic< T > | releaseMs_ { T(100) } |
| std::atomic< T > | holdMs_ { T(10) } |
| std::atomic< T > | lookaheadMs_ { T(2) } |
| std::atomic< bool > | lookaheadDirty_ { false } |
| std::atomic< bool > | truePeakEnabled_ { false } |
| std::atomic< bool > | adaptiveRelease_ { false } |
| std::atomic< bool > | safetyClipEnabled_ { false } |
| SmoothedValue< T > | ceilingSmooth_ |
| T | lastCeilingDb_ = T(-0.3) |
| Change detector for the ceiling pow skip. | |
| T | releaseCoeff_ = T(0) |
| T | lastReleaseMs_ = T(-1) |
| T | lastHoldMs_ = T(-1) |
| int | holdSamples_ = 0 |
| Hold length in samples. | |
| int | maxHoldSamples_ = 2400 |
| Hold length of kMaxHoldMs. | |
| int | counterHold_ = 0 |
| Hold-counter restart value (Deepest mode). | |
| int | holdLeft_ = 0 |
| Hold samples left before the release may act. | |
| int | lastHoldMode_ = 0 |
| Applied HoldMode (0 Deepest, 1 EveryPeak). | |
| std::atomic< int > | holdMode_ { 0 } |
| std::atomic< int > | truePeakPrecision_ { 0 } |
| Published TruePeakPrecision (0 Standard, 1 High). | |
| bool | ispApplied_ = false |
| Detection mode the gain computer is sized for. | |
| bool | tpHighApplied_ = false |
| High-precision reading applied (implies ispApplied_). | |
| std::atomic< int > | precision_ { 0 } |
| Published Precision (0 Standard, 1 High). | |
| bool | pointsApplied_ = false |
| Readings at eight points per sample applied (sample-peak mode). | |
| int | stepsPerSample_ = 1 |
| Steps of the gain computer per sample (1 or kSteps). | |
| double | holdSlack_ = 1.0 |
| Factor of the held reduction a crest restarts the hold within. | |
| T | pointPhase_ [kSteps - 1][kPointTaps] = {} |
| Interpolation phases (prepare()). | |
| T | pointHist_ [kMaxChannels][2 *kPointTaps] = {} |
| Mirrored interpolation history per channel. | |
| int | pointAt_ [kMaxChannels] = {} |
| Next write position in it. | |
| T | chunkPoints_ [kChunk][kSteps] = {} |
| processBlock() points per frame (loudest channel). | |
| T | pendingPoints_ [kSteps] = {} |
| Other channels' points for the next processSample() frame. | |
| T | currentGain_ = T(1) |
| std::atomic< T > | publishedGain_ { T(1) } |
| int | limitingDuration_ = 0 |
| T | lookaheadCurrent_ = T(96) |
| Smoothed read offset (glides on live changes). | |
| int | histSize_ = 0 |
| int | histMask_ = 0 |
| Moving-average histories (lookahead). | |
| int | holdHistSize_ = 0 |
| int | holdMask_ = 0 |
| Required-gain history (lookahead + hold). | |
| std::vector< double > | eHist_ |
| Released envelope history. | |
| std::vector< double > | avgHist_ |
| First moving-average output history. | |
| std::vector< double > | rHist_ |
| Required-gain history. | |
| std::vector< double > | sufMin_ |
| Suffix minima of the last complete hold block (+1 empty). | |
| int | blockPos_ = 0 |
| Position inside the current hold block. | |
| double | prefixMin_ = 1.0 |
| Running minimum of the current hold block. | |
| int64_t | frame_ = 0 |
| double | envelope_ = 1.0 |
| double | sum1_ = 1.0 |
| double | sum2_ = 1.0 |
| int | boxA_ = 1 |
| int | boxB_ = 1 |
| double | invBoxA_ = 1.0 |
| double | invBoxB_ = 1.0 |
| int | holdLen_ = 97 |
| int | sinceResum_ = 0 |
| T | pendingPeak_ = T(0) |
| Other channels' peaks for the next processSample() frame. | |
| T | pendingAnnex_ = T(0) |
| The same for their Annex 2 readings (high precision). | |
| T | pendingSlow_ = T(0) |
| The same for their analyzer readings (high precision). | |
| T | alignSample_ [kAlignRecent] = {} |
| Recent sample peaks. | |
| T | alignAnnex_ [kAlignRecent] = {} |
| Recent Annex 2 readings. | |
| T | alignFast_ [kAlignRing] = {} |
| Fast readings per sample, waiting for the analyzer. | |
| T | alignSlow_ [2] = {} |
| Last two analyzer readings. | |
| int | alignFrame_ = 0 |
| Frame counter modulo kAlignRing. | |
| T | chunkAnnex_ [kChunk] = {} |
| T | chunkSlow_ [kChunk] = {} |
| T | chunkPeak_ [kChunk] = {} |
| T | chunkCeiling_ [kChunk] = {} |
| T | chunkGain_ [kChunk] = {} |
| int | chunkLook_ [kChunk] = {} |
| int | chunkDelay_ [kChunk] = {} |
| Delay of the audio per frame (the lookahead, or the latency kept). | |
| T | sampleCeiling_ = T(0.96605) |
| int | sampleLookNow_ = 96 |
| int | sampleDelayNow_ = 96 |
| Delay of the audio for the frame. | |
| T | sampleGainNow_ = T(1) |
| Gain heard in the frame. | |
| std::atomic< T > | maxLookaheadMs_ { T(0) } |
| Latency kept (0: none). | |
| int | latencySamples_ = 96 |
| Delay the audio is asked to have (audio thread). | |
| T | latencyCurrent_ = T(96) |
| Its smoothed value while kept. | |
| bool | kept_ = false |
| The gain is being held back. | |
| int | gainSpan_ = 0 |
| Length of the gain line. | |
| RingBuffer< T > | gainLine_ |
| Gains waiting for the audio they belong to. | |
| std::vector< RingBuffer< T > > | delayLines_ |
Static Protected Attributes | |
| static constexpr int | kMaxChannels = 16 |
| static constexpr double | kMaxLookaheadMs = 10.0 |
| static constexpr double | kMaxHoldMs = 50.0 |
| static constexpr T | kSafetyClipCeiling = T(0.96605) |
| -0.3 dBFS | |
| static constexpr int | kChunk = 128 |
| static constexpr int | kTpDelay = TpEstimator::getDelay() |
| Samples a reading reaches back. | |
| static constexpr int | kTpMinLookahead = kTpDelay + 16 |
| Leaves at least a 16-sample ramp. | |
| static constexpr int | kTpHighDelay = TpAnalyzer::getDelay() + 1 |
| Samples a high-precision reading reaches back. | |
| static constexpr int | kAnnexWindow = TruePeakDetector<T, 1>::getTaps() |
| Samples one Annex 2 reading is formed from. | |
| static constexpr int | kAlignFast = kTpHighDelay - (kAnnexWindow - 1) |
| Delay of the fast readings. | |
| static constexpr int | kAlignRing = 256 |
| Power of two above kAlignFast. | |
| static constexpr int | kAlignRecent = 16 |
| Power of two holding kAnnexWindow frames. | |
| static constexpr int | kSteps = 8 |
| Steps of the gain computer per sample at Precision::High. | |
| static constexpr int | kPointTaps = 16 |
| Taps of the interpolation. | |
| static constexpr int | kPointDelay = 7 |
| Samples the points reach back. | |
| static constexpr double | kPointBeta = 9.0 |
| Kaiser beta of the interpolation. | |
| static constexpr double | kHoldTolerance = 1.0011520 |
| 0.01 dB: crests that close restart the hold (Precision::High). | |
| static constexpr int | kResumPeriod = 1 << 16 |
High-performance brickwall lookahead limiter.
| T | Sample type (float or double). |
|
protected |
|
protected |
|
strong |
How the hold treats a peak that asks for less reduction than the one being held.
| Enumerator | |
|---|---|
| Deepest | The hold restarts only when a peak pushes the reduction down (or keeps it down); a shallower peak inside the hold is not held after the deeper one expires, so the gain can rise between peaks of unequal height. The default. |
| EveryPeak | Every peak's reduction is held for the hold time after it has passed (an exact sliding minimum over lookahead plus hold). The gain stops rising and falling between unequal peaks: the 60 Hz + 7 kHz intermodulation of a two-tone driven 6 dB over the ceiling falls from -61.7 to -87.1 dBc at the defaults (from -69.4 to -84.3 dBc at 5 ms lookahead, 15 ms hold, 40 ms release). The price is loudness: dense material driven 12 dB over the ceiling comes out 0.45 dB lower at those settings, 0.10 dB at 6 dB over. The required-gain history prepare() allocates spans the lookahead plus the 50 ms maximum hold in either mode (64 KB at 48 kHz). |
|
strong |
How finely the gain computer reads the sample-peak signal.
| Enumerator | |
|---|---|
| Standard | One reading and one step of the gain computer per sample. The default. |
| High | Eight readings per sample from a windowed-sinc interpolation, and the window, hold, release and ramp of the gain computer taking eight steps per sample. See setPrecision(). |
|
strong |
Which reading true-peak mode feeds the sidechain with.
| Enumerator | |
|---|---|
| Standard | The 64-tap reading that answers within 33 samples, taken out of the lookahead: accurate up to 0.45 of the sample rate. The default. |
| High | The reading of TruePeakAnalyzer (an 8x grid from a 512-tap first stage), which also follows content between 0.45 of the sample rate and Nyquist. It reaches 262 samples back and they are added to the latency, so the lookahead is all attack ramp as in sample-peak mode. |
|
default |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
One frame at Precision::High: the eight points' requirements, one step each, in time order; the gain heard is the last step's.
|
inlineprotectednoexcept |
One frame of the high-precision alignment: takes this frame's sample peak, Annex 2 reading and analyzer reading (loudest channel) and returns the peak that concerns the sample kTpHighDelay frames back: its own magnitude, every Annex 2 reading formed from it (the twelve that follow it) and the three analyzer readings around it.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
True-peak readings of n (<= kChunk) samples of channel ch. Standard precision raises peak[i] to the 64-tap estimate and the ITU-R BS.1770 Annex 2 one. High precision raises slow[i] to the analyzer's reading and annex[i] to the Annex 2 one, for alignHighReadings(). The per-sample path calls it with n == 1; every output runs the same arithmetic either way.
|
inlinenoexcept |
Current gain reduction in dB (metering).
Safe from any thread: it loads a published atomic word, so off the audio thread it may be up to one block behind. It used to read currentGain_ directly – a plain word the audio thread writes every sample, read from another thread, which is a data race and not merely an approximate number.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Reports the processing latency (the lookahead) in samples.
Derived from the published lookahead and true-peak parameters, so it is correct immediately after setLookahead() or setTruePeak() from any thread (the audio thread may consume the change one block later; the glide covers the transition). In true-peak mode the lookahead is at least 49 samples (about 1 ms at 48 kHz); with its high-precision reading it is the set lookahead plus 262 samples. With setMaxLookahead() it is the latency kept, while the lookahead stays under it.
|
inlinenoexcept |
|
inlinenoexcept |
Latency kept for the lookahead in milliseconds (0: none; see setMaxLookahead()).
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlineprotectednoexcept |
One frame with a latency kept for the lookahead: glides the delay of the audio towards it (never under the lookahead), stores the gain just computed and returns the one that is heard, older by the difference.
| look | Lookahead of this frame in samples. |
| delay | Receives the delay of the audio for this frame. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprotectednoexcept |
Delay of the audio for a lookahead in samples: the latency kept for it (setMaxLookahead()) when that is longer, the lookahead otherwise. Shared by the audio side and getLatency(), like lookaheadSamplesFor().
|
inlineprotectednoexcept |
Lookahead in samples for a given ms parameter and detection mode (shared by the audio-side recompute and getLatency() so both always agree exactly). The product is capped in double before the int cast (out-of-range casts are UB). True-peak mode needs the estimator's kTpDelay samples plus a ramp of at least 16 samples; its high-precision reading adds its whole reach on top, so the lookahead parameter is all ramp, as in sample-peak mode.
|
inline |
|
inline |
Allocates memory and prepares the limiter for processing.
Invalid arguments are release-safe: a non-positive or non-finite sample rate makes this call a no-op (the previous state, if any, is kept). Configured parameters (ceiling, release, lookahead, toggles) survive re-preparation.
| sampleRate | Sample rate in Hz (must be > 0). |
| numChannels | Number of channels to process (clamped to [1, 16]). |
| initialLookaheadMs | Optional lookahead override in ms; any non-positive or non-finite value (the default) keeps the current lookahead parameter. |
|
inlinenoexcept |
Processes an AudioBufferView in-place.
RT-Safe: Yes. Lock-free and allocation-free.
The gain envelope is linked: the loudest channel drives the reduction applied to all channels. Channels beyond the prepared count pass through untouched (and undelayed).
| buffer | Audio buffer view. |
|
inlinenoexcept |
Processes a single sample of one channel.
The shared state (ceiling smoother, lookahead glide and gain computer) advances on channel 0, so call channel 0 first within each sample frame. For mono streams (channel 0 only) this path is bit-identical to processBlock(). Peaks of the other channels enter the gain computer one frame late; for properly linked multi-channel limiting prefer processBlock().
|
inlineprotectednoexcept |
|
inlinenoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
Sliding minimum (van Herk / Gil-Werman, streaming form): the frames are cut into blocks of holdLen_. Once a block is complete its suffix minima are stored; the window ending at a frame of the next block is then the minimum of one stored suffix and the running prefix of that block. Branch-free per frame, one backward pass per block (amortised O(1)). This stores the suffix minima of the block starting at firstFrame and starts a new block at the following frame.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
Rebuilds the high-precision histories when that reading is switched on mid-stream: the last samples the delay lines hold run through the analyzer and the alignment (the peaks are discarded), so the first readings are not formed from stale history and the samples still waiting in the delay lines keep their sample peaks.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Sets how long the reduction is held after the last peak that asked for it, before the release starts. RT-Safe.
Without a hold the gain recovers between the crests of a low tone and dips again at the next one, and that ripple is distortion: a 50 Hz sine driven 6 dB over the ceiling (5 ms lookahead, 50 ms release) measures -56.8 dB THD+N with no hold and -149.6 dB with the default 10 ms, and 40 Hz goes from -47.4 to -149.7 dB (30 Hz: -38.4 to -84.7); the 60 Hz + 7 kHz intermodulation products fall from -62.4 to -74.2 dB. The price is loudness after isolated peaks: 0.21 dB of integrated loudness on a dense mix driven 12 dB over the ceiling.
| ms | Hold in milliseconds, clamped to [0, 50] (default 10; 0 is the previous release-only behaviour). Non-finite values are ignored. |
|
inlinenoexcept |
|
inlinenoexcept |
Sets the lookahead time dynamically.
| ms | Lookahead in milliseconds (clamped to 0.5 to 10.0 ms). |
|
inlinenoexcept |
Keeps a latency for the lookahead to move inside.
With a maximum set, the audio always waits that long and getLatency() reports it, whatever setLookahead() says below it: the lookahead can then be automated without the host having to align anything again, the gain being held back by the difference. 0 (default) keeps no latency of its own: the latency is the lookahead, as before. A maximum under the lookahead changes nothing. In true-peak mode the maximum is raised like a lookahead of the same length. Set it before playback; a change during playback glides the audio to the new delay at one sample per sample.
State key "maxLookahead" (absent = 0).
| ms | Latency in milliseconds, 0 to 10 (0 turns it off). Non-finite values are ignored. |
|
inlinenoexcept |
Selects how finely the gain computer works (see Precision). RT-Safe.
With High the requirement is read at eight points per sample (a 16-tap Kaiser-windowed sinc gives the seven between the samples) and the sliding minimum, hold, release and the two moving averages run at eight steps per sample; the gain heard is the one at each sample. The corners of the gain then fall where the crests are, not on the sample grid, which is what puts lines that are no harmonics of a tone into the output. A crest within 0.01 dB of the reduction held counts as keeping it down and restarts the hold (the readings of equal crests differ by their interpolation error; in Standard the comparison is exact, and which crest restarts the hold decides when the gain rises). Measured at 48 kHz on a tone 6 dB over a -6 dB ceiling, as the largest line that is no harmonic of it (Standard to High, release 20 and 100 ms, with the default 10 ms hold and without one): 100 Hz -62 to -108 dBc to -145 to -146, 1 kHz -75 to -85 to -117 to -126, 5 kHz -75 to -85 to -123 to -128; the level of the tone moves by 0.03 dB at most. The readings concern the sample 7 frames back: getLatency() is 7 samples longer and the lookahead stays all ramp. Every sample still leaves at or below the ceiling (the eight points include the sample itself). Only acts in sample-peak mode: with setTruePeak() on the true-peak reading feeds the gain computer, one step per sample. A stereo frame costs 105 to 159 ns against 10 to 17 in Standard (by compiler). Switching it during playback moves the latency like a lookahead change and the gain computer continues from the gain in effect. prepare() allocates the gain computer's histories for eight steps per sample whatever the precision (about 0.6 MB at 48 kHz with the 50 ms maximum hold).
State key "precision" (absent = Standard).
| precision | Precision to use; out-of-range values fall back to Standard. |
|
inlinenoexcept |
|
inlinenoexcept |
Enables the post-limiter soft-knee safety clipper. RT-Safe.
Softens the region above -0.3 dBFS up to the ceiling; it only has an effect when the ceiling is set above -0.3 dBFS (below that, the brickwall clamp already keeps the output under the clipper threshold).
|
inline |
|
inlinenoexcept |
Enables ISP true-peak detection. RT-Safe.
The sidechain reads the larger of a 64-tap 4x reconstruction refined to its local maxima and the ITU-R BS.1770 Annex 2 estimate (see the file description for the measured overshoot). A reading reaches 33 samples back, so the attack ramp shortens by 33 samples and the lookahead is raised to at least 49 samples (about 1 ms at 48 kHz); getLatency() reports it. The intermodulation of a limiter follows the length of that ramp: at the 2 ms default (96 samples, 63 of ramp) a 60 Hz + 7 kHz pair reads -59.1 dBc against -61.9 in sample-peak mode (double: -60.5 and -61.5), and setLookahead(2.7), which gives the ramp its 96 samples back for 129 of latency, -64.1 dBc (HoldMode EveryPeak at the default: -99.7 dBc). Detection costs about 12 ns per sample per channel more than sample-peak mode; processSample() runs it one sample at a time and is several times slower per sample than processBlock().
| enabled | true to limit inter-sample peaks. |
|
inlinenoexcept |
Selects the true-peak reading (see TruePeakPrecision). RT-Safe.
Only acts while setTruePeak() is on. With High, getLatency() is the lookahead plus 262 samples (5.5 ms more at 48 kHz) and the 49-sample floor of Standard does not apply. Every reading is held back until the slowest one of its sample has arrived, so none turns the gain down early: where both precisions read the same the output is as loud as in Standard or louder (a dense mix driven 12 dB over the ceiling, 0.05 dB), and where Standard reads low High is quieter by what Standard let through (white noise 0.25 dB); the file description gives the overshoot of both. The intermodulation is that of sample-peak mode at the same lookahead (60 Hz + 7 kHz at the default: -63.0 dBc, double -58.9, against -61.9 and -61.5). A frame costs 2.1 to 2.7 times what it costs in Standard, by compiler, and prepare() allocates its kernels (5 KB in float, 10 KB in double) and 6 KB (11 KB) of history per channel whether or not it is used. Switching it during playback moves the latency like a lookahead change; the reading's histories are rebuilt from the delay lines, so the output afterwards is that of a limiter that had it on all along.
| precision | Reading to use; out-of-range values fall back to Standard. |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
Engages the held-back gain when a latency longer than the lookahead is asked for, and lets go of it once the audio has glided back (audio thread). On engaging, the gain line starts full of the gain that is sounding and the audio glides out from the lookahead.
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
inlineprotectednoexcept |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
processBlock() points per frame (loudest channel).
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
protected |
|
staticconstexprprotected |
0.01 dB: crests that close restart the hold (Precision::High).
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
Steps of the gain computer per sample at Precision::High.
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Other channels' peaks for the next processSample() frame.
|
protected |
Other channels' points for the next processSample() frame.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Cross-thread metering readout of currentGain_: published once per processBlock() and once per processSample() call. processSample() is the per-sample entry point, so there the store does run once per sample – what it never does is sit inside processBlock()'s own sample loop.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |