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

Professional multi-algorithm saturation processor with analog simulation. More...

#include <Saturation.h>

Collaboration diagram for dspark::Saturation< SampleType >:

Classes

struct  Params
 

Public Types

enum class  Algorithm {
  Tube , Tape , Transformer , SoftClip ,
  HardClip , Exciter , Wavefolder , Bitcrusher ,
  Downsample , MultiStage
}
 Defines the harmonic generation topology. More...
 
enum class  ProcessingMode { Stereo , MidOnly , SideOnly , MidSide }
 Determines how the stereo field is processed. More...
 
enum class  OutputMode { Normal , WetOnly , Delta }
 Determines the final output signal routing. More...
 

Public Member Functions

 Saturation ()
 
 ~Saturation ()=default
 
 Saturation (const Saturation &)=delete
 
Saturation & operator= (const Saturation &)=delete
 
void prepare (const AudioSpec &spec)
 Prepares all internal resources, filters, and buffers.
 
void reset () noexcept
 Clears all internal states, phase memory, and history buffers.
 
void process (AudioBufferView< SampleType > buffer) noexcept
 Compatibility alias of processBlock(), with the same thread and preparation contract. Prefer processBlock() in new code.
 
void processBlock (AudioBufferView< SampleType > buffer) noexcept
 Processes an audio block in-place (AudioProcessor standard contract).
 
void setAlgorithm (Algorithm algo)
 Sets the saturation algorithm topology.
 
void setDrive (SampleType dB)
 Sets the input drive gain.
 
void setMix (SampleType mix01)
 Sets the global Dry/Wet blend.
 
void setCharacter (SampleType c)
 Adjusts the specific character/bias of the selected algorithm.
 
void setProcessingMode (ProcessingMode m)
 Sets the routing configuration for multi-channel processing.
 
void setOutputMode (OutputMode m)
 Sets the output signal path.
 
void setAnalogDrift (SampleType i)
 Injects true-stereo pseudo-random low-frequency modulation (drift) into the saturation drive.
 
void setPreFilterHpFrequency (SampleType hz)
 Configures a pre-saturation high-pass filter.
 
void setOutputGain (SampleType dB)
 Sets the post-saturation make-up or trim gain.
 
void setDcBlocking (bool on)
 Enables or disables the fixed 10Hz DC Blocker.
 
void setAdaptiveBlend (bool on) noexcept
 Enables program-dependent saturation density.
 
void setAntialiasing (bool on) noexcept
 Enables antiderivative anti-aliasing (ADAA) on the memoryless curves (SoftClip / Tube / HardClip), which suppresses the aliasing the nonlinearity generates. Best combined with oversampling (ADAA + OS is the cleanest, per Parker/Zavalishin DAFx-16 and Bilbao et al. 2017). Off by default.
 
void setSlewSensitivity (SampleType amount) noexcept
 Sets a derivative-based (slew rate) saturation multiplier.
 
void setPostFilterTilt (SampleType centerHz, SampleType amountDb)
 Configures a post-saturation first-order tilt EQ.
 
void setOversampling (int factor)
 Configures internal polyphase oversampling to reduce aliasing.
 
int getOversamplingFactor () const noexcept
 Retrieves the current oversampling factor.
 
int getLatency () const noexcept
 Reports the processor's algorithmic latency in samples.
 
int getLatencySamples () const noexcept
 Compatibility alias of getLatency(), in prepared-rate samples.
 
Algorithm getCurrentAlgorithm () const noexcept
 Retrieves the currently active underlying algorithm.
 
SampleType getGainReductionDb () const noexcept
 Calculates the peak gain reduction (clipping amount) for 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 (setup/UI threads: it forwards the stored oversampling factor to setOversampling, which may allocate). Out-of-range enum values from foreign or corrupt blobs are clamped.
 

Protected Member Functions

template<typename Fn >
void pushParam (Fn &&mutate)
 
void handleParameterChanges ()
 
void applyParamSnapshot (const Params &p)
 
void processSaturationPipeline (AudioBufferView< SampleType > buffer) noexcept
 
