diff --git a/plugins/ladspa_effect/calf/calf/modules.h b/plugins/ladspa_effect/calf/calf/modules.h index 8612106bd..19075725d 100644 --- a/plugins/ladspa_effect/calf/calf/modules.h +++ b/plugins/ladspa_effect/calf/calf/modules.h @@ -1063,6 +1063,7 @@ private: float f1_freq_old1, f2_freq_old1, f1_level_old1, f2_level_old1, f2_q_old1; uint32_t detected_led; float detected, clip_out; + uint32_t clip_led; gain_reduction_audio_module compressor; biquad_d2 hpL, hpR, lpL, lpR, pL, pR; public: diff --git a/plugins/ladspa_effect/calf/src/modules.cpp b/plugins/ladspa_effect/calf/src/modules.cpp index eeeb6f073..225e38712 100644 --- a/plugins/ladspa_effect/calf/src/modules.cpp +++ b/plugins/ladspa_effect/calf/src/modules.cpp @@ -387,13 +387,13 @@ CALF_PORT_PROPS(deesser) = { { 0, 0, 1, 0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_out", "Out" }, { 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, deesser_detection_names, "detection", "Detection" }, { 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, deesser_mode_names, "mode", "Mode" }, - { 0.0625, 0.000976563, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "threshold", "Threshold" }, - { 5, 1, 20, 21, PF_FLOAT | PF_SCALE_LOG_INF | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "ratio", "Ratio" }, + { 0.125, 0.000976563, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "threshold", "Threshold" }, + { 3, 1, 20, 21, PF_FLOAT | PF_SCALE_LOG_INF | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "ratio", "Ratio" }, { 15, 1, 100, 1, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "laxity", "Laxity" }, { 1, 1, 64, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "makeup", "Makeup" }, - { 5000, 10, 18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "f1_freq", "Split" }, - { 6000, 10, 18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "f2_freq", "Peak" }, + { 6000, 10, 18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "f1_freq", "Split" }, + { 4500, 10, 18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "f2_freq", "Peak" }, { 1, 0.0625, 16, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "f1_level", "Gain" }, { 4, 0.0625, 16, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "f2_level", "Level" }, { 1, 0.1, 100,1, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "f2_q", "Peak Q" }, diff --git a/plugins/ladspa_effect/calf/src/modules_dsp.cpp b/plugins/ladspa_effect/calf/src/modules_dsp.cpp index 41ec5a6e1..452844ea1 100644 --- a/plugins/ladspa_effect/calf/src/modules_dsp.cpp +++ b/plugins/ladspa_effect/calf/src/modules_dsp.cpp @@ -1489,6 +1489,7 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin // process detected_led -= std::min(detected_led, numsamples); + clip_led -= std::min(clip_led, numsamples); while(offset < numsamples) { // cycle through samples @@ -1502,6 +1503,8 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin float rightAC = inR; float leftSC = inL; float rightSC = inR; + float leftRC = inL; + float rightRC = inR; float leftMC = inL; float rightMC = inR; @@ -1516,11 +1519,15 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin compressor.process(leftAC, rightAC, leftSC, rightSC); break; case SPLIT: - compressor.process(leftSC, rightSC, leftSC, rightSC); + hpL.sanitize(); + hpR.sanitize(); + leftRC = hpL.process(leftRC); + rightRC = hpR.process(rightRC); + compressor.process(leftRC, rightRC, leftSC, rightSC); leftAC = lpL.process(leftAC); rightAC = lpR.process(rightAC); - leftAC += leftSC; - rightAC += rightSC; + leftAC += leftRC; + rightAC += rightRC; break; } @@ -1539,7 +1546,14 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin if(std::max(fabs(leftSC), fabs(rightSC)) > 0.1) { detected_led = srate >> 3; } - clip_out = std::max(fabs(outL), fabs(outR)); + if(std::max(fabs(leftAC), fabs(rightAC)) > 1.f) { + clip_led = srate >> 3; + } + if(clip_led > 0) { + clip_out = 1.f; + } else { + clip_out = std::max(fabs(outL), fabs(outR)); + } detected = std::max(fabs(leftMC), fabs(rightMC)); // next sample