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

Downward expander with ratio control, hysteresis, and sidechain. More...

#include <Expander.h>

Collaboration diagram for dspark::Expander< T >:

Public Types

enum class  State { Closed , Open , Hold }
 
using KeyEq = KeyEqualizer< T, 16 >
 The equalizer of the key (see setSidechainBand()).
 
using KeyBand = typename KeyEq::Band
 The settings of one band of the key equalizer.
 
using KeyShape = typename KeyEq::Shape
 What a band of the key equalizer does.
 
using KeyPlacement = typename KeyEq::Placement
 The part of a two-channel key a band of the key equalizer acts on.
 

Public Member Functions

 ~Expander ()=default
 
void prepare (double sampleRate, int numChannels=2) noexcept
 Initializes the expander with a specific sample rate.
 
void prepare (const AudioSpec &spec) noexcept
 Initializes the expander using an AudioSpec struct.
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes an audio block in place (internal detector key).
 
void processBlock (AudioBufferView< T > buffer, AudioBufferView< T > sidechain) noexcept
 Processes an audio block in place, keyed by an external sidechain.
 
void setThreshold (T dB) noexcept
 Sets the threshold in decibels.
 
void setRatio (T ratio) noexcept
 Sets the expansion ratio (e.g., 4.0 for 4:1).
 
void setHysteresis (T dB) noexcept
 Sets the hysteresis gap in decibels to prevent chattering.
 
void setRange (T dB) noexcept
 Sets the maximum gain reduction limit in decibels (<= 0).
 
void setAttack (T ms) noexcept
 Sets the attack time in milliseconds.
 
void setHold (T ms) noexcept
 Sets the hold time in milliseconds before release begins.
 
void setRelease (T ms) noexcept
 Sets the release time in milliseconds.
 
void setSidechainHPF (bool enabled, double cutoffHz=80.0) noexcept
 Enables and configures the sidechain high-pass filter.
 
void setSidechainBand (int band, const KeyBand &settings) noexcept
 Sets a band of the equalizer of the key.
 
KeyBand getSidechainBand (int band) const noexcept
 The settings of a band of the key equalizer.
 
KeyEq::Response getSidechainResponse () const noexcept
 The curve of the key equalizer, for a display.
 
void setSidechainListen (bool on) noexcept
 Plays the key instead of the expanded audio.
 
bool isSidechainListen () const noexcept
 Whether the key is being played instead of the audio.
 
void setLookahead (T ms) noexcept
 Sets the lookahead: the audio is delayed so the gain moves ahead of it. 0 (default) is latency-free.
 
T getLookahead () const noexcept
 Returns the lookahead in milliseconds.
 
void setAutoThreshold (bool on) noexcept
 Counts the threshold from the key's own recent level.
 
bool isAutoThreshold () const noexcept
 Whether the threshold counts from the key's recent level (see setAutoThreshold()).
 
int getLatency () const noexcept
 Latency in samples (the lookahead), correct right after setLookahead().
 
State getGateState () const noexcept
 
T getCurrentGainDb () const noexcept
 
void reset () noexcept
 Resets all internal DSP states to prevent clicks on playback start.
 
std::vector< uint8_t > getState () const
 Serializes the parameter state (setup/UI threads; allocates).
 
bool setState (const uint8_t *data, size_t size)
 Restores parameters from a blob (tolerant; rejects foreign ids).
 

Protected Member Functions

void cacheParams () noexcept
 
int lookaheadSamplesFor (T ms) const noexcept
 
template<bool UseHPF>
T keyInput (T raw, int ch) noexcept
 One sample of a channel's key before its equalizer: made finite and, when UseHPF, through the sidechain high-pass.
 
template<bool UseHPF, bool UseSc>
void processBlockInternal (AudioBufferView< T > buffer, const AudioBufferView< T > *sidechain) noexcept
 Internal processing loop templated on HPF/sidechain to avoid branching.
 
void publishMeters () noexcept
 Publishes the metering words for cross-thread readout.
 