void applyAdaptiveBlend (AudioBufferView< SampleType > buffer) noexcept
 Program-dependent dry/wet density blend (base rate, L/R domain). The dry reference is the DryWetMixer capture, which carries the same latency compensation as the wet path - no comb filtering.
 
void dispatchSaturator (detail::SaturationAlgorithm< SampleType > *baseAlgo, AudioBufferView< SampleType > buffer, bool useDrift) noexcept
 
template<typename ExactAlgo >
void processCore (ExactAlgo *algo, AudioBufferView< SampleType > buffer, bool useDrift) noexcept
 
void applyOutputGain (AudioBufferView< SampleType > buffer) noexcept
 

Static Protected Member Functions

static void sanitizeParams (Params &p, const Params &prev) noexcept
 

Protected Attributes

AudioSpec spec_ {}
 
bool prepared_ = false
 
std::array< std::unique_ptr< detail::SaturationAlgorithm< SampleType > >, kNumAlgorithms > pool_
 
std::atomic< detail::SaturationAlgorithm< SampleType > * > active_ { nullptr }
 
std::atomic< detail::SaturationAlgorithm< SampleType > * > next_ { nullptr }
 
SpscQueue< Params > paramQueue_
 
Params lastParams_
 
SpinLock paramsLock_
 
std::atomic< bool > paramsPending_ { false }
 
std::atomic< bool > antialiasShadow_ { false }
 Mirror for getState.
 
ProcessingMode procMode_ = ProcessingMode::Stereo
 
OutputMode outputMode_ = OutputMode::Normal
 
bool dcBlockingEnabled_ = true
 
std::atomic< Algorithm > currentAlgoType_ { Algorithm::SoftClip }
 
Smoothers::StateVariableSmoother driveSmoother_
 
Smoothers::StateVariableSmoother preHpSmoother_
 
Smoothers::StateVariableSmoother postTiltFreqSmoother_
 
Smoothers::LinearSmoother mixSmoother_
 
Smoothers::LinearSmoother characterSmoother_
 
Smoothers::LinearSmoother driftSmoother_
 
Smoothers::LinearSmoother outputGainSmoother_
 
Smoothers::LinearSmoother postTiltGainSmoother_
 
Smoothers::LinearSmoother crossfader_
 
Biquad< SampleType > preFilter_
 
Biquad< SampleType > postFilter_
 
DCBlocker< SampleType > dcBlocker_
 
DryWetMixer< SampleType > dryWetMixer_
 
AnalogRandom::Generator< SampleType > leftDrift_
 
AnalogRandom::Generator< SampleType > rightDrift_
 
AudioBuffer< SampleType > tempBuffer_
 
AudioBuffer< SampleType > driftBuffer_
 
AudioBuffer< SampleType > msKeepBuffer_
 MidOnly/SideOnly channel snapshot.
 
std::unique_ptr< Oversampling< SampleType > > oversampler_
 
int oversamplingFactor_ = 2
 2x by default: the curves alias at 1x (see setOversampling()).
 
std::atomic< SampleType > gainReductionDb_ { SampleType(0) }
 
std::atomic< bool > adaptiveBlend_ { false }
 
std::array< SampleType, kMaxCh > prevBlendSample_ {}
 
std::atomic< SampleType > slewSensitivity_ { SampleType(0) }
 
std::array< SampleType, kMaxCh > prevSlewSample_ {}
 
float lastPreHpFreq_ = -1.0f
 
float lastPostTiltFreq_ = -1.0f
 
float lastPostTiltGain_ = std::numeric_limits<float>::quiet_NaN()
 

Static Protected Attributes

static constexpr int kNumAlgorithms = 10
 
static constexpr int kMaxCh = 16
 

Detailed Description

template<typename SampleType>
class dspark::Saturation< SampleType >

Professional multi-algorithm saturation processor with analog simulation.

This class provides a high-quality saturation pipeline featuring 10 distinct algorithms ranging from soft clipping to complex magnetic tape and transformer modeling. Zero latency at 1x; with oversampling enabled the latency equals the oversampler group delay (see getLatency()).

Channel handling: the saturation stage processes up to 16 channels and no more than the prepared spec's channel count; any further channels in the incoming view pass through the linear stages (filters, gain, mix) only.

Template Parameters
SampleTypeThe floating-point precision to use (must be float or double).

