DSPark 1.9.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 , Curve
}
 Defines the harmonic generation topology. More...
 
enum class  CurveBase {
  Tanh , Algebraic , Arctangent , Erf ,
  Cubic , Valve , Rectifier
}
 How the oversampler filters (see setOversamplingMode()). More...
 
enum class  OversamplingMode { LinearPhase , MinimumPhase }
 
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...
 
enum class  Antialiasing { Off , FirstOrder , SecondOrder }
 Antiderivative antialiasing order (see setAntialiasing()). More...
 
using OversamplingBand = typename Oversampling< SampleType >::Band
 The band the oversampler's first stage keeps (see setOversamplingBand()).
 

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 5 Hz DC blocker.
 
void setAdaptiveBlend (bool on) noexcept
 Enables program-dependent saturation density.
 
void setAntialiasing (bool on) noexcept
 Enables first-order antiderivative anti-aliasing (ADAA) on the memoryless curves (SoftClip / Tube / HardClip): true selects Antialiasing::FirstOrder, false Off. Best combined with oversampling (Parker/Zavalishin DAFx-16, Bilbao et al. 2017). Off by default.
 
void setAntialiasing (Antialiasing mode) noexcept
 Selects the antialiasing order (see Antialiasing). Any thread; SecondOrder changes getLatency() at once and the audio from the next block, so notify the host. Out-of-range values are clamped.
 
Antialiasing getAntialiasing () const noexcept
 The selected antialiasing order.
 
void setTone (int section, SampleType hz, SampleType gainDb) noexcept
 A section of the tone after the curve: 0 a low shelf (100 Hz by default), 1 and 2 bells of Q 0.7 (500 Hz and 2.5 kHz), 3 a high shelf (8 kHz). At 0 dB a section is out of the path and costs nothing; it comes in, moves and goes out over 20 ms, without a step. Thread-safe; values that are not finite are ignored.
 
SampleType getToneFrequency (int section) const noexcept
 
SampleType getToneGain (int section) const noexcept
 
void setDrivePan (SampleType pan) noexcept
 The panorama of the drive, -1 to 1 (0, the default, is centred): the first channel the curve sees gets up to 6 dB more drive and the second up to 6 dB less (at -1), or the other way (at +1); each comes out by the inverse, so its level holds where the curve is straight and only how much it saturates moves. In a mid-side mode the two are the middle and the sides. It moves across a block. Thread-safe; values that are not finite are ignored.
 
SampleType getDrivePan () const noexcept
 
void setSlewSensitivity (SampleType amount) noexcept
 Sets a derivative-based (slew rate) saturation multiplier.
 
void setCurveBase (CurveBase base) noexcept
 The base curve of the Curve algorithm, the shape its three controls bend (see CurveBase); tanh by default. Each has a slope of 1 at 0 and heads for the ceiling; Valve and Rectifier treat the two halves differently (even harmonics and DC).
 
CurveBase getCurveBase () const noexcept
 
void setCurveShape (SampleType hardness, SampleType curvature, SampleType asymmetry) noexcept
 Shapes the Curve algorithm.
 
SampleType getCurveHardness () const noexcept
 How far the Curve algorithm stays straight (see setCurveShape()).
 
SampleType getCurveCurvature () const noexcept
 How fast the Curve algorithm turns (see setCurveShape()).
 
SampleType getCurveAsymmetry () const noexcept
 How unlike the two halves of the Curve algorithm are (see setCurveShape()).
 
void setAsymmetry (SampleType amount) noexcept
 Adds a second-order term before the curve of any algorithm.
 
SampleType getAsymmetry () const noexcept
 The second-order term before the curve (see setAsymmetry()).
 
void setProgramNoise (SampleType levelDb) noexcept
 Adds noise that follows the programme, before the curve.
 
SampleType getProgramNoise () const noexcept
 Level of the programme noise under the peak, in decibels (see setProgramNoise()).
 
void setLevelTracking (SampleType amount) noexcept
 Dynamics around the curve: how much the level into it depends on the level of the programme.
 
SampleType getLevelTracking () const noexcept
 The dynamics around the curve (see setLevelTracking()).
 
void setTrackingCorner (SampleType hz) noexcept
 The band the follower of setLevelTracking() listens to.
 
SampleType getTrackingCorner () const noexcept
 The band the dynamics follower listens to, in hertz (0: all of it).
 
void setCombLoop (SampleType amount, SampleType hz) noexcept
 Feeds the output of the curve back into it, inverted, one period of a frequency late.
 
void setCombLoopClosing (bool on) noexcept
 Closes the tuned feedback when the programme stops.
 
bool getCombLoopClosing () const noexcept
 
SampleType getCombLoop () const noexcept
 The amount of the tuned feedback (see setCombLoop()).
 
SampleType getCombLoopFrequency () const noexcept
 The frequency of the tuned feedback as it runs: what the latency allows of the one asked for.
 
void setDriveCompensation (bool on)
 Takes back, at the output, the level the drive adds.
 
bool isDriveCompensation () const noexcept
 Whether the level the drive adds is taken back (see setDriveCompensation()).
 
SampleType getDriveCompensationDb () const noexcept
 The gain the drive compensation is applying, in decibels (0 while it is off).
 
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.
 
void setAutomaticOversampling (bool on)
 Lets the host rate choose the factor (NOT real-time safe, as setOversampling()).
 
bool isOversamplingAutomatic () const noexcept
 Whether the factor follows the host rate (setAutomaticOversampling()).
 
void setOversamplingMode (OversamplingMode mode)
 Chooses the filters of the oversampler (NOT real-time safe, as setOversampling()).
 
OversamplingMode getOversamplingMode () const noexcept
 The filters of the oversampler (see setOversamplingMode()).
 
void setOversamplingBand (OversamplingBand band)
 Chooses the band the oversampler's first stage keeps (NOT real-time safe, as setOversampling()).
 
OversamplingBand getOversamplingBand () const noexcept
 The band of the oversampler's first stage (see setOversamplingBand()).
 
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

void configureProcessingRate (bool keepTargets)
 
template<typename Fn >
void pushParam (Fn &&mutate)
 
void handleParameterChanges ()
 