void updateStateMachine (T levelDb) noexcept
 
T computeGain (T levelDb) noexcept
 
void updateCoefficients () noexcept
 

Protected Attributes

double sampleRate_ = 48000.0
 
bool prepared_ = false
 
std::atomic< T > threshold_ { T(-40) }
 
std::atomic< T > ratio_ { T(4) }
 
std::atomic< T > hysteresis_ { T(4) }
 
std::atomic< T > attackMs_ { T(0.5) }
 
std::atomic< T > holdMs_ { T(50) }
 
std::atomic< T > releaseMs_ { T(100) }
 
std::atomic< T > rangeDb_ { T(-80) }
 
std::atomic< T > rangeLinear_ { T(0.0001) }
 
std::atomic< bool > scHpfEnabled_ { false }
 
std::atomic< T > scHpfFreqHz_ { T(80) }
 
std::atomic< T > scHpfCoeff_ { T(0.995) }
 
std::atomic< T > scHpfA0_ { T(0.9975) }
 
std::array< T, MAX_CHANNELS > scHpfState_ {}
 
std::array< T, MAX_CHANNELS > scHpfPrev_ {}
 
KeyEq keyEq_
 Equalizer of the key, after the high-pass.
 
KeyMonitor< T, 16 > keyMonitor_
 The listened key: late by the lookahead, under full scale.
 
std::atomic< bool > scListen_ { false }
 The key goes out instead of the audio.
 
bool keyOn_ = false
 The equalizer has bands in the path (audio thread).
 
bool listen_ = false
 scListen_ as the audio thread took it.
 
std::atomic< T > lookaheadMs_ { T(0) }
 
int cachedLookahead_ = 0
 Audio-side samples (per block).
 
int maxLookaheadSamples_ = 0
 Allocated delay (0 before prepare()).
 
int lookaheadChannels_ = 0
 Channels with a prepared delay line.
 
std::array< RingBuffer< T >, MAX_CHANNELS > lookahead_ {}
 
std::atomic< T > attackCoeff_ { T(0) }
 
std::atomic< T > releaseCoeff_ { T(0) }
 
std::atomic< T > detRelCoeff_ { T(0.001) }
 
std::atomic< int > holdSamples_ { 0 }
 
T cachedThreshold_ = T(-40)
 
T cachedRatio_ = T(4)
 
T cachedHysteresis_ = T(4)
 
T cachedRangeLinear_ = T(0.0001)
 
T cachedAttackCoeff_ = T(0)
 
T cachedReleaseCoeff_ = T(0)
 
T cachedDetRelCoeff_ = T(0.001)
 
T cachedScHpfCoeff_ = T(0.995)
 
T cachedScHpfA0_ = T(0.9975)
 
int cachedHoldSamples_ = 0
 
bool cachedScHpfEnabled_ = false
 
std::atomic< bool > autoThreshold_ { false }
 The threshold counts from the key's recent level.
 
bool cachedAutoThreshold_ = false
 
double autoRefDb_ = -100.0
 The reference (dB).
 
double autoRefFall_ = 0.0
 Its fall per sample (dB).
 
T thresholdNow_ = T(-40)
 Threshold of the frame (dB).
 
State state_ = State::Closed
 
T gateGain_ = T(0)
 
std::atomic< State > publishedState_ { State::Closed }
 
std::atomic< T > publishedGateGain_ { T(0) }
 
T envelope_ = T(0)
 
int holdCounter_ = 0
 
std::array< HilbertIIR< double >, MAX_CHANNELS > analytic_ {}
 
std::array< double, kDetChunk > detIn_ {}
 
std::array< double, kDetChunk > detMag_ {}
 
std::array< T, kDetChunk > detLevel_ {}
 
std::array< std::array< T, kDetChunk >, MAX_CHANNELS > heard_ {}
 The key of each channel in this chunk.
 

Static Protected Attributes

static constexpr int MAX_CHANNELS = 16
 