Definition at line 609 of file Saturation.h.

Member Enumeration Documentation

◆ Algorithm

template<typename SampleType >
enum class dspark::Saturation::Algorithm
strong

Defines the harmonic generation topology.

Enumerator
Tube 

Asymmetric triode emulation. Dominant 2nd harmonic, compresses negative excursions.

Tape 

Anhysteretic Langevin magnetisation (tape under AC bias) with dynamic head-bump and HF roll-off.

Transformer 

Core saturation model. LF saturates before HF.

SoftClip 

Symmetric Tanh curve. Odd harmonics only (3rd, 5th, 7th).

HardClip 

Digital hard-clipping. Extreme odd harmonics, highly aliasing without oversampling.

Exciter 

Polynomial waveshaper designed to synthesize high-frequency harmonic content.

Wavefolder 

First-order ADAA (Antiderivative Anti-Aliasing) sine wavefolder.

Bitcrusher 

Quantization noise generator with TPDF dithering.

Downsample 

Sample-and-hold rate reduction with anti-aliasing pre-filtering.

MultiStage 

Serial cascade: Tube -> Tape -> Transformer. Gain-staged internally.

Definition at line 620 of file Saturation.h.

◆ OutputMode

template<typename SampleType >
enum class dspark::Saturation::OutputMode
strong

Determines the final output signal routing.

Enumerator
Normal 
WetOnly 
Delta 

Definition at line 638 of file Saturation.h.

◆ ProcessingMode

template<typename SampleType >
enum class dspark::Saturation::ProcessingMode
strong

Determines how the stereo field is processed.

Enumerator
Stereo 
MidOnly 
SideOnly 
MidSide 

Definition at line 635 of file Saturation.h.

Constructor & Destructor Documentation

◆ Saturation() [1/2]

template<typename SampleType >
dspark::Saturation< SampleType >::Saturation ( )
inline

Definition at line 642 of file Saturation.h.

◆ ~Saturation()

template<typename SampleType >
dspark::Saturation< SampleType >::~Saturation ( )
default

◆ Saturation() [2/2]

template<typename SampleType >
dspark::Saturation< SampleType >::Saturation ( const Saturation< SampleType > &  )
delete

Member Function Documentation

◆ applyAdaptiveBlend()

template<typename SampleType >
void dspark::Saturation< SampleType >::applyAdaptiveBlend ( AudioBufferView< SampleType >  buffer)
inlineprotectednoexcept

Program-dependent dry/wet density blend (base rate, L/R domain). The dry reference is the DryWetMixer capture, which carries the same latency compensation as the wet path - no comb filtering.

Definition at line 1469 of file Saturation.h.

◆ applyOutputGain()

template<typename SampleType >
void dspark::Saturation< SampleType >::applyOutputGain ( AudioBufferView< SampleType >  buffer)
inlineprotectednoexcept

Definition at line 1534 of file Saturation.h.

◆ applyParamSnapshot()

template<typename SampleType >
void dspark::Saturation< SampleType >::applyParamSnapshot ( const Params &  p)
inlineprotected

Definition at line 1275 of file Saturation.h.

◆ dispatchSaturator()

template<typename SampleType >
void dspark::Saturation< SampleType >::dispatchSaturator ( detail::SaturationAlgorithm< SampleType > *  baseAlgo,
AudioBufferView< SampleType >  buffer,
bool  useDrift 
)
inlineprotectednoexcept

Definition at line 1493 of file Saturation.h.

◆ getCurrentAlgorithm()

template<typename SampleType >
Algorithm dspark::Saturation< SampleType >::getCurrentAlgorithm ( ) const
inlinenoexcept

Retrieves the currently active underlying algorithm.

Note
Real-Time Safe reading via relaxed atomics.
Returns
The active Algorithm enum.

Definition at line 1128 of file Saturation.h.

◆ getGainReductionDb()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::getGainReductionDb ( ) const
inlinenoexcept

Calculates the peak gain reduction (clipping amount) for metering.

Note
Real-Time Safe reading via relaxed atomics.
Returns
Gain reduction in decibels (always <= 0.0).

Definition at line 1135 of file Saturation.h.

◆ getLatency()

