diff --git a/chorus.h b/chorus.h index 5b9bca9..6cbf5d1 100644 --- a/chorus.h +++ b/chorus.h @@ -97,8 +97,14 @@ struct ChorusSTFX : public BaseEffect { std::array multiIn, multiOut; std::array delaySamples; - auto dry = block.smooth(mix, [](double m){return 1 - m*m;}); - auto wet = block.smooth(mix, [](double m){return m*(2 - m)/std::sqrt(Sample(6));}); + auto wetDryFn = [](double mix, double width, bool isWet){ + // Equal-power wet/dry fade + double m = isWet ? std::sin(M_PI*mix/2) : std::cos(M_PI*mix/2); + // Compensate for extra energy from stereo + return m/std::sqrt(6*(1 + width*width/2)); + }; + auto dry = block.smooth(wetDryFn(mix.from(), stereo.from(), false), wetDryFn(mix.to(), stereo.to(), false)); + auto wet = block.smooth(wetDryFn(mix.from(), stereo.from(), true), wetDryFn(mix.to(), stereo.to(), true)); bool notMono = (config.outputChannels > 1); auto width = block.smooth(stereo);