static constexpr double kMaxLookaheadMs = 10.0
 
static constexpr double kAutoRefFallDb = 1.0
 dB per second its reference falls.
 
static constexpr double kAutoRefQuiet = 0.25
 Share of that fall while the key is under the closing threshold.
 
static constexpr int kDetChunk = 64
 

Detailed Description

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

Downward expander with ratio control, hysteresis, and sidechain.

Template Parameters
TSample type (float or double).

Definition at line 75 of file Expander.h.

Member Typedef Documentation

◆ KeyBand

template<FloatType T>
using dspark::Expander< T >::KeyBand = typename KeyEq::Band

The settings of one band of the key equalizer.

Definition at line 258 of file Expander.h.

◆ KeyEq

template<FloatType T>
using dspark::Expander< T >::KeyEq = KeyEqualizer<T, 16>

The equalizer of the key (see setSidechainBand()).

Definition at line 256 of file Expander.h.

◆ KeyPlacement

template<FloatType T>
using dspark::Expander< T >::KeyPlacement = typename KeyEq::Placement

The part of a two-channel key a band of the key equalizer acts on.

Definition at line 262 of file Expander.h.

◆ KeyShape

template<FloatType T>
using dspark::Expander< T >::KeyShape = typename KeyEq::Shape

What a band of the key equalizer does.

Definition at line 260 of file Expander.h.

Member Enumeration Documentation

◆ State

template<FloatType T>
enum class dspark::Expander::State
strong
Enumerator
Closed 
Open 
Hold 

Definition at line 80 of file Expander.h.

Constructor & Destructor Documentation

◆ ~Expander()

template<FloatType T>
dspark::Expander< T >::~Expander ( )
default

Member Function Documentation

◆ cacheParams()

template<FloatType T>
void dspark::Expander< T >::cacheParams ( )
inlineprotectednoexcept

Definition at line 436 of file Expander.h.

◆ computeGain()

template<FloatType T>
T dspark::Expander< T >::computeGain ( T  levelDb)
inlineprotectednoexcept

Definition at line 654 of file Expander.h.

◆ getCurrentGainDb()

template<FloatType T>
T dspark::Expander< T >::getCurrentGainDb ( ) const
inlinenoexcept
Returns
The current actual gain being applied, in decibels. Safe from any thread: loads a published atomic word, so it may be up to one block behind (same reason as getGateState()).

Definition at line 369 of file Expander.h.

◆ getGateState()

template<FloatType T>
State dspark::Expander< T >::getGateState ( ) const
inlinenoexcept
Returns
The current state of the expander's logic gate. Safe from any thread: loads a published atomic word, so it may be up to one block behind. It used to read the plain member the audio thread writes per sample – a data race, not merely an approximate number. (Renamed from getState(), which now follows the framework-wide preset serialization convention.)

Definition at line 361 of file Expander.h.

◆ getLatency()

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

Latency in samples (the lookahead), correct right after setLookahead().

Definition at line 348 of file Expander.h.

◆ getLookahead()

template<FloatType T>
T dspark::Expander< T >::getLookahead ( ) const
inlinenoexcept

Returns the lookahead in milliseconds.

Definition at line 324 of file Expander.h.

◆ getSidechainBand()

template<FloatType T>
KeyBand dspark::Expander< T >::getSidechainBand ( int  band) const
inlinenoexcept

The settings of a band of the key equalizer.

Definition at line 286 of file Expander.h.

◆ getSidechainResponse()

template<FloatType T>
KeyEq::Response dspark::Expander< T >::getSidechainResponse ( ) const
inlinenoexcept

The curve of the key equalizer, for a display.

Definition at line 289 of file Expander.h.

◆ getState()

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

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

Definition at line 395 of file Expander.h.

◆ isAutoThreshold()

template<FloatType T>
bool dspark::Expander< T >::isAutoThreshold ( ) const
inlinenoexcept

Whether the threshold counts from the key's recent level (see setAutoThreshold()).

