From 9313d27e5ca9b6f21ba42aa39312102e18c57d74 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Fri, 16 Oct 2009 04:43:06 +0200 Subject: [PATCH] meter_gain in gain_reduction module with falloff (cherry picked from commit 81eaa78018b52a076dd7f904980bdbbcc312710b) --- plugins/ladspa_effect/calf/src/modules_dsp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/ladspa_effect/calf/src/modules_dsp.cpp b/plugins/ladspa_effect/calf/src/modules_dsp.cpp index 3ef471b0b..bb3d9daef 100644 --- a/plugins/ladspa_effect/calf/src/modules_dsp.cpp +++ b/plugins/ladspa_effect/calf/src/modules_dsp.cpp @@ -1087,8 +1087,9 @@ void gain_reduction_audio_module::deactivate() void gain_reduction_audio_module::process(float &left, float &right) { - float compression = 1.f; meter_out -= meter_out * 5.f * 1 / srate; + meter_comp += (1 - meter_comp) * 5.f * 1 / srate; + float gain = 1.f; if(bypass < 0.5f) { // this routine is mainly copied from thor's compressor module // greatest sounding compressor I've heard! @@ -1110,13 +1111,10 @@ void gain_reduction_audio_module::process(float &left, float &right) linSlope += (absample - linSlope) * (absample > linSlope ? attack_coeff : release_coeff); - float gain = 1.f; - if(linSlope > 0.f) { gain = output_gain(linSlope, rms); } - compression = gain; gain *= makeup; left *= gain; @@ -1130,7 +1128,9 @@ void gain_reduction_audio_module::process(float &left, float &right) if(maxLR > meter_out) { meter_out = maxLR; } - meter_comp = compression; + if(gain < meter_comp) { + meter_comp = gain; + } } float gain_reduction_audio_module::output_level(float slope) {