DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::Clipper< T > Class Template Reference

Real-time audio clipper with analog modeling and anti-aliasing features. More...

#include <Clipper.h>

Collaboration diagram for dspark::Clipper< T >:

Classes

struct  AdaaStage
 

Public Types

enum class  Mode { Hard , Soft , Analog , GoldenRatio }
 Defines the harmonic waveshaping algorithm used for clipping. More...
 
enum class  OversamplingMode { LinearPhase , MinimumPhase }
 How the oversampler filters (see setOversamplingMode()). More...
 
using OversamplingBand = typename Oversampling< T >::Band
 The band the oversampler's first stage keeps (see setOversamplingBand()).
 

Public Member Functions

void prepare (const AudioSpec &spec)
 Prepares the clipper for processing, allocating any necessary internal buffers.
 
void reset () noexcept
 Resets the internal state of the clipper.
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes an audio buffer in-place through the clipping algorithm.
 
void setMode (Mode mode) noexcept
 Sets the clipping algorithm.
 
void setCeiling (T dB) noexcept
 Sets the absolute maximum output level.
 
void setInputGain (T dB) noexcept
 Sets the input drive/gain before clipping.
 
void setStages (int count) noexcept
 Sets the number of cascaded clipping stages.
 
void setMix (T amount) noexcept
 Sets the dry/wet ratio of the processor.
 
void setSlewLimit (T ms) noexcept
 Enables slew limiting to soften clipping edges.
 
void setOversampling (int factor) noexcept
 Sets the oversampling multiplier to mitigate aliasing.
 
void setAutomaticOversampling (bool on) noexcept
 Lets the host rate choose the factor (applied by the next prepare(), as setOversampling()).
 
bool isOversamplingAutomatic () const noexcept
 Whether the factor follows the host rate (setAutomaticOversampling()).
 
void setOversamplingMode (OversamplingMode mode) noexcept
 Chooses the oversampler's filters (applied by the next prepare()).
 
OversamplingMode getOversamplingMode () const noexcept
 The oversampler's filters (setOversamplingMode()).
 
void setOversamplingBand (OversamplingBand band) noexcept
 Chooses the band the oversampler's first stage keeps (applied by the next prepare()).
 
OversamplingBand getOversamplingBand () const noexcept
 The band of the oversampler's first stage (setOversamplingBand()).
 
Mode getMode () const noexcept
 
T getCeiling () const noexcept
 
T getInputGain () const noexcept
 
int getStages () const noexcept
 
T getMix () const noexcept
 
T getSlewLimit () const noexcept
 
int getOversampling () const noexcept
 Returns the published oversampling factor (applied on the next prepare()).
 
void setAntialiasing (bool on) noexcept
 Enables second-order antiderivative antialiasing on every mode.
 
bool getAntialiasing () const noexcept
 Whether second-order antialiasing is enabled.
 
int getLatency () const noexcept
 Latency in samples: oversampling filters plus, when enabled, the antialiasing delay.
 