Definition at line 345 of file Expander.h.

◆ isSidechainListen()

template<FloatType T>
bool dspark::Expander< T >::isSidechainListen ( ) const
inlinenoexcept

Whether the key is being played instead of the audio.

Definition at line 304 of file Expander.h.

◆ keyInput()

template<FloatType T>
template<bool UseHPF>
T dspark::Expander< T >::keyInput ( T  raw,
int  ch 
)
inlineprotectednoexcept

One sample of a channel's key before its equalizer: made finite and, when UseHPF, through the sidechain high-pass.

Definition at line 468 of file Expander.h.

◆ lookaheadSamplesFor()

template<FloatType T>
int dspark::Expander< T >::lookaheadSamplesFor ( T  ms) const
inlineprotectednoexcept

Lookahead in samples for a ms value (shared by cacheParams() and getLatency()).

Definition at line 457 of file Expander.h.

◆ prepare() [1/2]

template<FloatType T>
void dspark::Expander< T >::prepare ( const AudioSpec &  spec)
inlinenoexcept

Initializes the expander using an AudioSpec struct.

Parameters
specFramework audio specification object (invalid specs are ignored).

Definition at line 115 of file Expander.h.

◆ prepare() [2/2]

template<FloatType T>
void dspark::Expander< T >::prepare ( double  sampleRate,
int  numChannels = 2 
)
inlinenoexcept

Initializes the expander with a specific sample rate.

Parameters
sampleRateThe sample rate in Hz. Non-finite or non-positive rates are ignored (previous state is kept).
numChannelsChannels that receive the lookahead delay (clamped to [1, 16]); further channels are processed undelayed.

Definition at line 91 of file Expander.h.

◆ processBlock() [1/2]

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

Processes an audio block in place (internal detector key).

Parameters
bufferView of the audio buffer to process.

Definition at line 125 of file Expander.h.

◆ processBlock() [2/2]

template<FloatType T>
void dspark::Expander< T >::processBlock ( AudioBufferView< T >  buffer,
AudioBufferView< T >  sidechain 
)
inlinenoexcept

Processes an audio block in place, keyed by an external sidechain.

The detector (and its optional HPF) runs on the sidechain channels; the resulting gain is applied to the audio buffer. If the sidechain is empty or shorter than the audio block, the internal key is used instead.

Parameters
bufferAudio to process in place.
sidechainDetector key signal (not modified).

Definition at line 147 of file Expander.h.

◆ processBlockInternal()

template<FloatType T>
template<bool UseHPF, bool UseSc>
void dspark::Expander< T >::processBlockInternal ( AudioBufferView< T >  buffer,
const AudioBufferView< T > *  sidechain 
)
inlineprotectednoexcept

Internal processing loop templated on HPF/sidechain to avoid branching.

Template Parameters
UseHPFCompile-time flag to include HPF processing.
UseScCompile-time flag: detector keyed by the external sidechain.
Parameters
bufferView of the audio buffer (gain target).
sidechainDetector key when UseSc (guaranteed >= buffer length).

Definition at line 492 of file Expander.h.

◆ publishMeters()

template<FloatType T>
void dspark::Expander< T >::publishMeters ( )
inlineprotectednoexcept

Publishes the metering words for cross-thread readout.

Two relaxed stores per block, outside the per-sample loop: the getters used to read state_ and gateGain_ directly, which are plain words the audio thread writes every sample.

Definition at line 622 of file Expander.h.

◆ reset()

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

Resets all internal DSP states to prevent clicks on playback start.

Definition at line 375 of file Expander.h.

◆ setAttack()

template<FloatType T>
void dspark::Expander< T >::setAttack ( T  ms)
inlinenoexcept

Sets the attack time in milliseconds.

Definition at line 205 of file Expander.h.

◆ setAutoThreshold()

template<FloatType T>
void dspark::Expander< T >::setAutoThreshold ( bool  on)
inlinenoexcept

Counts the threshold from the key's own recent level.