template<typename SampleType >
int dspark::Saturation< SampleType >::getLatency ( ) const
inlinenoexcept

Reports the processor's algorithmic latency in samples.

Note
Equals the oversampler group delay (0 when oversampling is off). Report this to the host for plugin delay compensation (PDC).

Definition at line 1115 of file Saturation.h.

◆ getLatencySamples()

template<typename SampleType >
int dspark::Saturation< SampleType >::getLatencySamples ( ) const
inlinenoexcept

Compatibility alias of getLatency(), in prepared-rate samples.

Definition at line 1121 of file Saturation.h.

◆ getOversamplingFactor()

template<typename SampleType >
int dspark::Saturation< SampleType >::getOversamplingFactor ( ) const
inlinenoexcept

Retrieves the current oversampling factor.

Returns
Multiplier (1, 2, 4, 8, 16).

Definition at line 1108 of file Saturation.h.

◆ getState()

template<typename SampleType >
std::vector< uint8_t > dspark::Saturation< SampleType >::getState ( ) const
inline

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

Definition at line 1139 of file Saturation.h.

◆ handleParameterChanges()

template<typename SampleType >
void dspark::Saturation< SampleType >::handleParameterChanges ( )
inlineprotected

Definition at line 1257 of file Saturation.h.

◆ operator=()

template<typename SampleType >
Saturation & dspark::Saturation< SampleType >::operator= ( const Saturation< SampleType > &  )
delete

◆ prepare()

template<typename SampleType >
void dspark::Saturation< SampleType >::prepare ( const AudioSpec &  spec)
inline

Prepares all internal resources, filters, and buffers.

Note
NOT Real-Time Safe. This method performs memory allocations (std::vector::resize) and filter coefficient calculations. It must be called from the main/setup thread before audio processing begins.
Parameters
specThe audio environment specifications (sample rate, max block size, channels). An invalid spec (non-positive or NaN fields) is ignored and the previous state is kept.

Definition at line 674 of file Saturation.h.

◆ process()

template<typename SampleType >
void dspark::Saturation< SampleType >::process ( AudioBufferView< SampleType >  buffer)
inlinenoexcept

Compatibility alias of processBlock(), with the same thread and preparation contract. Prefer processBlock() in new code.

Parameters
bufferMutable view of the audio data.

Definition at line 781 of file Saturation.h.

◆ processBlock()

template<typename SampleType >
void dspark::Saturation< SampleType >::processBlock ( AudioBufferView< SampleType >  buffer)
inlinenoexcept

Processes an audio block in-place (AudioProcessor standard contract).

Executes the following sequence: parameter updates (lock-free) -> Mid/Side Encoding -> Pre-filtering -> Slew detection -> Drift generation -> Saturation -> Adaptive Blend -> Mid/Side Decoding -> Post-filtering -> DC Blocking -> Dry/Wet Mix.

Note
Real-Time Safe. Call this inside your audio callback.
Pass-through until prepare() succeeds.
Parameters
bufferMutable view of the audio data. Will be modified in-place.

Definition at line 795 of file Saturation.h.

◆ processCore()

template<typename SampleType >
template<typename ExactAlgo >
void dspark::Saturation< SampleType >::processCore ( ExactAlgo *  algo,
AudioBufferView< SampleType >  buffer,
bool  useDrift 
)
inlineprotectednoexcept

Definition at line 1512 of file Saturation.h.

◆ processSaturationPipeline()

template<typename SampleType >
void dspark::Saturation< SampleType >::processSaturationPipeline ( AudioBufferView< SampleType >  buffer)
inlineprotectednoexcept

Definition at line 1340 of file Saturation.h.

◆ pushParam()

template<typename SampleType >
template<typename Fn >
void dspark::Saturation< SampleType >::pushParam ( Fn &&  mutate)
inlineprotected

Definition at line 1241 of file Saturation.h.

◆ reset()

template<typename SampleType >
void dspark::Saturation< SampleType >::reset ( )
inlinenoexcept

Clears all internal states, phase memory, and history buffers.

Note
Real-Time Safe. Can be called safely from the audio thread to prevent clicks when the transport stops or loops.

Definition at line 739 of file Saturation.h.

