From 70ec078989e9776e10de6eaa4633ea73033955ff Mon Sep 17 00:00:00 2001 From: Vincent Berthiaume Date: Thu, 24 Oct 2024 16:07:35 -0400 Subject: [PATCH] cleanup and failed attempt to fix audio click on first transition. Will have to get back to it later --- source/DSP/ProPhatSynthesiser.h | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/source/DSP/ProPhatSynthesiser.h b/source/DSP/ProPhatSynthesiser.h index 8bea8a3..5b96d7d 100644 --- a/source/DSP/ProPhatSynthesiser.h +++ b/source/DSP/ProPhatSynthesiser.h @@ -33,10 +33,9 @@ class EffectsCrossfadeProcessor enum EffectType { verb = 0, - phaser, + chorus, transitioning }; - EffectType curEffect = EffectType::verb; EffectsCrossfadeProcessor() = default; @@ -48,16 +47,22 @@ class EffectsCrossfadeProcessor void changeEffect() { if (curEffect == EffectType::verb) - curEffect = EffectType::phaser; - else if (curEffect == EffectType::phaser) + curEffect = EffectType::chorus; + else if (curEffect == EffectType::chorus) curEffect = EffectType::verb; else jassertfalse; if (curEffect == EffectType::verb) - setGain (1.0); + smoothedGain.setTargetValue (1.); else - setGain (0.0); + smoothedGain.setTargetValue (0.); + + //this does not resolve the click we get on the first transition + //if (curEffect == EffectType::verb) + // smoothedGain.setTargetValue (0.); + //else + // smoothedGain.setTargetValue (1.); }; EffectType getCurrentEffectType() const @@ -128,16 +133,13 @@ class EffectsCrossfadeProcessor } private: - /** - Can be used to set a custom gain level to combine the two buffers. - @param gain The gain level of the left buffer. - */ - void setGain (double gain) - { - smoothedGain.setTargetValue (std::clamp (gain, 0.0, 1.0)); - } - juce::SmoothedValue smoothedGain; + + //TODO: this needs to be stored and retreived from the state + EffectType curEffect = EffectType::verb; + + //changing the default curEffect to chorus DOES fix the click on first transition. Weird man + //EffectType curEffect = EffectType::chorus; }; //================================================== @@ -214,7 +216,7 @@ class EffectsProcessor if (currentEffectType == EffectsCrossfadeProcessor::EffectType::verb) verbWrapper->process (context); - else if (currentEffectType == EffectsCrossfadeProcessor::EffectType::phaser) + else if (currentEffectType == EffectsCrossfadeProcessor::EffectType::chorus) chorusWrapper->process (context); else jassertfalse; //unknown effect!!