![]() |
Deluge Firmware 1.3.0
Build date: 2025.04.16
|
Public Member Functions | |
constexpr void | setup (q31_t a, q31_t r, q31_t t, q31_t rat, q31_t fc, q31_t blend, float baseGain) |
takes in all values as knob positions in the range 0-ONE_Q31 | |
void | reset () |
Reset the state of the compressor so no gain reduction is applied at the start of the next render window. | |
void | render (std::span< StereoSample > buffer, q31_t volAdjustL, q31_t volAdjustR, q31_t finalVolume) |
void | renderVolNeutral (std::span< StereoSample > buffer, q31_t finalVolume) |
This renders at a 'neutral' volume, so that at threshold zero the volume in unchanged. | |
float | runEnvelope (float current, float desired, float numSamples) const |
constexpr q31_t | getAttack () const |
Get the current attack time constant in terms of the full knob range (0 to 2^31) | |
constexpr float | getAttackMS () const |
Get the current attack time constant in MS for a 3db change. | |
constexpr int32_t | setAttack (q31_t attack) |
constexpr q31_t | getRelease () const |
Get the current release time constant in terms of the full knob range (0 to 2^31) | |
constexpr float | getReleaseMS () const |
Get the current release time constant in MS for a 3db change. | |
constexpr int32_t | setRelease (q31_t release) |
constexpr q31_t | getThreshold () const |
Get the current theshold as a full-scale (0 to 2^31) number. | |
constexpr void | setThreshold (q31_t t) |
constexpr q31_t | getRatio () const |
Get the current ratio as a full-scale (0 to 2^31) number. | |
constexpr float | getRatioForDisplay () const |
Get the current ratio as a float. | |
constexpr int32_t | setRatio (q31_t rat) |
q31_t | getSidechain () |
Get the current sidechain cutoff frequency as a full-scale (0 to 2^31) integer. | |
constexpr float | getSidechainForDisplay () const |
Get the current sidechain cutoff frequency in hertz. | |
constexpr int32_t | setSidechain (q31_t f) |
constexpr q31_t | getBlend () |
returns blend in q31 | |
constexpr int32_t | getBlendForDisplay () |
returns blend as an integer percentage | |
constexpr int32_t | setBlend (q31_t blend) |
constexpr void | setBaseGain (float baseGain) |
void | updateER (float numSamples, q31_t finalVolume) |
Update the internal envelope and gain reduction tracking. | |
float | calcRMS (std::span< StereoSample > buffer) |
Calculate the RMS amplitude, post internal HPF, of the samples. | |
Public Attributes | |
uint8_t | gainReduction = 0 |
Amount of gain reduction applied during the last render pass, in 6.2 fixed point decibels. | |
Private Attributes | |
float | a_ = (-1000.0f / kSampleRate) |
Attack time constant, in inverse samples. | |
float | r_ = (-1000.0f / kSampleRate) |
Release time constant, in inverse samples. | |
float | fraction = 0.5 |
float | er = 0 |
float | threshdb = 17 |
Threshold, in decibels. | |
float | threshold = 1 |
The raw threshold value. | |
q31_t | hpfA_ = ONE_Q16 |
A parameter for the internal HPF. | |
float | state = 0 |
State for the internal envelope follower. | |
q31_t | currentVolumeL = 0 |
Current left channel volume as a 5.26 signed fixed-point number. | |
q31_t | currentVolumeR = 0 |
Current right channel volume as a 5.26 signed fixed-point number. | |
float | rms = 0 |
Log-RMS value of the last render. | |
float | mean = 0 |
Mean value of the last render. | |
uint32_t | lastSaturationTanHWorkingValue [2] = {0} |
tanh working values for output saturation | |
bool | onLastTime = false |
deluge::dsp::filter::BasicFilterComponent | hpfL |
deluge::dsp::filter::BasicFilterComponent | hpfR |
float | attackMS = 0 |
float | releaseMS = 0 |
float | ratio = 2 |
float | fc_hz |
float | baseGain_ |
q31_t | thresholdKnobPos = 0 |
q31_t | ratioKnobPos = 0 |
q31_t | attackKnobPos = 0 |
q31_t | releaseKnobPos = 0 |
q31_t | sideChainKnobPos = 0 |
q31_t | dry |
q31_t | wet |
void RMSFeedbackCompressor::render | ( | std::span< StereoSample > | buffer, |
q31_t | volAdjustL, | ||
q31_t | volAdjustR, | ||
q31_t | finalVolume ) |
Render the compressor in-place using the provided buffer.
Assumes the input is 24-bit peak-to-peak (-2^23 to 2^23), and keeps the output in that range.
buffer | Input and output buffer. |
numSamples | Length of the buffer. |
volAdjustL | Linear gain to apply to the left channel as a 4.27 signed fixed point number. |
volAdjustL | Linear gain to apply to the right channel as a 4.27 signed fixed point number. |
finalVolume | Linear peak-to-peak volume scale, as a 3.29 fixed-point integer. |
void RMSFeedbackCompressor::renderVolNeutral | ( | std::span< StereoSample > | buffer, |
q31_t | finalVolume ) |
This renders at a 'neutral' volume, so that at threshold zero the volume in unchanged.
Render the compressor with neutral left/right gain and with the finalVolume tweaked so the compressor applies 0db gain change at theshold zero. Used by the per-clip compressors because the clip volume is applied without the compressor being involved.
|
nodiscard |
Compute an updated envelope value, using the attack time constant if desired > current and the release time constant otherwise.
|
inlineconstexpr |
Set the attack time constant from a full-scale (0 to 2^31) number.
The parameter is exponentially mapped to a number between 0.5 and 70-ish ms
|
inlineconstexpr |
Configure the base makeup gain. Since reduction is always negative, we only need to worry about the case where reduction == 0 to determine the maximum headroom. er can not exceed 2.08, so we have 1.35 neppers of headroom.
The song compressor must use 0.8 to maintain compatibility with previous songs.
|
inlineconstexpr |
update the blend level, where blend is the wet level (i.e. ONE_Q31 is full wet) returns wet percentage
|
inlineconstexpr |
Set the ratio based on a full-scale (0 to 2^31) number.
A inverse (1/x) mapping is used, where 0 corresponds to a ratio of 2:1, 2^31 corresponds to a ratio of 256:1.
|
inlineconstexpr |
Set the release time constant from a full-scale (0 to 2^31) number.
The parameter is exponentially mapped to a number between 50 and 400-ish ms
|
inlineconstexpr |
Set the sidechain cutoff frequency from a full-scale (0 to 2^31) integer.
The parameter is exponentially mapped so 0 to 2^31 corresponds to about 0 to 100hz cutoff.
|
inlineconstexpr |
Set the threshold based on a full-scale (0 to 2^31) number.
0 corresponds to a threshold of 0.2, 2^31 corresponds to a theshold of 1.
|
private |
How much to bump the envelope follower RMS value and reduction to get approximate iso-volume when the compressor is engaged.
|
private |
Internal (smoothed) version of log of the requested volume.
Maximum value: 2.08 neppers when finalVolume is 0x7fffffff Minimum value: -23.07 neppers when finalVolume is 0
|
private |
1 - (1 / ratio), describes the actual factor by which volume changes should increase or decrease.
The UI currently limits this to 0.5 (a ratio of 2) to 1.0 (a ratio of 256)