A reference follows the detected level: it rises at once and falls 1 dB per second, and the threshold is added to it. The expander then acts the same at any input level: a threshold of -40 dB closes on what lies more than 40 dB under the programme's recent peaks. While the key is under the closing threshold the reference falls a quarter as fast, so a pause lowers the threshold by 1 dB every four seconds: far enough into a long one the floor opens the expander again (the range bounds what that lets through), and a stray peak that left the programme under the threshold is forgotten at that pace. Off by default: the threshold is in dBFS.

State key "autoThreshold" (absent = off).

Definition at line 342 of file Expander.h.

◆ setHold()

template<FloatType T>
void dspark::Expander< T >::setHold ( T  ms)
inlinenoexcept

Sets the hold time in milliseconds before release begins.

Definition at line 213 of file Expander.h.

◆ setHysteresis()

template<FloatType T>
void dspark::Expander< T >::setHysteresis ( T  dB)
inlinenoexcept

Sets the hysteresis gap in decibels to prevent chattering.

Definition at line 189 of file Expander.h.

◆ setLookahead()

template<FloatType T>
void dspark::Expander< T >::setLookahead ( T  ms)
inlinenoexcept

Sets the lookahead: the audio is delayed so the gain moves ahead of it. 0 (default) is latency-free.

RT-safe publication, consumed at the next block; change it while stopped (a live change jumps the delay and may click). Report getLatency() to the host for delay compensation.

Parameters
msLookahead in milliseconds, clamped to [0, 10]. Non-finite values are ignored.

Definition at line 317 of file Expander.h.

◆ setRange()

template<FloatType T>
void dspark::Expander< T >::setRange ( T  dB)
inlinenoexcept

Sets the maximum gain reduction limit in decibels (<= 0).

Definition at line 196 of file Expander.h.

◆ setRatio()

template<FloatType T>
void dspark::Expander< T >::setRatio ( T  ratio)
inlinenoexcept

Sets the expansion ratio (e.g., 4.0 for 4:1).

Definition at line 182 of file Expander.h.

◆ setRelease()

template<FloatType T>
void dspark::Expander< T >::setRelease ( T  ms)
inlinenoexcept

Sets the release time in milliseconds.

Definition at line 229 of file Expander.h.

◆ setSidechainBand()

template<FloatType T>
void dspark::Expander< T >::setSidechainBand ( int  band,
const KeyBand &  settings 
)
inlinenoexcept

Sets a band of the equalizer of the key.

Six bands (cuts from 6 to 48 dB per octave, bells, shelves, a tilt) shape what the detector weighs, after the sidechain high-pass, on the programme or on the external key, and never on the audio. A band that keeps its form glides to a new setting over 20 ms and a change of shape crosses over the same time; a band that is Off costs nothing. The detector reads the loudest channel of the key.

With a two-channel key a band can sit on both channels, on the middle of the pair or on its sides (KeyBand::placement): a low cut on the middle keeps a centred bass from holding the expander open while what is wide still does. Keys of one channel or of more than two take every band on every channel.

Parameters
bandBand index in [0, KeyEq::kBands); others are ignored.
settingsShape, frequency, gain, q, slope and placement of the band.

Definition at line 283 of file Expander.h.

◆ setSidechainHPF()

template<FloatType T>
void dspark::Expander< T >::setSidechainHPF ( bool  enabled,
double  cutoffHz = 80.0 
)
inlinenoexcept

Enables and configures the sidechain high-pass filter.

Invalid cutoffs (non-finite or <= 0) keep the previous frequency and only apply the toggle; the design clamp is [1, 0.45 * sampleRate]. A negative cutoff used to flip the one-pole into an unstable growth filter, blowing up the detector and pinning the expander open.

Parameters
enabledTrue to engage the HPF.
cutoffHzCutoff frequency in Hz.

Definition at line 247 of file Expander.h.

◆ setSidechainListen()

template<FloatType T>
void dspark::Expander< T >::setSidechainListen ( bool  on)
inlinenoexcept