bool curveMakesDc () noexcept
 Whether a curve in play makes DC from a signal without it (the pre-filter takes the input's away): measured, Tube and MultiStage always; Transformer, SoftClip, HardClip, Exciter and Wavefolder with a character; Curve with its asymmetry; any with setAsymmetry(). Tape, Bitcrusher and Downsample never.
 
double applyDcShare (DCBlocker< SampleType > &filter, AudioBufferView< SampleType > view, double share) noexcept
 The DC filter on a block by its share, which moves toward 1 while wanted and toward 0 otherwise (the filter comes back from rest when it is wanted again). At 1 it is the filter itself.
 
void applyModeDip (AudioBufferView< SampleType > &buffer) noexcept
 A change of processing mode: the wet side goes to the aligned dry over a ramp, the mode changes at the bottom (the curves start again from rest there), and it comes back.
 
void applyParamSnapshot (const Params &p)
 
int secondOrderDelay () const noexcept
 
int secondOrderBaseDelay () const noexcept
 
void processSaturationPipeline (AudioBufferView< SampleType > buffer) noexcept
 
void alignSecondOrder (AudioBufferView< SampleType > view, int keepChannel, int keepSamples, int factor, bool seed) noexcept
 Completes the second-order delay to whole base samples.
 
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 designTone (int ramp) noexcept
 The tone's sections from what was published: a section at 0 dB ramps to the identity and leaves; one coming in starts as the identity of its own design and ramps to it.
 
int poleDecaySamples (const BiquadCoeffs &c) const noexcept
 Samples for the poles of a section to fall 140 dB (what it adds once transparent).
 
SampleType panGain (int ch, int i, int samples) const noexcept
 The drive's gain of a channel at a sample of the block (a straight line between its ends).
 
void applyOutputGain (AudioBufferView< SampleType > buffer) noexcept
 
detail::CurveAlgorithm< SampleType > & curve () noexcept
 
const detail::CurveAlgorithm< SampleType > & curve () const noexcept
 
int feedbackDelayFor (int latency) const noexcept
 
void prepareStages ()
 
void resetStages () noexcept
 
int syncStages () noexcept
 
SampleType stageNoise (int ch) noexcept
 
void stagesBefore (AudioBufferView< SampleType > buffer, int keepChannel) noexcept
 
void stagesAfter (AudioBufferView< SampleType > buffer, int keepChannel) noexcept
 
void maybeCalibrate (int samples) noexcept
 
void prepareCalibrator ()
 
void calibrate () noexcept
 

Static Protected Member Functions

static void sanitizeParams (Params &p, const Params &prev) noexcept
 
static void approach (double &now, double target, double rate) noexcept
 

Protected Attributes

std::atomic< SampleType > asymmetry_ { SampleType(0) }
 
std::atomic< SampleType > programNoiseDb_ { kNoiseOffDb }
 
std::atomic< SampleType > levelTracking_ { SampleType(0) }
 
std::atomic< SampleType > trackingCornerHz_ { SampleType(0) }
 
std::atomic< SampleType > combLoop_ { SampleType(0) }
 
std::atomic< SampleType > combLoopHz_ { SampleType(200) }
 
bool stagesOn_ = false
 
bool feedingBefore_ = false
 The feedback ran in the last block.
 
double asymmetryNow_ = 0.0
 
double asymmetryTarget_ = 0.0
 
double dynamicsNow_ = 0.0
 
double dynamicsTarget_ = 0.0
 
double feedbackNow_ = 0.0
 
double feedbackTarget_ = 0.0
 
double loopDelayNow_ = 0.0
 
double loopGlide_ = 1.0
 The loop's delay now, in samples (0: not started), and its glide per sample.
 
double programPeak_ = 0.0
 
double programFall_ = 0.999
 
double loopOpen_ = 1.0
 The loop that closes: the level of the input, its fall, how open the loop is.
 
std::atomic< bool > combLoopClosing_ { false }
 
bool closingOn_ = false
 
double stageRate_ = 0.0
 
double evenRate_ = 0.0
 
double followUp_ = 0.0
 
double followDown_ = 0.0
 
double focusRate_ = 0.0
 
double followPower_ = 0.0
 
double noiseGain_ = 0.0
 
double noisePeak_ = 0.0
 
double noiseFall_ = 0.0
 
double dynamicsGainDb_ = 0.0
 
double dynamicsSmoothRate_ = 0.0
 
int noiseHoldSamples_ = 0
 
int noiseHoldLeft_ = 0
 
int stageLatency_ = 0
 
int feedbackDelay_ = kMinFeedbackDelay
 
int gainTail_ = 0
 
SampleType feedbackScale_ = SampleType(1)
 
std::array< double, kStageChannels > evenMean_ {}
 
std::array< double, kStageChannels > focusState_ {}
 
std::array< uint32_t, kStageChannels > noiseSeed_
 
std::vector< SampleType > gainRing_
 
std::vector< SampleType > feedbackRing_
 
int gainSize_ = 64
 
int feedbackSize_ = 64
 
int gainPos_ = 0
 
int feedbackPos_ = 0
 
std::atomic< bool > driveCompensation_ { false }
 
int calibrationWait_ = 0
 Samples before the next measurement may run (audio thread).
 
bool calibrationDirty_ = false
 The curve moved since the last measurement (audio thread).
 
std::atomic< bool > calibrationRequested_ { false }
 A setter outside the parameter queue moved it.
 
std::atomic< SampleType > compensationDb_ { SampleType(0) }
 
float userOutputGainDb_ = 0.0f
 
std::unique_ptr< Saturation > calibrator_
 
std::vector< SampleType > calibrationNoise_
 
std::vector< SampleType > calibrationWork_
 
OversamplingMode oversamplingMode_ = OversamplingMode::LinearPhase
 
OversamplingBand oversamplingBand_ = OversamplingBand::Preset
 setOversamplingBand() (setup thread).
 
OversamplingDryPath< SampleType > dryPath_
 
bool dryThroughFilters_ = false
 
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_
 
Params applied_
 The snapshot the audio thread applied last.
 
SpinLock paramsLock_
 
std::atomic< bool > paramsPending_ { false }
 
std::atomic< int > antialiasOrder_ { 0 }
 Antialiasing order, 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_
 
detail::DryPhase dryPreLead_
 
detail::DryPhase dryDcLead_
 
Biquad< SampleType > dryPre_
 
DCBlocker< SampleType > dryDc_
 
double dcShare_ = 1.0
 
double dcStep_ = 1.0 / 2400.0
 
std::atomic< SampleType > drivePan_ { SampleType(0) }
 
SampleType panNow_ = SampleType(0)
 
std::array< SampleType, 2 > panFrom_ { SampleType(1), SampleType(1) }
 
std::array< SampleType, 2 > panTo_ { SampleType(1), SampleType(1) }
 
bool panning_ = false
 
std::array< std::atomic< SampleType >, 4 > toneHz_ { SampleType(100), SampleType(500), SampleType(2500), SampleType(8000) }
 
std::array< std::atomic< SampleType >, 4 > toneDb_ { SampleType(0), SampleType(0), SampleType(0), SampleType(0) }
 
std::atomic< bool > toneDirty_ { false }
 
std::unique_ptr< BiquadCascade< SampleType, 4, 16 > > tone_
 
std::array< int, 4 > toneLeft_ { -1, -1, -1, -1 }
 
bool toneOn_ = false
 
bool dcWanted_ = true
 
bool dcSnap_ = true
 
AudioBuffer< SampleType > dcScratch_
 
ProcessingMode pendingMode_ = ProcessingMode::Stereo
 
double modeDip_ = 0.0
 
double modeDipStep_ = 1.0 / 240.0
 0 = the wet side, 1 = the dry
 
bool modeDipping_ = false
 
bool modeDipDown_ = false
 
bool dryRunning_ = false
 
bool dryExact_ = false
 
int dryHoldSamples_ = 0
 
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()).
 
bool oversamplingAutomatic_ = false
 The factor follows the host rate (setAutomaticOversampling()).
 
std::atomic< SampleType > gainReductionDb_ { SampleType(0) }
 
std::atomic< bool > adaptiveBlend_ { false }
 
std::array< SampleType, kMaxCh > prevBlendSample_ {}
 
std::atomic< SampleType > slewSensitivity_ { SampleType(0) }
 
SampleType slewRateScale_ = SampleType(1)
 Processing rate / 96 kHz.
 
std::vector< SampleType > driveRamp_
 
std::vector< SampleType > charRamp_
 Per-sample drive/character (processing rate).
 
std::array< SampleType, kMaxCh > prevSlewSample_ {}
 
float lastPreHpFreq_ = -1.0f
 
float lastPostTiltFreq_ = -1.0f
 
float lastPostTiltGain_ = std::numeric_limits<float>::quiet_NaN()
 
bool secondActive_ = false
 
bool alignFresh_ = true
 
std::array< std::array< SampleType, kAlignRing >, kMaxCh > alignRing_ {}
 
std::array< SampleType, kAlignRing > keepRing_ {}
 
int alignPos_ = 0
 
std::array< SampleType, kMaxCh > dryHold_ {}
 
std::array< SampleType, kMaxCh > dryHold2_ {}
 Second dry sample (2x).
 
AudioBuffer< SampleType > dryAligned_
 

Static Protected Attributes

static constexpr int kStageChannels = 16
 Channels the stages keep a memory for.
 
static constexpr SampleType kNoiseOffDb = SampleType(-120)
 Programme noise at or under this is off.
 
static constexpr SampleType kMinFeedbackHz = SampleType(20)
 Lowest frequency of the tuned feedback.
 
static constexpr int kMinFeedbackDelay = 16
 Shortest feedback line (and piece of a block).
 
static constexpr double kLoopOctaveSeconds = 0.1
 Time the loop's delay takes to glide an octave.
 
static constexpr double kLoopCloseSeconds = 0.02
 Time constant the programme's level falls with, for the loop that closes.
 
static constexpr double kLoopCloseLevel = 3.1622776601683794e-4
 -70 dBFS: under it there is no programme.
 
static constexpr double kDynamicsReferenceDb = -18.0
 Level the dynamics bring the programme to.
 
static constexpr double kDynamicsReachDb = 24.0
 Most gain the dynamics apply, either way.
 
static constexpr double kEvenShare = 0.25
 Share of the square added at asymmetry 1.
 
static constexpr double kCompensationShare = 0.75
 Share of the measured gain taken back.
 
static constexpr double kCalibrationLevelDb = -18.0
 RMS level of the measuring noise.
 
static constexpr int kCalibrationSamples = 4096
 Length of a measurement.
 
static constexpr int kCalibrationSkip = 1024
 Samples left out while the twin settles.
 
static constexpr double kCalibrationQuiet = 0.01
 Level of the reference run (-40 dB).
 
static constexpr int kCalibrationBlock = 256
 
static constexpr double kCalibrationEvery = 0.05
 Seconds between two measurements while the curve moves.
 