T getGainReductionDb () const noexcept
 Retrieves the maximum gain reduction applied during the last block (for UI 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. Oversampling factor applies on the next prepare() as usual.
 

Protected Member Functions

void processInternal (AudioBufferView< T > &buffer, double currentSampleRate) noexcept
 Core DSP routing. Resolves atomics and branches to the per-mode template.
 
int adaaBaseLatency () const noexcept
 
void resetAntialiasState () noexcept
 
void pushDryAligned (AudioBufferView< T > buffer, int extra) noexcept
 
template<class Curve >
void dispatchAntialiased (AudioBufferView< T > &buffer, int numStages, T slewScale) noexcept
 Second-order antialiased per-mode loop. Works in units of the ceiling: each stage maps u -> curve(u) with u = stage gain times the previous stage's output. Every stage delays by one processing sample; a pad brings the total to factor * adaaBaseLatency() samples for any stage count.
 
void snapParameters () noexcept
 
template<Mode M>
void dispatchClipping (AudioBufferView< T > &buffer, int numStages, T slewScale) noexcept
 Per-mode processing loop (waveshaper inlined at compile time; the slew state and peak metering keep the loop serial per channel).
 

Static Protected Member Functions

static T stageGainFor (T totalGainLin, int numStages) noexcept
 
template<Mode M>
static T processSample (T sample, T ceiling) noexcept
 Compile-time resolution of the waveshaping math.
 
static T dbToLinear (T dB) noexcept
 
static T gainToDecibels (T linear, T minusInfinityDb) noexcept
 

Protected Attributes

AudioSpec spec_ {}
 
std::atomic< bool > prepared_ { false }
 
DryWetMixer< T > mixer_
 
std::unique_ptr< Oversampling< T > > oversampler_
 
std::atomic< Mode > mode_ { Mode::Hard }
 
std::atomic< T > ceilingDb_ { T(0) }
 
std::atomic< T > inputGainDb_ { T(0) }
 
std::atomic< int > stages_ { 1 }
 
std::atomic< T > mix_ { T(1) }
 
std::atomic< T > slewLimitMs_ { T(0) }
 
std::atomic< int > osFactor_ { 1 }
 
std::atomic< bool > osAutomatic_ { false }
 The factor follows the host rate.
 
std::atomic< OversamplingMode > osMode_ { OversamplingMode::LinearPhase }
 setOversamplingMode().
 
std::atomic< OversamplingBand > osBand_ { OversamplingBand::Preset }
 setOversamplingBand().
 
OversamplingDryPath< T > dryPath_
 The dry copy through minimum-phase filters.
 
bool dryThroughFilters_ = false
 The dry copy crosses the filters (minimum phase).
 
T slewPrev_ [kMaxChannels] {}
 
SmoothedValue< T > stageGainSm_
 
SmoothedValue< T > ceilingSm_
 
int lastStages_ = 1
 Stage count the stage-gain glide refers to.
 
std::array< T, kChunk > gainRamp_ {}
 
std::array< T, kChunk > ceilRamp_ {}
 
std::atomic< T > gainReductionDb_ { T(0) }
 
std::atomic< bool > antialias_ { false }
 
bool adaaActive_ = false
 antialias_ as applied (audio thread).
 
bool adaaFresh_ = true
 Seed the stage history on the next block.
 
Mode adaaMode_ = Mode::Hard
 Curve the cached values belong to.
 
int adaaStageCount_ = 1
 
int processFactor_ = 1
 Oversampling factor in use.
 
std::array< std::array< AdaaStage, kMaxStages >, kMaxChannels > adaaStages_ {}
 
std::array< std::array< double, kPadRing >, kMaxChannels > padRing_ {}
 
int padPos_ = 0
 
std::array< std::array< T, kMaxStages >, kMaxChannels > dryRing_ {}
 Dry delay, <= 4 samples.
 
int dryPos_ = 0
 
AudioBuffer< T > dryScratch_
 

Static Protected Attributes

static constexpr int kMaxStages = 4
 
static constexpr int kMaxChannels = 16
 
static constexpr T kPhi = static_cast<T>(1.6180339887498948482)
 Mathematical Golden Ratio used for the GoldenRatio soft-knee transition.
 
static constexpr double kAutomaticInternalRate = 88200.0
 Rate the automatic factor reaches.
 
static constexpr double kParamRampMs = 20.0
 
static constexpr int kChunk = 256
 
static constexpr int kPadRing = 32
 

‍largest pad (16 * 1 - 1).


 

Detailed Description

template<FloatType T>
class dspark::Clipper< T >

Real-time audio clipper with analog modeling and anti-aliasing features.

Template Parameters
TSample type (must satisfy dspark::FloatType, typically float or double).

Definition at line 91 of file Clipper.h.

Member Typedef Documentation

◆ OversamplingBand

template<FloatType T>
using dspark::Clipper< T >::OversamplingBand = typename Oversampling<T>::Band

The band the oversampler's first stage keeps (see setOversamplingBand()).

Definition at line 388 of file Clipper.h.

Member Enumeration Documentation

◆ Mode

template<FloatType T>
enum class dspark::Clipper::Mode
strong

Defines the harmonic waveshaping algorithm used for clipping.

Enumerator
Hard 

Brickwall digital clipping. High odd harmonics.

Soft 

Tanh soft clipping. Even/odd blend, tape-like.

Analog 

Sine-based soft clipping. Transformer-like saturation.

GoldenRatio 

Mathematical soft-knee using phi. Extremely transparent until heavy drive.

Definition at line 95 of file Clipper.h.

◆ OversamplingMode

template<FloatType T>
enum class dspark::Clipper::OversamplingMode
strong

How the oversampler filters (see setOversamplingMode()).

Enumerator
LinearPhase 

Linear-phase half-bands: the latency of the factor, the dry path a delay (default).

MinimumPhase 

Elliptic allpass half-bands: a few samples of latency, the dry path through the same filters.

Definition at line 363 of file Clipper.h.

Member Function Documentation

◆ adaaBaseLatency()

template<FloatType T>
int dspark::Clipper< T >::adaaBaseLatency ( ) const
inlineprotectednoexcept

Antialiasing delay in base samples: kMaxStages processing samples, rounded up to whole base samples.

Definition at line 550 of file Clipper.h.

◆ dbToLinear()

template<FloatType T>
static T dspark::Clipper< T >::dbToLinear ( T  dB)
inlinestaticprotectednoexcept

Definition at line 846 of file Clipper.h.

◆ dispatchAntialiased()

template<FloatType T>
template<class Curve >
void dspark::Clipper< T >::dispatchAntialiased ( AudioBufferView< T > &  buffer,
int  numStages,
T  slewScale 
)
inlineprotectednoexcept

Second-order antialiased per-mode loop. Works in units of the ceiling: each stage maps u -> curve(u) with u = stage gain times the previous stage's output. Every stage delays by one processing sample; a pad brings the total to factor * adaaBaseLatency() samples for any stage count.

Definition at line 616 of file Clipper.h.

◆ dispatchClipping()

template<FloatType T>
template<Mode M>
void dspark::Clipper< T >::dispatchClipping ( AudioBufferView< T > &  buffer,
int  numStages,
T  slewScale 
)
inlineprotectednoexcept

Per-mode processing loop (waveshaper inlined at compile time; the slew state and peak metering keep the loop serial per channel).

Definition at line 760 of file Clipper.h.

◆ gainToDecibels()

template<FloatType T>
static T dspark::Clipper< T >::gainToDecibels ( T  linear,
T  minusInfinityDb 
)
inlinestaticprotectednoexcept

Definition at line 847 of file Clipper.h.

◆ getAntialiasing()

template<FloatType T>
bool dspark::Clipper< T >::getAntialiasing ( ) const
inlinenoexcept

Whether second-order antialiasing is enabled.

Definition at line 432 of file Clipper.h.

◆ getCeiling()

template<FloatType T>
T dspark::Clipper< T >::getCeiling ( ) const
inlinenoexcept

Definition at line 412 of file Clipper.h.

◆ getGainReductionDb()

template<FloatType T>
T dspark::Clipper< T >::getGainReductionDb ( ) const
inlinenoexcept

Retrieves the maximum gain reduction applied during the last block (for UI metering).

Definition at line 443 of file Clipper.h.

◆ getInputGain()

template<FloatType T>
T dspark::Clipper< T >::getInputGain ( ) const
inlinenoexcept

Definition at line 413 of file Clipper.h.

◆ getLatency()

template<FloatType T>
int dspark::Clipper< T >::getLatency ( ) const
inlinenoexcept

Latency in samples: oversampling filters plus, when enabled, the antialiasing delay.

Definition at line 436 of file Clipper.h.

◆ getMix()

template<FloatType T>
T dspark::Clipper< T >::getMix ( ) const
inlinenoexcept

Definition at line 415 of file Clipper.h.

◆ getMode()

template<FloatType T>
Mode dspark::Clipper< T >::getMode ( ) const
inlinenoexcept

Definition at line 411 of file Clipper.h.

◆ getOversampling()

template<FloatType T>
int dspark::Clipper< T >::getOversampling ( ) const
inlinenoexcept

Returns the published oversampling factor (applied on the next prepare()).

Definition at line 419 of file Clipper.h.

◆ getOversamplingBand()

template<FloatType T>
OversamplingBand dspark::Clipper< T >::getOversamplingBand ( ) const
inlinenoexcept

The band of the oversampler's first stage (setOversamplingBand()).

Definition at line 409 of file Clipper.h.

◆ getOversamplingMode()

template<FloatType T>
OversamplingMode dspark::Clipper< T >::getOversamplingMode ( ) const
inlinenoexcept

The oversampler's filters (setOversamplingMode()).

Definition at line 385 of file Clipper.h.

◆ getSlewLimit()

template<FloatType T>
T dspark::Clipper< T >::getSlewLimit ( ) const
inlinenoexcept

Definition at line 416 of file Clipper.h.

◆ getStages()

template<FloatType T>
int dspark::Clipper< T >::getStages ( ) const
inlinenoexcept

Definition at line 414 of file Clipper.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::Clipper< T >::getState ( ) const
inline

Serializes the parameter state (setup/UI threads; allocates).

Definition at line 447 of file Clipper.h.

◆ isOversamplingAutomatic()

template<FloatType T>
bool dspark::Clipper< T >::isOversamplingAutomatic ( ) const
inlinenoexcept

Whether the factor follows the host rate (setAutomaticOversampling()).

Definition at line 360 of file Clipper.h.

◆ prepare()

template<FloatType T>
void dspark::Clipper< T >::prepare ( const AudioSpec &  spec)
inline

Prepares the clipper for processing, allocating any necessary internal buffers.

If oversampling is configured > 1x, this method allocates the oversampling filters. Call it from the main/setup thread before playback begins (never concurrently with processBlock), and again whenever the sample rate changes.

Invalid specs (non-positive/non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through.

Parameters
specThe current audio environment specifications (sample rate, max block size).

Definition at line 118 of file Clipper.h.

◆ processBlock()

template<FloatType T>
void dspark::Clipper< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes an audio buffer in-place through the clipping algorithm.

Handles dry/wet mixing, upsampling, processing, and downsampling transparently. Pass-through until prepare() succeeds.

Parameters
bufferView of the audio data to process.

Definition at line 206 of file Clipper.h.

◆ processInternal()

template<FloatType T>
void dspark::Clipper< T >::processInternal ( AudioBufferView< T > &  buffer,
double  currentSampleRate 
)
inlineprotectednoexcept

Core DSP routing. Resolves atomics and branches to the per-mode template.

Definition at line 494 of file Clipper.h.

◆ processSample()

template<FloatType T>
template<Mode M>
static T dspark::Clipper< T >::processSample ( T  sample,
T  ceiling 
)
inlinestaticprotectednoexcept

Compile-time resolution of the waveshaping math.

Definition at line 833 of file Clipper.h.

◆ pushDryAligned()

template<FloatType T>
void dspark::Clipper< T >::pushDryAligned ( AudioBufferView< T >  buffer,
int  extra 
)
inlineprotectednoexcept

Captures the dry signal, delayed by extra base samples when the antialiasing delay is active. The short per-channel ring is updated either way, so enabling it starts from real history.

Definition at line 571 of file Clipper.h.

◆ reset()

template<FloatType T>
void dspark::Clipper< T >::reset ( )
inlinenoexcept

Resets the internal state of the clipper.

Clears history buffers, slew limiter states, and oversampling memory. Useful when stopping/starting transport or flushing tails.

Definition at line 184 of file Clipper.h.

◆ resetAntialiasState()

template<FloatType T>
void dspark::Clipper< T >::resetAntialiasState ( )
inlineprotectednoexcept

Definition at line 556 of file Clipper.h.

◆ setAntialiasing()

template<FloatType T>
void dspark::Clipper< T >::setAntialiasing ( bool  on)
inlinenoexcept

Enables second-order antiderivative antialiasing on every mode.

Off by default. Any thread; applied from the next block. Adds ceil(4 / oversampling factor) base samples of latency (reported by getLatency() immediately) and the passband droop described in the file documentation, so pair it with oversampling.

Definition at line 429 of file Clipper.h.

◆ setAutomaticOversampling()

template<FloatType T>
void dspark::Clipper< T >::setAutomaticOversampling ( bool  on)
inlinenoexcept

Lets the host rate choose the factor (applied by the next prepare(), as setOversampling()).

With it on, every prepare() takes the smallest factor that brings the clipper to an internal rate of at least 88.2 kHz: 2x at 44.1 and 48 kHz and none from 88.2 kHz up. The nonlinearity then runs at about the same rate whatever the session rate, and a high-rate session stops paying for a factor it does not need. Off by default; an explicit setOversampling() turns it off.

Parameters
onTrue to choose the factor from the rate.

Definition at line 357 of file Clipper.h.

◆ setCeiling()

template<FloatType T>
void dspark::Clipper< T >::setCeiling ( T  dB)
inlinenoexcept

Sets the absolute maximum output level.

Parameters
dBCeiling level in decibels Full Scale (dBFS). Clamped between -60 and 0; non-finite values are ignored.

Definition at line 265 of file Clipper.h.

◆ setInputGain()

template<FloatType T>
void dspark::Clipper< T >::setInputGain ( T  dB)
inlinenoexcept

Sets the input drive/gain before clipping.

Parameters
dBGain applied to the input signal in dB. Clamped between 0 and 48; non-finite values are ignored.

Definition at line 276 of file Clipper.h.

◆ setMix()

template<FloatType T>
void dspark::Clipper< T >::setMix ( T  amount)
inlinenoexcept

Sets the dry/wet ratio of the processor.

Parameters
amountLinear ratio where 0.0 is entirely dry and 1.0 is fully processed. Non-finite values are ignored.

Definition at line 301 of file Clipper.h.

◆ setMode()

template<FloatType T>
void dspark::Clipper< T >::setMode ( Mode  mode)
inlinenoexcept

Sets the clipping algorithm.

Parameters
modeThe desired waveshaping Mode (out-of-range values are clamped).

Definition at line 253 of file Clipper.h.

◆ setOversampling()

template<FloatType T>
void dspark::Clipper< T >::setOversampling ( int  factor)
inlinenoexcept

Sets the oversampling multiplier to mitigate aliasing.

Values are rounded UP to the next power of two and capped at 16. At 16x every decimation stage is at least 100 dB deep (Oversampling::Depth::Deep; 95 samples of latency, 73 at 8x): a hard clip at +24 dB with antialiasing aliases at -115 dBc there (-95 with the preset's stages).

Note
Changing this requires a subsequent call to prepare() to allocate filters.
Parameters
factorOversampling ratio (1 = off, 2, 4, 8, 16).

Definition at line 337 of file Clipper.h.

◆ setOversamplingBand()

template<FloatType T>
void dspark::Clipper< T >::setOversamplingBand ( OversamplingBand  band)
inlinenoexcept

Chooses the band the oversampler's first stage keeps (applied by the next prepare()).

Preset, the default, keeps the band up to 0.46 of the host rate at every rate. Audible keeps it up to 20 kHz and stops everything from the image of 20 kHz up, to the same depth: the stage is fitted to the host rate and is shorter the higher the rate (see Oversampling::Band). At 2x the linear-phase latency goes from 64 samples to 56 at 44.1 kHz, 32 at 48 kHz and 10 at 96 kHz. What is given up lies over 20 kHz.

Parameters
bandPreset (default) or Audible.

Definition at line 403 of file Clipper.h.

◆ setOversamplingMode()

template<FloatType T>
void dspark::Clipper< T >::setOversamplingMode ( OversamplingMode  mode)
inlinenoexcept

Chooses the oversampler's filters (applied by the next prepare()).

MinimumPhase runs polyphase allpass half-bands: a few samples of latency instead of the factor's linear-phase latency, and a phase that bends toward the band edge, which the dry copy follows through the same filters so a partial mix does not comb-filter.

Parameters
modeLinearPhase (default) or MinimumPhase.

Definition at line 379 of file Clipper.h.

◆ setSlewLimit()

template<FloatType T>
void dspark::Clipper< T >::setSlewLimit ( T  ms)
inlinenoexcept

Enables slew limiting to soften clipping edges.

Limits how fast the output can change over time. Defined in milliseconds, so the effect stays consistent regardless of the sample rate or oversampling factor. Note that a slew limiter is itself nonlinear: it darkens the transient edges and top octave rather than strictly removing aliasing (use oversampling for that).

Parameters
msRise time in milliseconds to reach the ceiling from zero. 0 = off; non-finite values are ignored.

Definition at line 319 of file Clipper.h.

◆ setStages()

template<FloatType T>
void dspark::Clipper< T >::setStages ( int  count)
inlinenoexcept

Sets the number of cascaded clipping stages.

Multi-stage clipping distributes the input gain logarithmically across multiple clipping algorithms. This alters the harmonic profile, making heavy distortion sound smoother compared to a single aggressive stage.

Parameters
countNumber of stages. Clamped between 1 and 4.

Definition at line 291 of file Clipper.h.

◆ setState()

template<FloatType T>
bool dspark::Clipper< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores parameters from a blob. Oversampling factor applies on the next prepare() as usual.

Definition at line 466 of file Clipper.h.

◆ snapParameters()

template<FloatType T>
void dspark::Clipper< T >::snapParameters ( )
inlineprotectednoexcept

Jumps both parameter glides to the current targets (prepare/reset).

Definition at line 747 of file Clipper.h.

◆ stageGainFor()

template<FloatType T>
static T dspark::Clipper< T >::stageGainFor ( T  totalGainLin,
int  numStages 
)
inlinestaticprotectednoexcept

Gain per stage: the total split logarithmically across the cascade.

Definition at line 740 of file Clipper.h.

Member Data Documentation

◆ adaaActive_

template<FloatType T>
bool dspark::Clipper< T >::adaaActive_ = false
protected

antialias_ as applied (audio thread).

Definition at line 895 of file Clipper.h.

◆ adaaFresh_

template<FloatType T>
bool dspark::Clipper< T >::adaaFresh_ = true
protected

Seed the stage history on the next block.

Definition at line 896 of file Clipper.h.

◆ adaaMode_

template<FloatType T>
Mode dspark::Clipper< T >::adaaMode_ = Mode::Hard
protected

Curve the cached values belong to.

Definition at line 897 of file Clipper.h.

◆ adaaStageCount_

template<FloatType T>
int dspark::Clipper< T >::adaaStageCount_ = 1
protected

Definition at line 898 of file Clipper.h.

◆ adaaStages_

template<FloatType T>
std::array<std::array<AdaaStage, kMaxStages>, kMaxChannels> dspark::Clipper< T >::adaaStages_ {}
protected

Definition at line 900 of file Clipper.h.

◆ antialias_

template<FloatType T>
std::atomic<bool> dspark::Clipper< T >::antialias_ { false }
protected

Definition at line 894 of file Clipper.h.

◆ ceilingDb_

template<FloatType T>
std::atomic<T> dspark::Clipper< T >::ceilingDb_ { T(0) }
protected

Definition at line 859 of file Clipper.h.

◆ ceilingSm_

template<FloatType T>
SmoothedValue<T> dspark::Clipper< T >::ceilingSm_
protected

Definition at line 879 of file Clipper.h.

◆ ceilRamp_

template<FloatType T>
std::array<T, kChunk> dspark::Clipper< T >::ceilRamp_ {}
protected

Definition at line 882 of file Clipper.h.

◆ dryPath_

template<FloatType T>
OversamplingDryPath<T> dspark::Clipper< T >::dryPath_
protected

The dry copy through minimum-phase filters.

Definition at line 868 of file Clipper.h.

◆ dryPos_

template<FloatType T>
int dspark::Clipper< T >::dryPos_ = 0
protected

Definition at line 904 of file Clipper.h.

◆ dryRing_

template<FloatType T>
std::array<std::array<T, kMaxStages>, kMaxChannels> dspark::Clipper< T >::dryRing_ {}
protected

Dry delay, <= 4 samples.

Definition at line 903 of file Clipper.h.

◆ dryScratch_

template<FloatType T>
AudioBuffer<T> dspark::Clipper< T >::dryScratch_
protected

Definition at line 905 of file Clipper.h.

◆ dryThroughFilters_

template<FloatType T>
bool dspark::Clipper< T >::dryThroughFilters_ = false
protected

The dry copy crosses the filters (minimum phase).

Definition at line 869 of file Clipper.h.

◆ gainRamp_

template<FloatType T>
std::array<T, kChunk> dspark::Clipper< T >::gainRamp_ {}
protected

Definition at line 881 of file Clipper.h.

◆ gainReductionDb_

template<FloatType T>
std::atomic<T> dspark::Clipper< T >::gainReductionDb_ { T(0) }
protected

Definition at line 885 of file Clipper.h.

◆ inputGainDb_

template<FloatType T>
std::atomic<T> dspark::Clipper< T >::inputGainDb_ { T(0) }
protected

Definition at line 860 of file Clipper.h.

◆ kAutomaticInternalRate

template<FloatType T>
constexpr double dspark::Clipper< T >::kAutomaticInternalRate = 88200.0
staticconstexprprotected

Rate the automatic factor reaches.

Definition at line 870 of file Clipper.h.

◆ kChunk

template<FloatType T>
constexpr int dspark::Clipper< T >::kChunk = 256
staticconstexprprotected

Definition at line 877 of file Clipper.h.

◆ kMaxChannels

template<FloatType T>
constexpr int dspark::Clipper< T >::kMaxChannels = 16
staticconstexprprotected

Definition at line 486 of file Clipper.h.

◆ kMaxStages

template<FloatType T>
constexpr int dspark::Clipper< T >::kMaxStages = 4
staticconstexprprotected

Definition at line 485 of file Clipper.h.

◆ kPadRing

template<FloatType T>
constexpr int dspark::Clipper< T >::kPadRing = 32
staticconstexprprotected

‍largest pad (16 * 1 - 1).

Definition at line 893 of file Clipper.h.

◆ kParamRampMs

template<FloatType T>
constexpr double dspark::Clipper< T >::kParamRampMs = 20.0
staticconstexprprotected

Definition at line 876 of file Clipper.h.

◆ kPhi

template<FloatType T>
constexpr T dspark::Clipper< T >::kPhi = static_cast<T>(1.6180339887498948482)
staticconstexprprotected

Mathematical Golden Ratio used for the GoldenRatio soft-knee transition.

Definition at line 489 of file Clipper.h.

◆ lastStages_

template<FloatType T>
int dspark::Clipper< T >::lastStages_ = 1
protected

Stage count the stage-gain glide refers to.

Definition at line 880 of file Clipper.h.

◆ mix_

template<FloatType T>
std::atomic<T> dspark::Clipper< T >::mix_ { T(1) }
protected

Definition at line 862 of file Clipper.h.

◆ mixer_

template<FloatType T>
DryWetMixer<T> dspark::Clipper< T >::mixer_
protected

Definition at line 854 of file Clipper.h.

◆ mode_

template<FloatType T>
std::atomic<Mode> dspark::Clipper< T >::mode_ { Mode::Hard }
protected

Definition at line 858 of file Clipper.h.

◆ osAutomatic_

template<FloatType T>
std::atomic<bool> dspark::Clipper< T >::osAutomatic_ { false }
protected

The factor follows the host rate.

Definition at line 865 of file Clipper.h.

◆ osBand_

template<FloatType T>
std::atomic<OversamplingBand> dspark::Clipper< T >::osBand_ { OversamplingBand::Preset }
protected

setOversamplingBand().

Definition at line 867 of file Clipper.h.

◆ osFactor_

template<FloatType T>
std::atomic<int> dspark::Clipper< T >::osFactor_ { 1 }
protected

Definition at line 864 of file Clipper.h.

◆ osMode_

template<FloatType T>
std::atomic<OversamplingMode> dspark::Clipper< T >::osMode_ { OversamplingMode::LinearPhase }
protected

setOversamplingMode().

Definition at line 866 of file Clipper.h.

◆ oversampler_

template<FloatType T>
std::unique_ptr<Oversampling<T> > dspark::Clipper< T >::oversampler_
protected

Definition at line 855 of file Clipper.h.

◆ padPos_

template<FloatType T>
int dspark::Clipper< T >::padPos_ = 0
protected

Definition at line 902 of file Clipper.h.

◆ padRing_

template<FloatType T>
std::array<std::array<double, kPadRing>, kMaxChannels> dspark::Clipper< T >::padRing_ {}
protected

Definition at line 901 of file Clipper.h.

◆ prepared_

template<FloatType T>
std::atomic<bool> dspark::Clipper< T >::prepared_ { false }
protected

Definition at line 853 of file Clipper.h.

◆ processFactor_

template<FloatType T>
int dspark::Clipper< T >::processFactor_ = 1
protected

Oversampling factor in use.

Definition at line 899 of file Clipper.h.

◆ slewLimitMs_

template<FloatType T>
std::atomic<T> dspark::Clipper< T >::slewLimitMs_ { T(0) }
protected

Definition at line 863 of file Clipper.h.

◆ slewPrev_

template<FloatType T>
T dspark::Clipper< T >::slewPrev_[kMaxChannels] {}
protected

Definition at line 873 of file Clipper.h.

◆ spec_

template<FloatType T>
AudioSpec dspark::Clipper< T >::spec_ {}
protected

Definition at line 852 of file Clipper.h.

◆ stageGainSm_

template<FloatType T>
SmoothedValue<T> dspark::Clipper< T >::stageGainSm_
protected

Definition at line 878 of file Clipper.h.

◆ stages_

template<FloatType T>
std::atomic<int> dspark::Clipper< T >::stages_ { 1 }
protected

Definition at line 861 of file Clipper.h.


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