Plays the key instead of the expanded audio.

Each channel puts out what the detector hears of it (the key after the high-pass and the equalizer; the last key channel where it has none), late by the lookahead (the latency the expander reports, so the track keeps its place) and held under full scale (KeyMonitor), while the expander keeps working underneath. A monitoring switch: it is not part of the state.

Definition at line 301 of file Expander.h.

◆ setState()

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

Restores parameters from a blob (tolerant; rejects foreign ids).

Definition at line 416 of file Expander.h.

◆ setThreshold()

template<FloatType T>
void dspark::Expander< T >::setThreshold ( T  dB)
inlinenoexcept

Sets the threshold in decibels.

Definition at line 175 of file Expander.h.

◆ updateCoefficients()

template<FloatType T>
void dspark::Expander< T >::updateCoefficients ( )
inlineprotectednoexcept

Definition at line 686 of file Expander.h.

◆ updateStateMachine()

template<FloatType T>
void dspark::Expander< T >::updateStateMachine ( T  levelDb)
inlineprotectednoexcept

Definition at line 628 of file Expander.h.

Member Data Documentation

◆ analytic_

template<FloatType T>
std::array<HilbertIIR<double>, MAX_CHANNELS> dspark::Expander< T >::analytic_ {}
protected

Definition at line 782 of file Expander.h.

◆ attackCoeff_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::attackCoeff_ { T(0) }
protected

Definition at line 745 of file Expander.h.

◆ attackMs_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::attackMs_ { T(0.5) }
protected

Definition at line 716 of file Expander.h.

◆ autoRefDb_

template<FloatType T>
double dspark::Expander< T >::autoRefDb_ = -100.0
protected

The reference (dB).

Definition at line 768 of file Expander.h.

◆ autoRefFall_

template<FloatType T>
double dspark::Expander< T >::autoRefFall_ = 0.0
protected

Its fall per sample (dB).

Definition at line 769 of file Expander.h.

◆ autoThreshold_

template<FloatType T>
std::atomic<bool> dspark::Expander< T >::autoThreshold_ { false }
protected

The threshold counts from the key's recent level.

Definition at line 766 of file Expander.h.

◆ cachedAttackCoeff_

template<FloatType T>
T dspark::Expander< T >::cachedAttackCoeff_ = T(0)
protected

Definition at line 755 of file Expander.h.

◆ cachedAutoThreshold_

template<FloatType T>
bool dspark::Expander< T >::cachedAutoThreshold_ = false
protected

Definition at line 767 of file Expander.h.

◆ cachedDetRelCoeff_

template<FloatType T>
T dspark::Expander< T >::cachedDetRelCoeff_ = T(0.001)
protected

Definition at line 757 of file Expander.h.

◆ cachedHoldSamples_

template<FloatType T>
int dspark::Expander< T >::cachedHoldSamples_ = 0
protected

Definition at line 760 of file Expander.h.

◆ cachedHysteresis_

template<FloatType T>
T dspark::Expander< T >::cachedHysteresis_ = T(4)
protected

Definition at line 753 of file Expander.h.

◆ cachedLookahead_

template<FloatType T>
int dspark::Expander< T >::cachedLookahead_ = 0
protected

Audio-side samples (per block).

Definition at line 740 of file Expander.h.

◆ cachedRangeLinear_

template<FloatType T>
T dspark::Expander< T >::cachedRangeLinear_ = T(0.0001)
protected

Definition at line 754 of file Expander.h.

◆ cachedRatio_

template<FloatType T>
T dspark::Expander< T >::cachedRatio_ = T(4)
protected

Definition at line 752 of file Expander.h.

◆ cachedReleaseCoeff_

template<FloatType T>
T dspark::Expander< T >::cachedReleaseCoeff_ = T(0)
protected

Definition at line 756 of file Expander.h.

◆ cachedScHpfA0_

template<FloatType T>
T dspark::Expander< T >::cachedScHpfA0_ = T(0.9975)
protected