◆ sanitizeParams()

template<typename SampleType >
static void dspark::Saturation< SampleType >::sanitizeParams ( Params &  p,
const Params &  prev 
)
inlinestaticprotectednoexcept

Keeps every snapshot the audio thread can ever see well-formed: NaN/Inf from the GUI reverts to the previous value (setter-with-NaN == ignored, the framework-wide policy - without this the smoothers and filter designs are poisoned permanently), and enum fields are clamped so a cast-from-int caller or a corrupt state blob can never index outside pool_. Also keeps lastParams_ finite for getState().

Definition at line 1215 of file Saturation.h.

◆ setAdaptiveBlend()

template<typename SampleType >
void dspark::Saturation< SampleType >::setAdaptiveBlend ( bool  on)
inlinenoexcept

Enables program-dependent saturation density.

Note
Thread-Safe. Uses memory_order_relaxed atomic assignment.
Parameters
onTrue to enable adaptive dynamic blending.

Definition at line 1013 of file Saturation.h.

◆ setAlgorithm()

template<typename SampleType >
void dspark::Saturation< SampleType >::setAlgorithm ( Algorithm  algo)
inline

Sets the saturation algorithm topology.

Note
Thread-Safe. Changes are crossfaded internally over 10ms to prevent clicks.
Parameters
algoThe desired algorithm (e.g., Algorithm::Tube).

Definition at line 936 of file Saturation.h.

◆ setAnalogDrift()

template<typename SampleType >
void dspark::Saturation< SampleType >::setAnalogDrift ( SampleType  i)
inline

Injects true-stereo pseudo-random low-frequency modulation (drift) into the saturation drive.

Note
Thread-Safe. Smoothed internally over 500ms.
Parameters
iIntensity of the drift. Range: [0.0, 1.0].

Definition at line 985 of file Saturation.h.

◆ setAntialiasing()

template<typename SampleType >
void dspark::Saturation< SampleType >::setAntialiasing ( bool  on)
inlinenoexcept

Enables antiderivative anti-aliasing (ADAA) on the memoryless curves (SoftClip / Tube / HardClip), which suppresses the aliasing the nonlinearity generates. Best combined with oversampling (ADAA + OS is the cleanest, per Parker/Zavalishin DAFx-16 and Bilbao et al. 2017). Off by default.

Note
Thread-Safe.
First-order ADAA shifts the wet signal by half a sample. With a partial dry/wet mix this causes a very slight HF comb (< 0.2 dB below 10 kHz at 48 kHz) - inherent to the technique and far smaller than the aliasing it removes.

Definition at line 1026 of file Saturation.h.

◆ setCharacter()

template<typename SampleType >
void dspark::Saturation< SampleType >::setCharacter ( SampleType  c)
inline

Adjusts the specific character/bias of the selected algorithm.

Behavior varies per algorithm:

  • Tube: Controls waveform asymmetry.
  • Tape: Controls the magnetic coupling (knee hardness and mid-level bloom).
  • Transformer: Adjusts bias voltage.
  • Wavefolder: Biases the fold point (asymmetry, even harmonics).
Note
Thread-Safe. Smoothed internally over 20ms.
Parameters
cCharacter amount. Range: [-1.0, 1.0]. 0.0 represents the neutral state.

Definition at line 964 of file Saturation.h.

◆ setDcBlocking()

template<typename SampleType >
void dspark::Saturation< SampleType >::setDcBlocking ( bool  on)
inline

Enables or disables the fixed 10Hz DC Blocker.

Note
Thread-Safe.
Parameters
onTrue to enable DC blocking (default).

Definition at line 1006 of file Saturation.h.

◆ setDrive()

template<typename SampleType >
void dspark::Saturation< SampleType >::setDrive ( SampleType  dB)
inline

Sets the input drive gain.

Note
Thread-Safe. Smoothed internally over 20ms.
Parameters
dBDrive level in decibels. Range: [-24.0, +48.0]. 0 dB = unity gain.

Definition at line 943 of file Saturation.h.

◆ setMix()

template<typename SampleType >
void dspark::Saturation< SampleType >::setMix ( SampleType  mix01)
inline

Sets the global Dry/Wet blend.

