diff --git a/modules/juce_dsp/processors/juce_BallisticsFilter.cpp b/modules/juce_dsp/processors/juce_BallisticsFilter.cpp index ea5792e0f9..8ed7bbc937 100644 --- a/modules/juce_dsp/processors/juce_BallisticsFilter.cpp +++ b/modules/juce_dsp/processors/juce_BallisticsFilter.cpp @@ -96,6 +96,8 @@ SampleType BallisticsFilter::processSample (int channel, SampleType if (levelType == LevelCalculationType::RMS) inputValue *= inputValue; + else + inputValue = std::abs (inputValue); SampleType result = inputValue + cte * (yold[(size_t) channel] - inputValue); yold[(size_t) channel] = result; diff --git a/modules/juce_dsp/processors/juce_BallisticsFilter.h b/modules/juce_dsp/processors/juce_BallisticsFilter.h index 0df379ea93..07e23af98a 100644 --- a/modules/juce_dsp/processors/juce_BallisticsFilter.h +++ b/modules/juce_dsp/processors/juce_BallisticsFilter.h @@ -55,15 +55,16 @@ public: //============================================================================== /** Sets the attack time in ms. - Attack times less that 0.001 will be snapped to zero and very long attack + Attack times less than 0.001 ms will be snapped to zero and very long attack times will eventually saturate depending on the numerical precision used. */ void setAttackTime (SampleType attackTimeMs); /** Sets the release time in ms. - Release times less that 0.001 will be snapped to zero and very long release - times will eventually saturate depending on the numerical precision used. + Release times less than 0.001 ms will be snapped to zero and very long + release times will eventually saturate depending on the numerical precision + used. */ void setReleaseTime (SampleType releaseTimeMs); diff --git a/modules/juce_dsp/widgets/juce_Compressor.cpp b/modules/juce_dsp/widgets/juce_Compressor.cpp index 949f231abb..4056423287 100644 --- a/modules/juce_dsp/widgets/juce_Compressor.cpp +++ b/modules/juce_dsp/widgets/juce_Compressor.cpp @@ -91,11 +91,8 @@ void Compressor::reset() template SampleType Compressor::processSample (int channel, SampleType inputValue) { - // Rectifier - auto env = jmax ((SampleType) 0.0, inputValue); - - // Ballistics filter - env = envelopeFilter.processSample (channel, env); + // Ballistics filter with peak rectifier + auto env = envelopeFilter.processSample (channel, inputValue); // VCA auto gain = (env < threshold) ? static_cast (1.0)