Definition at line 759 of file Expander.h.

◆ cachedScHpfCoeff_

template<FloatType T>
T dspark::Expander< T >::cachedScHpfCoeff_ = T(0.995)
protected

Definition at line 758 of file Expander.h.

◆ cachedScHpfEnabled_

template<FloatType T>
bool dspark::Expander< T >::cachedScHpfEnabled_ = false
protected

Definition at line 761 of file Expander.h.

◆ cachedThreshold_

template<FloatType T>
T dspark::Expander< T >::cachedThreshold_ = T(-40)
protected

Definition at line 751 of file Expander.h.

◆ detIn_

template<FloatType T>
std::array<double, kDetChunk> dspark::Expander< T >::detIn_ {}
protected

Definition at line 783 of file Expander.h.

◆ detLevel_

template<FloatType T>
std::array<T, kDetChunk> dspark::Expander< T >::detLevel_ {}
protected

Definition at line 785 of file Expander.h.

◆ detMag_

template<FloatType T>
std::array<double, kDetChunk> dspark::Expander< T >::detMag_ {}
protected

Definition at line 784 of file Expander.h.

◆ detRelCoeff_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::detRelCoeff_ { T(0.001) }
protected

Definition at line 747 of file Expander.h.

◆ envelope_

template<FloatType T>
T dspark::Expander< T >::envelope_ = T(0)
protected

Definition at line 777 of file Expander.h.

◆ gateGain_

template<FloatType T>
T dspark::Expander< T >::gateGain_ = T(0)
protected

Definition at line 773 of file Expander.h.

◆ heard_

template<FloatType T>
std::array<std::array<T, kDetChunk>, MAX_CHANNELS> dspark::Expander< T >::heard_ {}
protected

The key of each channel in this chunk.

Definition at line 786 of file Expander.h.

◆ holdCounter_

template<FloatType T>
int dspark::Expander< T >::holdCounter_ = 0
protected

Definition at line 778 of file Expander.h.

◆ holdMs_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::holdMs_ { T(50) }
protected

Definition at line 717 of file Expander.h.

◆ holdSamples_

template<FloatType T>
std::atomic<int> dspark::Expander< T >::holdSamples_ { 0 }
protected

Definition at line 748 of file Expander.h.

◆ hysteresis_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::hysteresis_ { T(4) }
protected

Definition at line 715 of file Expander.h.

◆ kAutoRefFallDb

template<FloatType T>
constexpr double dspark::Expander< T >::kAutoRefFallDb = 1.0
staticconstexprprotected

dB per second its reference falls.

Definition at line 764 of file Expander.h.

◆ kAutoRefQuiet

template<FloatType T>
constexpr double dspark::Expander< T >::kAutoRefQuiet = 0.25
staticconstexprprotected

Share of that fall while the key is under the closing threshold.

Definition at line 765 of file Expander.h.

◆ kDetChunk

template<FloatType T>
constexpr int dspark::Expander< T >::kDetChunk = 64
staticconstexprprotected

Definition at line 781 of file Expander.h.

◆ keyEq_

template<FloatType T>
KeyEq dspark::Expander< T >::keyEq_
protected

Equalizer of the key, after the high-pass.

Definition at line 731 of file Expander.h.

◆ keyMonitor_

template<FloatType T>
KeyMonitor<T, 16> dspark::Expander< T >::keyMonitor_
protected

The listened key: late by the lookahead, under full scale.

Definition at line 732 of file Expander.h.

◆ keyOn_

template<FloatType T>
bool dspark::Expander< T >::keyOn_ = false
protected

The equalizer has bands in the path (audio thread).

Definition at line 734 of file Expander.h.

◆ kMaxLookaheadMs

template<FloatType T>
constexpr double dspark::Expander< T >::kMaxLookaheadMs = 10.0
staticconstexprprotected

Definition at line 738 of file Expander.h.

◆ listen_

template<FloatType T>
bool dspark::Expander< T >::listen_ = false
protected