Note
Thread-Safe. Smoothed internally over 20ms.
Parameters
mix01Mix ratio. Range: [0.0 (fully dry), 1.0 (fully wet)].

Definition at line 950 of file Saturation.h.

◆ setOutputGain()

template<typename SampleType >
void dspark::Saturation< SampleType >::setOutputGain ( SampleType  dB)
inline

Sets the post-saturation make-up or trim gain.

Note
Thread-Safe. Smoothed internally over 20ms.
Parameters
dBGain in decibels.

Definition at line 999 of file Saturation.h.

◆ setOutputMode()

template<typename SampleType >
void dspark::Saturation< SampleType >::setOutputMode ( OutputMode  m)
inline

Sets the output signal path.

Note
Thread-Safe.
Parameters
mThe output mode (Normal, WetOnly, Delta). Delta mode outputs ONLY the generated harmonics.

Definition at line 978 of file Saturation.h.

◆ setOversampling()

template<typename SampleType >
void dspark::Saturation< SampleType >::setOversampling ( int  factor)
inline

Configures internal polyphase oversampling to reduce aliasing.

Note
NOT Real-Time Safe. Must be called before prepare(), or prepare() must be called immediately after.
Parameters
factorThe oversampling multiplier. Must be a power of 2 (1, 2, 4, 8, 16). 1 = Off. Default 2: at 1x the curves fold their harmonics back into the band - a 10.1 kHz tone at -6 dBFS through the default SoftClip left an alias at 17.7 kHz only 34 dB down (46 dB with ADAA); at 2x it measures 124 dB down, for the oversampler's latency (64 samples at 48 kHz, reported by getLatency()).

Definition at line 1073 of file Saturation.h.

◆ setPostFilterTilt()

template<typename SampleType >
void dspark::Saturation< SampleType >::setPostFilterTilt ( SampleType  centerHz,
SampleType  amountDb 
)
inline

Configures a post-saturation first-order tilt EQ.

Tilts the spectrum around the pivot: -amountDb/2 at DC, unity at the pivot, +amountDb/2 at Nyquist (total span = amountDb). Positive values brighten the signal; negative values darken it.

Note
Thread-Safe. Both parameters smoothed internally over 30ms.
Parameters
centerHzPivot frequency in Hertz. Range: [100.0, Nyquist].
amountDbTotal tilt span in decibels. Range: [-12.0, 12.0].

Definition at line 1055 of file Saturation.h.

◆ setPreFilterHpFrequency()

template<typename SampleType >
void dspark::Saturation< SampleType >::setPreFilterHpFrequency ( SampleType  hz)
inline

Configures a pre-saturation high-pass filter.

Note
Thread-Safe. Smoothed internally over 30ms.
Parameters
hzCutoff frequency in Hertz. Range: [10.0, Nyquist].

Definition at line 992 of file Saturation.h.

◆ setProcessingMode()

template<typename SampleType >
void dspark::Saturation< SampleType >::setProcessingMode ( ProcessingMode  m)
inline

Sets the routing configuration for multi-channel processing.

Note
Thread-Safe. Applies instantly on the next block.
Parameters
mThe processing mode (Stereo, MidOnly, SideOnly, MidSide).

Definition at line 971 of file Saturation.h.

◆ setSlewSensitivity()

template<typename SampleType >
void dspark::Saturation< SampleType >::setSlewSensitivity ( SampleType  amount)
inlinenoexcept

Sets a derivative-based (slew rate) saturation multiplier.

Note
Thread-Safe. Uses memory_order_relaxed atomic assignment. Non-finite values are ignored.
Parameters
amountSensitivity multiplier. Range: [0.0 (off), 1.0 (max)].

Definition at line 1038 of file Saturation.h.

◆ setState()

template<typename SampleType >
bool dspark::Saturation< SampleType >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores parameters from a blob (setup/UI threads: it forwards the stored oversampling factor to setOversampling, which may allocate). Out-of-range enum values from foreign or corrupt blobs are clamped.

Definition at line 1169 of file Saturation.h.

Member Data Documentation

◆ active_

template<typename SampleType >
std::atomic<detail::SaturationAlgorithm<SampleType>*> dspark::Saturation< SampleType >::active_ { nullptr }
protected

