Store SC output gain as linear gain
Using the new conversion function.
This commit is contained in:
parent
44b9a4cad0
commit
e20b10d601
|
@ -98,9 +98,9 @@ pub struct SpectralCompressorParams {
|
||||||
#[derive(Params)]
|
#[derive(Params)]
|
||||||
struct GlobalParams {
|
struct GlobalParams {
|
||||||
/// Makeup gain applied after the IDFT in the STFT process. If automatic makeup gain is enabled,
|
/// Makeup gain applied after the IDFT in the STFT process. If automatic makeup gain is enabled,
|
||||||
/// then this acts as an offset on top of that.
|
/// then this acts as an offset on top of that. This is stored as linear gain.
|
||||||
#[id = "output_db"]
|
#[id = "output"]
|
||||||
output_gain_db: FloatParam,
|
output_gain: FloatParam,
|
||||||
// TODO: Bring this back, and with values that make more sense
|
// TODO: Bring this back, and with values that make more sense
|
||||||
// /// Try to automatically compensate for gain differences with different input gain, threshold, and ratio values.
|
// /// Try to automatically compensate for gain differences with different input gain, threshold, and ratio values.
|
||||||
// #[id = "auto_makeup"]
|
// #[id = "auto_makeup"]
|
||||||
|
@ -171,16 +171,18 @@ impl Default for GlobalParams {
|
||||||
GlobalParams {
|
GlobalParams {
|
||||||
// We don't need any smoothing for these parameters as the overlap-add process will
|
// We don't need any smoothing for these parameters as the overlap-add process will
|
||||||
// already act as a form of smoothing
|
// already act as a form of smoothing
|
||||||
output_gain_db: FloatParam::new(
|
output_gain: FloatParam::new(
|
||||||
"Output Gain",
|
"Output Gain",
|
||||||
0.0,
|
util::db_to_gain(0.0),
|
||||||
FloatRange::Linear {
|
FloatRange::Skewed {
|
||||||
min: -50.0,
|
min: util::db_to_gain(-50.0),
|
||||||
max: 50.0,
|
max: util::db_to_gain(50.0),
|
||||||
|
factor: FloatRange::gain_skew_factor(-50.0, 50.0),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.with_unit(" dB")
|
.with_unit(" dB")
|
||||||
.with_step_size(0.1),
|
.with_value_to_string(formatters::v2s_f32_gain_to_db(2))
|
||||||
|
.with_string_to_value(formatters::s2v_f32_gain_to_db()),
|
||||||
// auto_makeup_gain: BoolParam::new("Auto Makeup Gain", true),
|
// auto_makeup_gain: BoolParam::new("Auto Makeup Gain", true),
|
||||||
dry_wet_ratio: FloatParam::new("Mix", 1.0, FloatRange::Linear { min: 0.0, max: 1.0 })
|
dry_wet_ratio: FloatParam::new("Mix", 1.0, FloatRange::Linear { min: 0.0, max: 1.0 })
|
||||||
.with_unit("%")
|
.with_unit("%")
|
||||||
|
@ -367,8 +369,7 @@ impl Plugin for SpectralCompressor {
|
||||||
// threshold option. When sidechaining is enabled this is used to gain up the sidechain
|
// threshold option. When sidechaining is enabled this is used to gain up the sidechain
|
||||||
// signal instead.
|
// signal instead.
|
||||||
let input_gain = gain_compensation.sqrt();
|
let input_gain = gain_compensation.sqrt();
|
||||||
let output_gain =
|
let output_gain = self.params.global.output_gain.value * gain_compensation.sqrt();
|
||||||
util::db_to_gain(self.params.global.output_gain_db.value) * gain_compensation.sqrt();
|
|
||||||
// TODO: Auto makeup gain
|
// TODO: Auto makeup gain
|
||||||
|
|
||||||
// This is mixed in later with latency compensation applied
|
// This is mixed in later with latency compensation applied
|
||||||
|
|
Loading…
Reference in a new issue