From 5250dc815d86692c7c50f9bc496f4ae38b647955 Mon Sep 17 00:00:00 2001 From: Ivan Cohen Date: Mon, 21 Sep 2020 17:16:55 +0200 Subject: [PATCH] Solved an issue in dsp::BallisticsFilter with peak and RMS envelopes calculation formulas --- modules/juce_dsp/processors/juce_BallisticsFilter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/juce_dsp/processors/juce_BallisticsFilter.cpp b/modules/juce_dsp/processors/juce_BallisticsFilter.cpp index 8ed7bbc937..e9fcf5ee35 100644 --- a/modules/juce_dsp/processors/juce_BallisticsFilter.cpp +++ b/modules/juce_dsp/processors/juce_BallisticsFilter.cpp @@ -92,13 +92,13 @@ SampleType BallisticsFilter::processSample (int channel, SampleType { jassert (isPositiveAndBelow (channel, yold.size())); - SampleType cte = (inputValue > yold[(size_t) channel] ? cteAT : cteRL); - if (levelType == LevelCalculationType::RMS) inputValue *= inputValue; else inputValue = std::abs (inputValue); + SampleType cte = (inputValue > yold[(size_t) channel] ? cteAT : cteRL); + SampleType result = inputValue + cte * (yold[(size_t) channel] - inputValue); yold[(size_t) channel] = result;