Definition at line 1558 of file Saturation.h.

◆ adaptiveBlend_

template<typename SampleType >
std::atomic<bool> dspark::Saturation< SampleType >::adaptiveBlend_ { false }
protected

Definition at line 1596 of file Saturation.h.

◆ antialiasShadow_

template<typename SampleType >
std::atomic<bool> dspark::Saturation< SampleType >::antialiasShadow_ { false }
protected

Mirror for getState.

Definition at line 1565 of file Saturation.h.

◆ characterSmoother_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::characterSmoother_
protected

Definition at line 1573 of file Saturation.h.

◆ crossfader_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::crossfader_
protected

Definition at line 1575 of file Saturation.h.

◆ currentAlgoType_

template<typename SampleType >
std::atomic<Algorithm> dspark::Saturation< SampleType >::currentAlgoType_ { Algorithm::SoftClip }
protected

Definition at line 1570 of file Saturation.h.

◆ dcBlocker_

template<typename SampleType >
DCBlocker<SampleType> dspark::Saturation< SampleType >::dcBlocker_
protected

Definition at line 1582 of file Saturation.h.

◆ dcBlockingEnabled_

template<typename SampleType >
bool dspark::Saturation< SampleType >::dcBlockingEnabled_ = true
protected

Definition at line 1569 of file Saturation.h.

◆ driftBuffer_

template<typename SampleType >
AudioBuffer<SampleType> dspark::Saturation< SampleType >::driftBuffer_
protected

Definition at line 1588 of file Saturation.h.

◆ driftSmoother_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::driftSmoother_
protected

Definition at line 1573 of file Saturation.h.

◆ driveSmoother_

template<typename SampleType >
Smoothers::StateVariableSmoother dspark::Saturation< SampleType >::driveSmoother_
protected

Definition at line 1572 of file Saturation.h.

◆ dryWetMixer_

template<typename SampleType >
DryWetMixer<SampleType> dspark::Saturation< SampleType >::dryWetMixer_
protected

Definition at line 1583 of file Saturation.h.

◆ gainReductionDb_

template<typename SampleType >
std::atomic<SampleType> dspark::Saturation< SampleType >::gainReductionDb_ { SampleType(0) }
protected

Definition at line 1594 of file Saturation.h.

◆ kMaxCh

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kMaxCh = 16
staticconstexprprotected

Definition at line 1597 of file Saturation.h.

◆ kNumAlgorithms

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kNumAlgorithms = 10
staticconstexprprotected

Definition at line 1556 of file Saturation.h.

◆ lastParams_

template<typename SampleType >
Params dspark::Saturation< SampleType >::lastParams_
protected

Definition at line 1562 of file Saturation.h.

◆ lastPostTiltFreq_

template<typename SampleType >
float dspark::Saturation< SampleType >::lastPostTiltFreq_ = -1.0f
protected

Definition at line 1604 of file Saturation.h.

◆ lastPostTiltGain_

template<typename SampleType >
float dspark::Saturation< SampleType >::lastPostTiltGain_ = std::numeric_limits<float>::quiet_NaN()
protected

Definition at line 1605 of file Saturation.h.

◆ lastPreHpFreq_

template<typename SampleType >
float dspark::Saturation< SampleType >::lastPreHpFreq_ = -1.0f
protected

Definition at line 1603 of file Saturation.h.

◆ leftDrift_

template<typename SampleType >
AnalogRandom::Generator<SampleType> dspark::Saturation< SampleType >::leftDrift_
protected

Definition at line 1585 of file Saturation.h.

◆ mixSmoother_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::mixSmoother_
protected

Definition at line 1573 of file Saturation.h.

◆ msKeepBuffer_

template<typename SampleType >
AudioBuffer<SampleType> dspark::Saturation< SampleType >::msKeepBuffer_
protected

MidOnly/SideOnly channel snapshot.

Definition at line 1589 of file Saturation.h.

◆ next_

template<typename SampleType >
std::atomic<detail::SaturationAlgorithm<SampleType>*> dspark::Saturation< SampleType >::next_ { nullptr }
protected

Definition at line 1559 of file Saturation.h.