scListen_ as the audio thread took it.

Definition at line 735 of file Expander.h.

◆ lookahead_

template<FloatType T>
std::array<RingBuffer<T>, MAX_CHANNELS> dspark::Expander< T >::lookahead_ {}
protected

Definition at line 743 of file Expander.h.

◆ lookaheadChannels_

template<FloatType T>
int dspark::Expander< T >::lookaheadChannels_ = 0
protected

Channels with a prepared delay line.

Definition at line 742 of file Expander.h.

◆ lookaheadMs_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::lookaheadMs_ { T(0) }
protected

Definition at line 739 of file Expander.h.

◆ MAX_CHANNELS

template<FloatType T>
constexpr int dspark::Expander< T >::MAX_CHANNELS = 16
staticconstexprprotected

Definition at line 728 of file Expander.h.

◆ maxLookaheadSamples_

template<FloatType T>
int dspark::Expander< T >::maxLookaheadSamples_ = 0
protected

Allocated delay (0 before prepare()).

Definition at line 741 of file Expander.h.

◆ prepared_

template<FloatType T>
bool dspark::Expander< T >::prepared_ = false
protected

Definition at line 711 of file Expander.h.

◆ publishedGateGain_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::publishedGateGain_ { T(0) }
protected

Definition at line 776 of file Expander.h.

◆ publishedState_

template<FloatType T>
std::atomic<State> dspark::Expander< T >::publishedState_ { State::Closed }
protected

Definition at line 775 of file Expander.h.

◆ rangeDb_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::rangeDb_ { T(-80) }
protected

Definition at line 719 of file Expander.h.

◆ rangeLinear_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::rangeLinear_ { T(0.0001) }
protected

Definition at line 720 of file Expander.h.

◆ ratio_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::ratio_ { T(4) }
protected

Definition at line 714 of file Expander.h.

◆ releaseCoeff_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::releaseCoeff_ { T(0) }
protected

Definition at line 746 of file Expander.h.

◆ releaseMs_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::releaseMs_ { T(100) }
protected

Definition at line 718 of file Expander.h.

◆ sampleRate_

template<FloatType T>
double dspark::Expander< T >::sampleRate_ = 48000.0
protected

Definition at line 710 of file Expander.h.

◆ scHpfA0_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::scHpfA0_ { T(0.9975) }
protected

Definition at line 725 of file Expander.h.

◆ scHpfCoeff_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::scHpfCoeff_ { T(0.995) }
protected

Definition at line 724 of file Expander.h.

◆ scHpfEnabled_

template<FloatType T>
std::atomic<bool> dspark::Expander< T >::scHpfEnabled_ { false }
protected

Definition at line 722 of file Expander.h.

◆ scHpfFreqHz_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::scHpfFreqHz_ { T(80) }
protected

Definition at line 723 of file Expander.h.

◆ scHpfPrev_

template<FloatType T>
std::array<T, MAX_CHANNELS> dspark::Expander< T >::scHpfPrev_ {}
protected

Definition at line 730 of file Expander.h.

◆ scHpfState_

template<FloatType T>
std::array<T, MAX_CHANNELS> dspark::Expander< T >::scHpfState_ {}
protected

Definition at line 729 of file Expander.h.

◆ scListen_

template<FloatType T>
std::atomic<bool> dspark::Expander< T >::scListen_ { false }
protected

The key goes out instead of the audio.

Definition at line 733 of file Expander.h.

◆ state_

template<FloatType T>
State dspark::Expander< T >::state_ = State::Closed
protected

Definition at line 772 of file Expander.h.

◆ threshold_

template<FloatType T>
std::atomic<T> dspark::Expander< T >::threshold_ { T(-40) }
protected

Definition at line 713 of file Expander.h.

◆ thresholdNow_

template<FloatType T>
T dspark::Expander< T >::thresholdNow_ = T(-40)
protected

Threshold of the frame (dB).

Definition at line 770 of file Expander.h.


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