static constexpr int kNumAlgorithms = 11
 
static constexpr double kDcCornerHz = 5.0
 
static constexpr double kDcFadeSeconds = 0.05
 The DC filter comes in or goes out in this time.
 
static constexpr double kModeDipSeconds = 0.005
 The fall of a mode change's dip.
 
static constexpr double kModeRiseShare = 0.25
 Its rise takes four times as long (the curves settle from rest).
 
static constexpr double kDryHoldSeconds = 0.05
 It is kept up this long after the mix has gone full wet.
 
static constexpr double kDrivePanDb = 6.0
 
static constexpr int kToneSections = 4
 
static constexpr double kToneRampSeconds = 0.02
 
static constexpr double kAutomaticInternalRate = 88200.0
 Rate the automatic factor reaches.
 
static constexpr int kMaxCh = 16
 
static constexpr int kAlignRing = 32
 

‍largest delay (16 processing samples).


 

Friends

template<FloatType , int >
class MultibandSaturation
 

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 11 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, plus two samples at 2x (one at the other factors) with second-order antialiasing (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 1652 of file Saturation.h.

Member Typedef Documentation

◆ OversamplingBand

template<typename SampleType >
using dspark::Saturation< SampleType >::OversamplingBand = typename Oversampling<SampleType>::Band

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

Definition at line 1689 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.

Curve 

A soft clipper shaped by three controls (setCurveShape()): how far it stays straight, how fast it turns, and how unlike its two halves are.

Definition at line 1663 of file Saturation.h.

◆ Antialiasing

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

Antiderivative antialiasing order (see setAntialiasing()).

  • Off: plain curves (the Wavefolder keeps its built-in first-order form).
  • FirstOrder: SoftClip/Tube/HardClip, half a processing sample of uncompensated delay; a small signal falls -0.47 dB at 10 kHz, -1.25 dB at 16 kHz and -2.0 dB at 20 kHz at the default 2x (the worst alias of a -6 dBFS tone at +12 dB of drive from -53.5 to -81.1 dBc at 10 kHz and from -28.3 to -45.7 dBc at 15 kHz).
  • SecondOrder (Bilbao, Esqueda, Parker and Valimaki 2017): a kernel on every curve except the Bitcrusher and Downsample (SoftClip/Tube/HardClip/Wavefolder/Transformer/Exciter/Tape), and on all three MultiStage stages from 2x (the tube stage only at 1x). Every algorithm is delayed by the same number of processing samples: four at 2x (two base samples, room for the MultiStage kernels), otherwise min(factor, 3) with the wet path padded to one base sample. getLatency() reports it at once and the dry, Delta and unprocessed M/S paths match. -1.3 dB at 10 kHz and -5.9 dB at 20 kHz at 2x (-1.3 dB at 20 kHz at 4x); MultiStage -2.3 and -9.9 dB at 2x, -3.9 dB at 20 kHz at 4x. Worst alias over 1-19.25 kHz tones at -6/-18 dBFS, 2x, +24 dB drive: SoftClip -42.1 dBc against -29.7 for FirstOrder and -15.2 off; Transformer -43.2 against -15.7; Tape -38.0 against -7.7; Exciter -27.5 against -9.8; MultiStage -36.2 against -5.5 (at 4x -49.7 against -5.7; the MultiStage figures at 2x hold from +16 dB of drive, below it the cascade keeps its two-sample form, see the MultiStage notes). Meant for oversampled use: at 1x the kernel's -12 dB at 20 kHz lowers high fundamentals more than it removes alias (SoftClip +24 dB: -2.1 dBc against -10.0 off over the same tones). Cost at 2x, stereo float, ns per frame: Tape 510 against 300 plain, MultiStage 950 against 260 plain (both of its transformer forms run), Exciter 150 against 35.
Enumerator
Off 
FirstOrder 
SecondOrder 

Definition at line 1730 of file Saturation.h.

◆ CurveBase

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

How the oversampler filters (see setOversamplingMode()).

The base curve of Algorithm::Curve (see setCurveBase()).

Enumerator
Tanh 
Algebraic 
Arctangent 
Erf 
Cubic 
Valve 
Rectifier 

Definition at line 1680 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 1695 of file Saturation.h.

◆ OversamplingMode

template<typename SampleType >
enum class dspark::Saturation::OversamplingMode
strong
Enumerator
LinearPhase 

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

MinimumPhase 

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

Definition at line 1682 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 1692 of file Saturation.h.

Constructor & Destructor Documentation

◆ Saturation() [1/2]

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

Definition at line 1734 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

◆ alignSecondOrder()

template<typename SampleType >
void dspark::Saturation< SampleType >::alignSecondOrder ( AudioBufferView< SampleType >  view,
int  keepChannel,
int  keepSamples,
int  factor,
bool  seed 
)
inlineprotectednoexcept

Completes the second-order delay to whole base samples.

The algorithms delay by secondOrderDelay() processing samples, so a factor-N stage adds the rest of N (of 2N = 4 at 2x) to every saturated channel; the M/S snapshot that is restored unprocessed is delayed by all of it. Rings hold 32 samples; seed fills them with each channel's first sample (no step from stale or zero history when the order is switched on).

Definition at line 3484 of file Saturation.h.

◆ 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 3527 of file Saturation.h.

◆ applyDcShare()

template<typename SampleType >
double dspark::Saturation< SampleType >::applyDcShare ( DCBlocker< SampleType > &  filter,
AudioBufferView< SampleType >  view,
double  share 
)
inlineprotectednoexcept

The DC filter on a block by its share, which moves toward 1 while wanted and toward 0 otherwise (the filter comes back from rest when it is wanted again). At 1 it is the filter itself.

Returns
The share at the end of the block.

Definition at line 3165 of file Saturation.h.

◆ applyModeDip()

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

A change of processing mode: the wet side goes to the aligned dry over a ramp, the mode changes at the bottom (the curves start again from rest there), and it comes back.

Definition at line 3198 of file Saturation.h.

◆ applyOutputGain()

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

Definition at line 3681 of file Saturation.h.

◆ applyParamSnapshot()

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

Definition at line 3232 of file Saturation.h.

◆ approach()

template<typename SampleType >
static void dspark::Saturation< SampleType >::approach ( double &  now,
double  target,
double  rate 
)
inlinestaticprotectednoexcept

A value on its way to a target, 20 ms away; it lands on a target of zero.

Definition at line 3802 of file Saturation.h.

◆ calibrate()

template<typename SampleType >
void dspark::Saturation< SampleType >::calibrate ( )
inlineprotectednoexcept

Measures the gain of the curve on programme with the settings as they stand and sets the compensation. Audio thread (or the setup thread before audio runs): it allocates nothing.

Definition at line 4037 of file Saturation.h.

◆ configureProcessingRate()

template<typename SampleType >
void dspark::Saturation< SampleType >::configureProcessingRate ( bool  keepTargets)
inlineprotected

Prepares the state that runs at the processing (oversampled) rate: the drive, character and drift smoothers, the algorithm crossfade and the drift generators. They were prepared at the base rate, so their times shrank by the factor (drive t63 18.7 ms instead of 36 at 2x, crossfade 5.3 ms instead of 10, drift retriggering at 2 Hz). keepTargets snaps each smoother to its current target. Setup thread.

Definition at line 3017 of file Saturation.h.

◆ curve() [1/2]

template<typename SampleType >
const detail::CurveAlgorithm< SampleType > & dspark::Saturation< SampleType >::curve ( ) const
inlineprotectednoexcept

Definition at line 3706 of file Saturation.h.

◆ curve() [2/2]

template<typename SampleType >
detail::CurveAlgorithm< SampleType > & dspark::Saturation< SampleType >::curve ( )
inlineprotectednoexcept

Definition at line 3702 of file Saturation.h.

◆ curveMakesDc()

template<typename SampleType >
bool dspark::Saturation< SampleType >::curveMakesDc ( )
inlineprotectednoexcept

Whether a curve in play makes DC from a signal without it (the pre-filter takes the input's away): measured, Tube and MultiStage always; Transformer, SoftClip, HardClip, Exciter and Wavefolder with a character; Curve with its asymmetry; any with setAsymmetry(). Tape, Bitcrusher and Downsample never.

Definition at line 3133 of file Saturation.h.

◆ designTone()

template<typename SampleType >
void dspark::Saturation< SampleType >::designTone ( int  ramp)
inlineprotectednoexcept

The tone's sections from what was published: a section at 0 dB ramps to the identity and leaves; one coming in starts as the identity of its own design and ramps to it.

Definition at line 3629 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 3551 of file Saturation.h.

◆ feedbackDelayFor()

template<typename SampleType >
int dspark::Saturation< SampleType >::feedbackDelayFor ( int  latency) const
inlineprotectednoexcept

Samples the feedback line delays so that, with a latency, the loop is one period long.

Definition at line 3712 of file Saturation.h.

◆ getAntialiasing()

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

The selected antialiasing order.

Definition at line 2435 of file Saturation.h.

◆ getAsymmetry()

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

The second-order term before the curve (see setAsymmetry()).

Definition at line 2557 of file Saturation.h.

◆ getCombLoop()

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

The amount of the tuned feedback (see setCombLoop()).

Definition at line 2671 of file Saturation.h.

◆ getCombLoopClosing()

template<typename SampleType >
bool dspark::Saturation< SampleType >::getCombLoopClosing ( ) const
inlinenoexcept
Returns
Whether the tuned feedback closes when the programme stops.

Definition at line 2668 of file Saturation.h.

◆ getCombLoopFrequency()

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

The frequency of the tuned feedback as it runs: what the latency allows of the one asked for.

Definition at line 2674 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 2894 of file Saturation.h.

◆ getCurveAsymmetry()

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

How unlike the two halves of the Curve algorithm are (see setCurveShape()).

Definition at line 2538 of file Saturation.h.

◆ getCurveBase()

template<typename SampleType >
CurveBase dspark::Saturation< SampleType >::getCurveBase ( ) const
inlinenoexcept
Returns
The base curve of Algorithm::Curve.

Definition at line 2511 of file Saturation.h.

◆ getCurveCurvature()

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

How fast the Curve algorithm turns (see setCurveShape()).

Definition at line 2536 of file Saturation.h.

◆ getCurveHardness()

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

How far the Curve algorithm stays straight (see setCurveShape()).

Definition at line 2534 of file Saturation.h.

◆ getDriveCompensationDb()

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

The gain the drive compensation is applying, in decibels (0 while it is off).

Definition at line 2710 of file Saturation.h.

◆ getDrivePan()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::getDrivePan ( ) const
inlinenoexcept
Returns
The panorama of the drive, -1 to 1.

Definition at line 2487 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 2901 of file Saturation.h.

◆ getLatency()

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

Reports the processor's algorithmic latency in samples.

Note
The oversampler group delay (0 when oversampling is off), plus with second-order antialiasing two samples at the default 2x and one at the other factors. Report this to the host for plugin delay compensation (PDC).

Definition at line 2880 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 2887 of file Saturation.h.

◆ getLevelTracking()

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

The dynamics around the curve (see setLevelTracking()).

Definition at line 2603 of file Saturation.h.

◆ getOversamplingBand()

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

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

Definition at line 2827 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 2871 of file Saturation.h.

◆ getOversamplingMode()

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

The filters of the oversampler (see setOversamplingMode()).

Definition at line 2802 of file Saturation.h.

◆ getProgramNoise()

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

Level of the programme noise under the peak, in decibels (see setProgramNoise()).

Definition at line 2578 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 2905 of file Saturation.h.

◆ getToneFrequency()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::getToneFrequency ( int  section) const
inlinenoexcept
Returns
A section's frequency in hertz.

Definition at line 2460 of file Saturation.h.

◆ getToneGain()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::getToneGain ( int  section) const
inlinenoexcept
Returns
A section's gain in dB.

Definition at line 2466 of file Saturation.h.

◆ getTrackingCorner()

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

The band the dynamics follower listens to, in hertz (0: all of it).

Definition at line 2624 of file Saturation.h.

◆ handleParameterChanges()

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

Definition at line 3108 of file Saturation.h.

◆ isDriveCompensation()

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

Whether the level the drive adds is taken back (see setDriveCompensation()).

Definition at line 2707 of file Saturation.h.

◆ isOversamplingAutomatic()

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

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

Definition at line 2779 of file Saturation.h.

◆ maybeCalibrate()

template<typename SampleType >
void dspark::Saturation< SampleType >::maybeCalibrate ( int  samples)
inlineprotectednoexcept

Measures the curve again when it has moved and the last measurement is old enough. Audio thread.

Definition at line 3987 of file Saturation.h.

◆ operator=()

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

◆ panGain()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::panGain ( int  ch,
int  i,
int  samples 
) const
inlineprotectednoexcept

The drive's gain of a channel at a sample of the block (a straight line between its ends).

Definition at line 3675 of file Saturation.h.

◆ poleDecaySamples()

template<typename SampleType >
int dspark::Saturation< SampleType >::poleDecaySamples ( const BiquadCoeffs &  c) const
inlineprotectednoexcept

Samples for the poles of a section to fall 140 dB (what it adds once transparent).

Definition at line 3664 of file Saturation.h.

◆ 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 1767 of file Saturation.h.

◆ prepareCalibrator()

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

Builds the twin that measures the gain of the curve, and its noise. Setup thread.

Definition at line 3997 of file Saturation.h.

◆ prepareStages()

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

Sizes the memory of the stages. Setup thread.

Definition at line 3720 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 1925 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 1939 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 3571 of file Saturation.h.

◆ processSaturationPipeline()

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

Definition at line 3324 of file Saturation.h.

◆ pushParam()

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

Definition at line 3092 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 1873 of file Saturation.h.

◆ resetStages()

template<typename SampleType >
void dspark::Saturation< SampleType >::resetStages ( )
inlineprotectednoexcept

Clears the memory of the stages.

Definition at line 3742 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 3066 of file Saturation.h.

◆ secondOrderBaseDelay()

template<typename SampleType >
int dspark::Saturation< SampleType >::secondOrderBaseDelay ( ) const
inlineprotectednoexcept

Base samples that second-order antialiasing adds: 2 at 2x, else 1.

Definition at line 3318 of file Saturation.h.

◆ secondOrderDelay()

template<typename SampleType >
int dspark::Saturation< SampleType >::secondOrderDelay ( ) const
inlineprotectednoexcept

Processing samples of second-order delay inside the algorithms: 4 at 2x (two base samples, the MultiStage split), otherwise min(factor, 3), padded to one base sample by alignSecondOrder().

Definition at line 3312 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 2401 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 2311 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 2368 of file Saturation.h.

◆ setAntialiasing() [1/2]

template<typename SampleType >
void dspark::Saturation< SampleType >::setAntialiasing ( Antialiasing  mode)
inlinenoexcept

Selects the antialiasing order (see Antialiasing). Any thread; SecondOrder changes getLatency() at once and the audio from the next block, so notify the host. Out-of-range values are clamped.

Definition at line 2426 of file Saturation.h.

◆ setAntialiasing() [2/2]

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

Enables first-order antiderivative anti-aliasing (ADAA) on the memoryless curves (SoftClip / Tube / HardClip): true selects Antialiasing::FirstOrder, false Off. Best combined with oversampling (Parker/Zavalishin DAFx-16, 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. The wet top itself falls as well, -1.25 dB at 16 kHz at the default 2x (see Antialiasing): the reason it is off by default.

Definition at line 2416 of file Saturation.h.

◆ setAsymmetry()

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

Adds a second-order term before the curve of any algorithm.

The signal meets the curve with a share of its own square (less the mean of it) added: the two half-cycles are driven unequally and even harmonics appear, more of them the louder the signal. -1 to 1 (the sign is the polarity of the term); 0, the default, is off.

Note
Thread-Safe. Smoothed over 20 ms; a value that is not finite is ignored.

Definition at line 2550 of file Saturation.h.

◆ setAutomaticOversampling()

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

Lets the host rate choose the factor (NOT real-time safe, as setOversampling()).

With it on, every prepare() takes the smallest factor that brings the curves to an internal rate of at least 88.2 kHz: 2x at 44.1 and 48 kHz (the default factor) 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 2767 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 2345 of file Saturation.h.

◆ setCombLoop()

template<typename SampleType >
void dspark::Saturation< SampleType >::setCombLoop ( SampleType  amount,
SampleType  hz 
)
inlinenoexcept

Feeds the output of the curve back into it, inverted, one period of a frequency late.

What leaves the curve (taken back to the level it came in at) returns to its input with the opposite sign after a delay that, with the latency of the processor, makes one period of the frequency: a comb the curve sits inside, with dips on the frequency and its multiples and peaks half way between them. The loop gain is the amount and falls as the curve saturates, so it cannot run away. The delay cannot be shorter than the latency plus 16 samples: getCombLoopFrequency() gives the frequency in effect. While it is on the block is processed in pieces no longer than the delay. A new frequency is reached by a glide of the delay (an octave in a tenth of a second, read between samples), so the line that recirculates is never cut.

Note
Thread-Safe. Values that are not finite are ignored.
Parameters
amount-0.95 to 0.95; 0, the default, is off.
hzFrequency of the comb, from 20 Hz.

Definition at line 2646 of file Saturation.h.

◆ setCombLoopClosing()

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

Closes the tuned feedback when the programme stops.

With a loop gain near one the comb rings on long after the input has gone. With this on, the loop follows the level of what comes in: it stays as set while there is programme and closes, in a few tens of milliseconds, once the input has stayed under -70 dBFS; the ringing ends with the programme. Off by default.

Note
Thread-Safe.

Definition at line 2665 of file Saturation.h.

◆ setCurveBase()

template<typename SampleType >
void dspark::Saturation< SampleType >::setCurveBase ( CurveBase  base)
inlinenoexcept

The base curve of the Curve algorithm, the shape its three controls bend (see CurveBase); tanh by default. Each has a slope of 1 at 0 and heads for the ceiling; Valve and Rectifier treat the two halves differently (even harmonics and DC).

Note
Thread-Safe. Taken at the next block.

Definition at line 2508 of file Saturation.h.

◆ setCurveShape()

template<typename SampleType >
void dspark::Saturation< SampleType >::setCurveShape ( SampleType  hardness,
SampleType  curvature,
SampleType  asymmetry 
)
inlinenoexcept

Shapes the Curve algorithm.

Note
Thread-Safe. Taken at the next block; values that are not finite keep what they had.
Parameters
hardnessHow far the curve stays a straight line before it turns, as a share of its ceiling: 0 (the whole of it bends) to 0.95 (a corner).
curvatureHow fast it turns: 0.5 (it leaves the line at once) to 4 (it stays on it and turns late); 1 is neutral.
asymmetryHow unlike the two halves are: at +1 the negative half-cycle meets its ceiling at half the level of the positive one's, at -1 the positive one at half the negative one's; 0 is symmetric.

Definition at line 2527 of file Saturation.h.

◆ setDcBlocking()

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

Enables or disables the fixed 5 Hz DC blocker.

Note
Thread-Safe. It is in the path only while a curve in play makes DC (Tube and MultiStage; Transformer, SoftClip, HardClip, Exciter and Wavefolder with a character; Curve with its asymmetry; any with setAsymmetry()): a symmetric curve keeps the low end's phase (the pre-filter has taken the input's DC). It comes in and goes out over 50 ms.
Parameters
onTrue to enable DC blocking (default).

Definition at line 2394 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 2318 of file Saturation.h.

◆ setDriveCompensation()

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

Takes back, at the output, the level the drive adds.

The gain of the curve on programme (pink noise at -18 dBFS RMS through a twin of this processor with the algorithm, drive, character, shape, antialiasing and oversampling as they stand, against the same noise 40 dB down through the twin at no drive) is measured whenever one of them changes, and three quarters of it, in decibels, is taken back at the output: the drive then changes the tone a great deal and the level a little (a quarter of a decibel per decibel is left, so the knob is still felt). The measurement runs on the audio thread, two runs of 4096 samples of the processor, at most every 50 ms while those settings move.

Note
NOT real-time safe: it allocates the twin. Call it on the setup thread, like setOversampling().

Definition at line 2697 of file Saturation.h.

◆ setDrivePan()

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

The panorama of the drive, -1 to 1 (0, the default, is centred): the first channel the curve sees gets up to 6 dB more drive and the second up to 6 dB less (at -1), or the other way (at +1); each comes out by the inverse, so its level holds where the curve is straight and only how much it saturates moves. In a mid-side mode the two are the middle and the sides. It moves across a block. Thread-safe; values that are not finite are ignored.

Definition at line 2481 of file Saturation.h.

◆ setLevelTracking()

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

Dynamics around the curve: how much the level into it depends on the level of the programme.

A follower of the level (10 ms up, 150 ms down, and the gain it sets smoothed over 5 ms) moves the gain before the curve and its inverse comes after it, in time with the wet path, so the level that leaves is the one that came in and only the amount of saturation changes. At +1 the curve always sees the programme at the same peak level (-18 dBFS): a quiet passage saturates as much as a loud one. At -1 the level into the curve moves twice as far as the programme does: the loud passages saturate far more than the quiet ones. The gain is held to 24 dB either way. 0, the default, is off.

Note
Thread-Safe. Smoothed over 20 ms; a value that is not finite is ignored.

Definition at line 2596 of file Saturation.h.

◆ setMix()

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

Sets the global Dry/Wet blend.

Between the two ends the dry side takes the phase of the wet side's high-passes (setPreFilterHpFrequency(), setDcBlocking()) and keeps its own level, so a partial mix is the mean of the two levels at the bottom as well. At zero the output is the input (late by the latency).

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

Definition at line 2331 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 2382 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 is the wet side less the dry one, both through the same high-passes: what the curve changes.

Definition at line 2361 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. Other values are ignored. 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()). From 8x every decimation stage is at least 100 dB deep (Oversampling::Depth::Deep), for 93 samples of latency at 8x and 95 at 16x (70 at 4x): the wavefolder at +24 dB aliases at -104 dBc at 8x (-75 with the preset's stages) and SoftClip with second-order antialiasing at -119 dBc at 16x (-95).

Definition at line 2747 of file Saturation.h.

◆ setOversamplingBand()

template<typename SampleType >
void dspark::Saturation< SampleType >::setOversamplingBand ( OversamplingBand  band)
inline

Chooses the band the oversampler's first stage keeps (NOT real-time safe, as setOversampling()).

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 at prepare() and is shorter the higher the rate (see Oversampling::Band), which is less latency and less work. 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: the wet path falls there (a 30 kHz tone at 96 kHz comes back at 0.95 of its level) while a linear-phase dry path does not.

Definition at line 2818 of file Saturation.h.

◆ setOversamplingMode()

template<typename SampleType >
void dspark::Saturation< SampleType >::setOversamplingMode ( OversamplingMode  mode)
inline

Chooses the filters of the oversampler (NOT real-time safe, as setOversampling()).

LinearPhase, the default, keeps the phase of the programme and costs the latency of the factor. MinimumPhase runs elliptic allpass half-bands: a few samples of latency instead (3 at 2x and 48 kHz) and a phase that turns towards the top of the band. The dry path of the mix, of the Delta output and of the adaptive blend then goes through the same filters with nothing in between, so a partial mix adds in phase at every frequency instead of combing.

Definition at line 2793 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 2723 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 2375 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. A change dips the wet side to the aligned dry in 5 ms, switches there (the curves start again from rest) and comes back in 20 ms, so the switch has no step.
Parameters
mThe processing mode (Stereo, MidOnly, SideOnly, MidSide).

Definition at line 2354 of file Saturation.h.

◆ setProgramNoise()

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

Adds noise that follows the programme, before the curve.

White noise at a level counted from the recent peak of the signal (held for 50 ms, then released over 150 ms) is added before the curve, which then shapes it with the signal: it is there while the programme is and goes with it, so silence stays silent.

Note
Thread-Safe. A value that is not finite is ignored.
Parameters
levelDbLevel of the noise under the peak of the programme, in decibels: -90 to -20. -120 or less, the default, is off.

Definition at line 2571 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 2495 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 2960 of file Saturation.h.

◆ setTone()

template<typename SampleType >
void dspark::Saturation< SampleType >::setTone ( int  section,
SampleType  hz,
SampleType  gainDb 
)
inlinenoexcept

A section of the tone after the curve: 0 a low shelf (100 Hz by default), 1 and 2 bells of Q 0.7 (500 Hz and 2.5 kHz), 3 a high shelf (8 kHz). At 0 dB a section is out of the path and costs nothing; it comes in, moves and goes out over 20 ms, without a step. Thread-safe; values that are not finite are ignored.

Parameters
section0 to 3 (others are ignored).
hzIts frequency, 20 Hz to 20 kHz.
gainDbIts gain, -18 to 18 dB.

Definition at line 2450 of file Saturation.h.

◆ setTrackingCorner()

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

The band the follower of setLevelTracking() listens to.

Over 0 the follower reads the programme through a low-pass at this frequency: with a negative setLevelTracking() the low end then pushes the whole signal into the curve (the threshold of the saturation moves with the bass, as in a core whose low frequencies fill it first).

Note
Thread-Safe. A value that is not finite is ignored.
Parameters
hzCorner of the low-pass, 20 to 2000 Hz; 0, the default, is the whole band.

Definition at line 2616 of file Saturation.h.

◆ stageNoise()

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::stageNoise ( int  ch)
inlineprotectednoexcept

White noise in [-1, 1) for a channel.

Definition at line 3809 of file Saturation.h.

◆ stagesAfter()

template<typename SampleType >
void dspark::Saturation< SampleType >::stagesAfter ( AudioBufferView< SampleType >  buffer,
int  keepChannel 
)
inlineprotectednoexcept

What happens after the curve: the inverse of the gain of the dynamics, as late as the wet path is, and the output written to the feedback line at the level it came in at.

Definition at line 3958 of file Saturation.h.

◆ stagesBefore()

template<typename SampleType >
void dspark::Saturation< SampleType >::stagesBefore ( AudioBufferView< SampleType >  buffer,
int  keepChannel 
)
inlineprotectednoexcept

What happens before the curve, at the base rate: the feedback comes back, the dynamics set the level, the second-order term and the noise of the programme are added. The channel that stays unprocessed in the MidOnly and SideOnly modes is left alone.

Definition at line 3822 of file Saturation.h.

◆ syncStages()

template<typename SampleType >
int dspark::Saturation< SampleType >::syncStages ( )
inlineprotectednoexcept

Takes the settings of the stages for a block and says how long a piece of it may be (the delay of the feedback line while the feedback runs). Audio thread.

Definition at line 3770 of file Saturation.h.

Friends And Related Symbol Documentation

◆ MultibandSaturation

template<typename SampleType >
template<FloatType , int >
friend class MultibandSaturation
friend

Definition at line 1944 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 4157 of file Saturation.h.

◆ adaptiveBlend_

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

Definition at line 4237 of file Saturation.h.

◆ alignFresh_

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

Definition at line 4253 of file Saturation.h.

◆ alignPos_

template<typename SampleType >
int dspark::Saturation< SampleType >::alignPos_ = 0
protected

Definition at line 4256 of file Saturation.h.

◆ alignRing_

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

Definition at line 4254 of file Saturation.h.

◆ antialiasOrder_

template<typename SampleType >
std::atomic<int> dspark::Saturation< SampleType >::antialiasOrder_ { 0 }
protected

Antialiasing order, mirror for getState.

Definition at line 4165 of file Saturation.h.

◆ applied_

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

The snapshot the audio thread applied last.

Definition at line 4162 of file Saturation.h.

◆ asymmetry_

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

Definition at line 4105 of file Saturation.h.

◆ asymmetryNow_

template<typename SampleType >
double dspark::Saturation< SampleType >::asymmetryNow_ = 0.0
protected

Definition at line 4115 of file Saturation.h.

◆ asymmetryTarget_

template<typename SampleType >
double dspark::Saturation< SampleType >::asymmetryTarget_ = 0.0
protected

Definition at line 4115 of file Saturation.h.

◆ calibrationDirty_

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

The curve moved since the last measurement (audio thread).

Definition at line 4139 of file Saturation.h.

◆ calibrationNoise_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::calibrationNoise_
protected

Definition at line 4144 of file Saturation.h.

◆ calibrationRequested_

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

A setter outside the parameter queue moved it.

Definition at line 4140 of file Saturation.h.

◆ calibrationWait_

template<typename SampleType >
int dspark::Saturation< SampleType >::calibrationWait_ = 0
protected

Samples before the next measurement may run (audio thread).

Definition at line 4138 of file Saturation.h.

◆ calibrationWork_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::calibrationWork_
protected

Definition at line 4144 of file Saturation.h.

◆ calibrator_

template<typename SampleType >
std::unique_ptr<Saturation> dspark::Saturation< SampleType >::calibrator_
protected

Definition at line 4143 of file Saturation.h.

◆ characterSmoother_

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

Definition at line 4173 of file Saturation.h.

◆ charRamp_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::charRamp_
protected

Per-sample drive/character (processing rate).

Definition at line 4243 of file Saturation.h.

◆ closingOn_

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

Definition at line 4121 of file Saturation.h.

◆ combLoop_

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

Definition at line 4109 of file Saturation.h.

◆ combLoopClosing_

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

Definition at line 4120 of file Saturation.h.

◆ combLoopHz_

template<typename SampleType >
std::atomic<SampleType> dspark::Saturation< SampleType >::combLoopHz_ { SampleType(200) }
protected

Definition at line 4110 of file Saturation.h.

◆ compensationDb_

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

Definition at line 4141 of file Saturation.h.

◆ crossfader_

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

Definition at line 4175 of file Saturation.h.

◆ currentAlgoType_

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

Definition at line 4170 of file Saturation.h.

◆ dcBlocker_

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

Definition at line 4182 of file Saturation.h.

◆ dcBlockingEnabled_

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

Definition at line 4169 of file Saturation.h.

◆ dcScratch_

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

Definition at line 4215 of file Saturation.h.

◆ dcShare_

template<typename SampleType >
double dspark::Saturation< SampleType >::dcShare_ = 1.0
protected

Definition at line 4197 of file Saturation.h.

◆ dcSnap_

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

Definition at line 4214 of file Saturation.h.

◆ dcStep_

template<typename SampleType >
double dspark::Saturation< SampleType >::dcStep_ = 1.0 / 2400.0
protected

Definition at line 4197 of file Saturation.h.

◆ dcWanted_

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

Definition at line 4213 of file Saturation.h.

◆ driftBuffer_

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

Definition at line 4227 of file Saturation.h.

◆ driftSmoother_

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

Definition at line 4173 of file Saturation.h.

◆ driveCompensation_

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

Definition at line 4137 of file Saturation.h.

◆ drivePan_

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

Definition at line 4199 of file Saturation.h.

◆ driveRamp_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::driveRamp_
protected

Definition at line 4243 of file Saturation.h.

◆ driveSmoother_

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

Definition at line 4172 of file Saturation.h.

◆ dryAligned_

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

Definition at line 4259 of file Saturation.h.

◆ dryDc_

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

Definition at line 4194 of file Saturation.h.

◆ dryDcLead_

template<typename SampleType >
detail::DryPhase dspark::Saturation< SampleType >::dryDcLead_
protected

Definition at line 4192 of file Saturation.h.

◆ dryExact_

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

Definition at line 4221 of file Saturation.h.

◆ dryHold2_

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

Second dry sample (2x).

Definition at line 4258 of file Saturation.h.

◆ dryHold_

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

Definition at line 4257 of file Saturation.h.

◆ dryHoldSamples_

template<typename SampleType >
int dspark::Saturation< SampleType >::dryHoldSamples_ = 0
protected

Definition at line 4222 of file Saturation.h.

◆ dryPath_

template<typename SampleType >
OversamplingDryPath<SampleType> dspark::Saturation< SampleType >::dryPath_
protected

Definition at line 4149 of file Saturation.h.

◆ dryPre_

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

Definition at line 4193 of file Saturation.h.

◆ dryPreLead_

template<typename SampleType >
detail::DryPhase dspark::Saturation< SampleType >::dryPreLead_
protected

Definition at line 4192 of file Saturation.h.

◆ dryRunning_

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

Definition at line 4221 of file Saturation.h.

◆ dryThroughFilters_

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

Definition at line 4150 of file Saturation.h.

◆ dryWetMixer_

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

Definition at line 4183 of file Saturation.h.

◆ dynamicsGainDb_

template<typename SampleType >
double dspark::Saturation< SampleType >::dynamicsGainDb_ = 0.0
protected

Definition at line 4124 of file Saturation.h.

◆ dynamicsNow_

template<typename SampleType >
double dspark::Saturation< SampleType >::dynamicsNow_ = 0.0
protected

Definition at line 4116 of file Saturation.h.

◆ dynamicsSmoothRate_

template<typename SampleType >
double dspark::Saturation< SampleType >::dynamicsSmoothRate_ = 0.0
protected

Definition at line 4124 of file Saturation.h.

◆ dynamicsTarget_

template<typename SampleType >
double dspark::Saturation< SampleType >::dynamicsTarget_ = 0.0
protected

Definition at line 4116 of file Saturation.h.

◆ evenMean_

template<typename SampleType >
std::array<double, kStageChannels> dspark::Saturation< SampleType >::evenMean_ {}
protected

Definition at line 4128 of file Saturation.h.

◆ evenRate_

template<typename SampleType >
double dspark::Saturation< SampleType >::evenRate_ = 0.0
protected

Definition at line 4122 of file Saturation.h.

◆ feedbackDelay_

template<typename SampleType >
int dspark::Saturation< SampleType >::feedbackDelay_ = kMinFeedbackDelay
protected

Definition at line 4126 of file Saturation.h.

◆ feedbackNow_

template<typename SampleType >
double dspark::Saturation< SampleType >::feedbackNow_ = 0.0
protected

Definition at line 4117 of file Saturation.h.

◆ feedbackPos_

template<typename SampleType >
int dspark::Saturation< SampleType >::feedbackPos_ = 0
protected

Definition at line 4134 of file Saturation.h.

◆ feedbackRing_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::feedbackRing_
protected

Definition at line 4133 of file Saturation.h.

◆ feedbackScale_

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::feedbackScale_ = SampleType(1)
protected

Definition at line 4127 of file Saturation.h.

◆ feedbackSize_

template<typename SampleType >
int dspark::Saturation< SampleType >::feedbackSize_ = 64
protected

Definition at line 4134 of file Saturation.h.

◆ feedbackTarget_

template<typename SampleType >
double dspark::Saturation< SampleType >::feedbackTarget_ = 0.0
protected

Definition at line 4117 of file Saturation.h.

◆ feedingBefore_

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

The feedback ran in the last block.

Definition at line 4114 of file Saturation.h.

◆ focusRate_

template<typename SampleType >
double dspark::Saturation< SampleType >::focusRate_ = 0.0
protected

Definition at line 4122 of file Saturation.h.

◆ focusState_

template<typename SampleType >
std::array<double, kStageChannels> dspark::Saturation< SampleType >::focusState_ {}
protected

Definition at line 4128 of file Saturation.h.

◆ followDown_

template<typename SampleType >
double dspark::Saturation< SampleType >::followDown_ = 0.0
protected

Definition at line 4122 of file Saturation.h.

◆ followPower_

template<typename SampleType >
double dspark::Saturation< SampleType >::followPower_ = 0.0
protected

Definition at line 4123 of file Saturation.h.

◆ followUp_

template<typename SampleType >
double dspark::Saturation< SampleType >::followUp_ = 0.0
protected

Definition at line 4122 of file Saturation.h.

◆ gainPos_

template<typename SampleType >
int dspark::Saturation< SampleType >::gainPos_ = 0
protected

Definition at line 4134 of file Saturation.h.

◆ gainReductionDb_

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

Definition at line 4235 of file Saturation.h.

◆ gainRing_

template<typename SampleType >
std::vector<SampleType> dspark::Saturation< SampleType >::gainRing_
protected

Definition at line 4133 of file Saturation.h.

◆ gainSize_

template<typename SampleType >
int dspark::Saturation< SampleType >::gainSize_ = 64
protected

Definition at line 4134 of file Saturation.h.

◆ gainTail_

template<typename SampleType >
int dspark::Saturation< SampleType >::gainTail_ = 0
protected

Definition at line 4126 of file Saturation.h.

◆ kAlignRing

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kAlignRing = 32
staticconstexprprotected

‍largest delay (16 processing samples).

Definition at line 4251 of file Saturation.h.

◆ kAutomaticInternalRate

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kAutomaticInternalRate = 88200.0
staticconstexprprotected

Rate the automatic factor reaches.

Definition at line 4233 of file Saturation.h.

◆ kCalibrationBlock

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kCalibrationBlock = 256
staticconstexprprotected

Definition at line 4102 of file Saturation.h.

◆ kCalibrationEvery

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kCalibrationEvery = 0.05
staticconstexprprotected

Seconds between two measurements while the curve moves.

Definition at line 4103 of file Saturation.h.

◆ kCalibrationLevelDb

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kCalibrationLevelDb = -18.0
staticconstexprprotected

RMS level of the measuring noise.

Definition at line 4098 of file Saturation.h.

◆ kCalibrationQuiet

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kCalibrationQuiet = 0.01
staticconstexprprotected

Level of the reference run (-40 dB).

Definition at line 4101 of file Saturation.h.

◆ kCalibrationSamples

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kCalibrationSamples = 4096
staticconstexprprotected

Length of a measurement.

Definition at line 4099 of file Saturation.h.

◆ kCalibrationSkip

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kCalibrationSkip = 1024
staticconstexprprotected

Samples left out while the twin settles.

Definition at line 4100 of file Saturation.h.

◆ kCompensationShare

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kCompensationShare = 0.75
staticconstexprprotected

Share of the measured gain taken back.

Definition at line 4097 of file Saturation.h.

◆ kDcCornerHz

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDcCornerHz = 5.0
staticconstexprprotected

Definition at line 4187 of file Saturation.h.

◆ kDcFadeSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDcFadeSeconds = 0.05
staticconstexprprotected

The DC filter comes in or goes out in this time.

Definition at line 4188 of file Saturation.h.

◆ kDrivePanDb

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDrivePanDb = 6.0
staticconstexprprotected

Definition at line 4203 of file Saturation.h.

◆ kDryHoldSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDryHoldSeconds = 0.05
staticconstexprprotected

It is kept up this long after the mix has gone full wet.

Definition at line 4191 of file Saturation.h.

◆ kDynamicsReachDb

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDynamicsReachDb = 24.0
staticconstexprprotected

Most gain the dynamics apply, either way.

Definition at line 4095 of file Saturation.h.

◆ kDynamicsReferenceDb

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kDynamicsReferenceDb = -18.0
staticconstexprprotected

Level the dynamics bring the programme to.

Definition at line 4094 of file Saturation.h.

◆ keepRing_

template<typename SampleType >
std::array<SampleType, kAlignRing> dspark::Saturation< SampleType >::keepRing_ {}
protected

Definition at line 4255 of file Saturation.h.

◆ kEvenShare

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kEvenShare = 0.25
staticconstexprprotected

Share of the square added at asymmetry 1.

Definition at line 4096 of file Saturation.h.

◆ kLoopCloseLevel

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kLoopCloseLevel = 3.1622776601683794e-4
staticconstexprprotected

-70 dBFS: under it there is no programme.

Definition at line 4093 of file Saturation.h.

◆ kLoopCloseSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kLoopCloseSeconds = 0.02
staticconstexprprotected

Time constant the programme's level falls with, for the loop that closes.

Definition at line 4092 of file Saturation.h.

◆ kLoopOctaveSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kLoopOctaveSeconds = 0.1
staticconstexprprotected

Time the loop's delay takes to glide an octave.

Definition at line 4091 of file Saturation.h.

◆ kMaxCh

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

Definition at line 4238 of file Saturation.h.

◆ kMinFeedbackDelay

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

Shortest feedback line (and piece of a block).

Definition at line 4090 of file Saturation.h.

◆ kMinFeedbackHz

template<typename SampleType >
constexpr SampleType dspark::Saturation< SampleType >::kMinFeedbackHz = SampleType(20)
staticconstexprprotected

Lowest frequency of the tuned feedback.

Definition at line 4089 of file Saturation.h.

◆ kModeDipSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kModeDipSeconds = 0.005
staticconstexprprotected

The fall of a mode change's dip.

Definition at line 4189 of file Saturation.h.

◆ kModeRiseShare

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kModeRiseShare = 0.25
staticconstexprprotected

Its rise takes four times as long (the curves settle from rest).

Definition at line 4190 of file Saturation.h.

◆ kNoiseOffDb

template<typename SampleType >
constexpr SampleType dspark::Saturation< SampleType >::kNoiseOffDb = SampleType(-120)
staticconstexprprotected

Programme noise at or under this is off.

Definition at line 4088 of file Saturation.h.

◆ kNumAlgorithms

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

Definition at line 4155 of file Saturation.h.

◆ kStageChannels

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

Channels the stages keep a memory for.

Definition at line 4087 of file Saturation.h.

◆ kToneRampSeconds

template<typename SampleType >
constexpr double dspark::Saturation< SampleType >::kToneRampSeconds = 0.02
staticconstexprprotected

Definition at line 4206 of file Saturation.h.

◆ kToneSections

template<typename SampleType >
constexpr int dspark::Saturation< SampleType >::kToneSections = 4
staticconstexprprotected

Definition at line 4205 of file Saturation.h.

◆ lastParams_

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

Definition at line 4161 of file Saturation.h.

◆ lastPostTiltFreq_

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

Definition at line 4247 of file Saturation.h.

◆ lastPostTiltGain_

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

Definition at line 4248 of file Saturation.h.

◆ lastPreHpFreq_

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

Definition at line 4246 of file Saturation.h.

◆ leftDrift_

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

Definition at line 4224 of file Saturation.h.

◆ levelTracking_

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

Definition at line 4107 of file Saturation.h.

◆ loopDelayNow_

template<typename SampleType >
double dspark::Saturation< SampleType >::loopDelayNow_ = 0.0
protected

Definition at line 4118 of file Saturation.h.

◆ loopGlide_

template<typename SampleType >
double dspark::Saturation< SampleType >::loopGlide_ = 1.0
protected

The loop's delay now, in samples (0: not started), and its glide per sample.

Definition at line 4118 of file Saturation.h.

◆ loopOpen_

template<typename SampleType >
double dspark::Saturation< SampleType >::loopOpen_ = 1.0
protected

The loop that closes: the level of the input, its fall, how open the loop is.

Definition at line 4119 of file Saturation.h.

◆ mixSmoother_

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

Definition at line 4173 of file Saturation.h.

◆ modeDip_

template<typename SampleType >
double dspark::Saturation< SampleType >::modeDip_ = 0.0
protected

Definition at line 4219 of file Saturation.h.

◆ modeDipDown_

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

Definition at line 4220 of file Saturation.h.

◆ modeDipping_

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

Definition at line 4220 of file Saturation.h.

◆ modeDipStep_

template<typename SampleType >
double dspark::Saturation< SampleType >::modeDipStep_ = 1.0 / 240.0
protected

0 = the wet side, 1 = the dry

Definition at line 4219 of file Saturation.h.

◆ msKeepBuffer_

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

MidOnly/SideOnly channel snapshot.

Definition at line 4228 of file Saturation.h.

◆ next_

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

Definition at line 4158 of file Saturation.h.

◆ noiseFall_

template<typename SampleType >
double dspark::Saturation< SampleType >::noiseFall_ = 0.0
protected

Definition at line 4123 of file Saturation.h.

◆ noiseGain_

template<typename SampleType >
double dspark::Saturation< SampleType >::noiseGain_ = 0.0
protected

Definition at line 4123 of file Saturation.h.

◆ noiseHoldLeft_

template<typename SampleType >
int dspark::Saturation< SampleType >::noiseHoldLeft_ = 0
protected

Definition at line 4125 of file Saturation.h.

◆ noiseHoldSamples_

template<typename SampleType >
int dspark::Saturation< SampleType >::noiseHoldSamples_ = 0
protected

Definition at line 4125 of file Saturation.h.

◆ noisePeak_

template<typename SampleType >
double dspark::Saturation< SampleType >::noisePeak_ = 0.0
protected

Definition at line 4123 of file Saturation.h.

◆ noiseSeed_

template<typename SampleType >
std::array<uint32_t, kStageChannels> dspark::Saturation< SampleType >::noiseSeed_
protected
Initial value:
{ 0x1234567u, 0x89ABCDEu, 0x3C6EF37u, 0x5851F42u,
0x14057B7u, 0x2B992DDu, 0x7F4A7C1u, 0x61C8864u,
0x0BADF00u, 0x1F123BBu, 0x5DEECE6u, 0x41C64E6u,
0x6C07896u, 0x27D4EB2u, 0x165667Bu, 0x4F6CDD1u }

Definition at line 4129 of file Saturation.h.

◆ outputGainSmoother_

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

Definition at line 4174 of file Saturation.h.

◆ outputMode_

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

Definition at line 4168 of file Saturation.h.

◆ oversampler_

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

Definition at line 4230 of file Saturation.h.

◆ oversamplingAutomatic_

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

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

Definition at line 4232 of file Saturation.h.

◆ oversamplingBand_

template<typename SampleType >
OversamplingBand dspark::Saturation< SampleType >::oversamplingBand_ = OversamplingBand::Preset
protected

setOversamplingBand() (setup thread).

Definition at line 4148 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 4231 of file Saturation.h.

◆ oversamplingMode_

template<typename SampleType >
OversamplingMode dspark::Saturation< SampleType >::oversamplingMode_ = OversamplingMode::LinearPhase
protected

Definition at line 4147 of file Saturation.h.

◆ panFrom_

template<typename SampleType >
std::array<SampleType, 2> dspark::Saturation< SampleType >::panFrom_ { SampleType(1), SampleType(1) }
protected

Definition at line 4201 of file Saturation.h.

◆ panning_

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

Definition at line 4202 of file Saturation.h.

◆ panNow_

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::panNow_ = SampleType(0)
protected

Definition at line 4200 of file Saturation.h.

◆ panTo_

template<typename SampleType >
std::array<SampleType, 2> dspark::Saturation< SampleType >::panTo_ { SampleType(1), SampleType(1) }
protected

Definition at line 4201 of file Saturation.h.

◆ paramQueue_

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

Definition at line 4160 of file Saturation.h.

◆ paramsLock_

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

Definition at line 4163 of file Saturation.h.

◆ paramsPending_

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

Definition at line 4164 of file Saturation.h.

◆ pendingMode_

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

Definition at line 4218 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 4156 of file Saturation.h.

◆ postFilter_

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

Definition at line 4177 of file Saturation.h.

◆ postTiltFreqSmoother_

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

Definition at line 4172 of file Saturation.h.

◆ postTiltGainSmoother_

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

Definition at line 4174 of file Saturation.h.

◆ preFilter_

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

Definition at line 4177 of file Saturation.h.

◆ preHpSmoother_

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

Definition at line 4172 of file Saturation.h.

◆ prepared_

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

Definition at line 4153 of file Saturation.h.

◆ prevBlendSample_

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

Definition at line 4239 of file Saturation.h.

◆ prevSlewSample_

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

Definition at line 4244 of file Saturation.h.

◆ procMode_

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

Definition at line 4167 of file Saturation.h.

◆ programFall_

template<typename SampleType >
double dspark::Saturation< SampleType >::programFall_ = 0.999
protected

Definition at line 4119 of file Saturation.h.

◆ programNoiseDb_

template<typename SampleType >
std::atomic<SampleType> dspark::Saturation< SampleType >::programNoiseDb_ { kNoiseOffDb }
protected

Definition at line 4106 of file Saturation.h.

◆ programPeak_

template<typename SampleType >
double dspark::Saturation< SampleType >::programPeak_ = 0.0
protected

Definition at line 4119 of file Saturation.h.

◆ rightDrift_

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

Definition at line 4224 of file Saturation.h.

◆ secondActive_

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

Definition at line 4252 of file Saturation.h.

◆ slewRateScale_

template<typename SampleType >
SampleType dspark::Saturation< SampleType >::slewRateScale_ = SampleType(1)
protected

Processing rate / 96 kHz.

Definition at line 4242 of file Saturation.h.

◆ slewSensitivity_

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

Definition at line 4241 of file Saturation.h.

◆ spec_

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

Definition at line 4152 of file Saturation.h.

◆ stageLatency_

template<typename SampleType >
int dspark::Saturation< SampleType >::stageLatency_ = 0
protected

Definition at line 4126 of file Saturation.h.

◆ stageRate_

template<typename SampleType >
double dspark::Saturation< SampleType >::stageRate_ = 0.0
protected

Definition at line 4122 of file Saturation.h.

◆ stagesOn_

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

Definition at line 4113 of file Saturation.h.

◆ tempBuffer_

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

Definition at line 4226 of file Saturation.h.

◆ tone_

template<typename SampleType >
std::unique_ptr<BiquadCascade<SampleType, 4, 16> > dspark::Saturation< SampleType >::tone_
protected

Definition at line 4210 of file Saturation.h.

◆ toneDb_

template<typename SampleType >
std::array<std::atomic<SampleType>, 4> dspark::Saturation< SampleType >::toneDb_ { SampleType(0), SampleType(0), SampleType(0), SampleType(0) }
protected

Definition at line 4208 of file Saturation.h.

◆ toneDirty_

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

Definition at line 4209 of file Saturation.h.

◆ toneHz_

template<typename SampleType >
std::array<std::atomic<SampleType>, 4> dspark::Saturation< SampleType >::toneHz_ { SampleType(100), SampleType(500), SampleType(2500), SampleType(8000) }
protected

Definition at line 4207 of file Saturation.h.

◆ toneLeft_

template<typename SampleType >
std::array<int, 4> dspark::Saturation< SampleType >::toneLeft_ { -1, -1, -1, -1 }
protected

Definition at line 4211 of file Saturation.h.

◆ toneOn_

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

Definition at line 4212 of file Saturation.h.

◆ trackingCornerHz_

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

Definition at line 4108 of file Saturation.h.

◆ userOutputGainDb_

template<typename SampleType >
float dspark::Saturation< SampleType >::userOutputGainDb_ = 0.0f
protected

Definition at line 4142 of file Saturation.h.


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