◆ outputGainSmoother_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::outputGainSmoother_
protected

Definition at line 1574 of file Saturation.h.

◆ outputMode_

template<typename SampleType >
OutputMode dspark::Saturation< SampleType >::outputMode_ = OutputMode::Normal
protected

Definition at line 1568 of file Saturation.h.

◆ oversampler_

template<typename SampleType >
std::unique_ptr<Oversampling<SampleType> > dspark::Saturation< SampleType >::oversampler_
protected

Definition at line 1591 of file Saturation.h.

◆ oversamplingFactor_

template<typename SampleType >
int dspark::Saturation< SampleType >::oversamplingFactor_ = 2
protected

2x by default: the curves alias at 1x (see setOversampling()).

Definition at line 1592 of file Saturation.h.

◆ paramQueue_

template<typename SampleType >
SpscQueue<Params> dspark::Saturation< SampleType >::paramQueue_
protected

Definition at line 1561 of file Saturation.h.

◆ paramsLock_

template<typename SampleType >
SpinLock dspark::Saturation< SampleType >::paramsLock_
mutableprotected

Definition at line 1563 of file Saturation.h.

◆ paramsPending_

template<typename SampleType >
std::atomic<bool> dspark::Saturation< SampleType >::paramsPending_ { false }
protected

Definition at line 1564 of file Saturation.h.

◆ pool_

template<typename SampleType >
std::array<std::unique_ptr<detail::SaturationAlgorithm<SampleType> >, kNumAlgorithms> dspark::Saturation< SampleType >::pool_
protected

Definition at line 1557 of file Saturation.h.

◆ postFilter_

template<typename SampleType >
Biquad<SampleType> dspark::Saturation< SampleType >::postFilter_
protected

Definition at line 1577 of file Saturation.h.

◆ postTiltFreqSmoother_

template<typename SampleType >
Smoothers::StateVariableSmoother dspark::Saturation< SampleType >::postTiltFreqSmoother_
protected

Definition at line 1572 of file Saturation.h.

◆ postTiltGainSmoother_

template<typename SampleType >
Smoothers::LinearSmoother dspark::Saturation< SampleType >::postTiltGainSmoother_
protected

Definition at line 1574 of file Saturation.h.

◆ preFilter_

template<typename SampleType >
Biquad<SampleType> dspark::Saturation< SampleType >::preFilter_
protected

Definition at line 1577 of file Saturation.h.

◆ preHpSmoother_

template<typename SampleType >
Smoothers::StateVariableSmoother dspark::Saturation< SampleType >::preHpSmoother_
protected

Definition at line 1572 of file Saturation.h.

◆ prepared_

template<typename SampleType >
bool dspark::Saturation< SampleType >::prepared_ = false
protected

Definition at line 1554 of file Saturation.h.

◆ prevBlendSample_

template<typename SampleType >
std::array<SampleType, kMaxCh> dspark::Saturation< SampleType >::prevBlendSample_ {}
protected

Definition at line 1598 of file Saturation.h.

◆ prevSlewSample_

template<typename SampleType >
std::array<SampleType, kMaxCh> dspark::Saturation< SampleType >::prevSlewSample_ {}
protected

Definition at line 1601 of file Saturation.h.

◆ procMode_

template<typename SampleType >
ProcessingMode dspark::Saturation< SampleType >::procMode_ = ProcessingMode::Stereo
protected

Definition at line 1567 of file Saturation.h.

◆ rightDrift_

template<typename SampleType >
AnalogRandom::Generator<SampleType> dspark::Saturation< SampleType >::rightDrift_
protected

Definition at line 1585 of file Saturation.h.

◆ slewSensitivity_

template<typename SampleType >
std::atomic<SampleType> dspark::Saturation< SampleType >::slewSensitivity_ { SampleType(0) }
protected

Definition at line 1600 of file Saturation.h.

◆ spec_

template<typename SampleType >
AudioSpec dspark::Saturation< SampleType >::spec_ {}
protected

Definition at line 1553 of file Saturation.h.

◆ tempBuffer_

template<typename SampleType >
AudioBuffer<SampleType> dspark::Saturation< SampleType >::tempBuffer_
protected

Definition at line 1587 of file Saturation.h.


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