1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

DSP: Provided the peak rectifier stage directly in dsp::BallisticsFilter

This commit is contained in:
Ivan Cohen 2020-09-18 10:57:25 +02:00 committed by reuk
parent 29691aaf4f
commit 39d8399653
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
3 changed files with 8 additions and 8 deletions

View file

@ -96,6 +96,8 @@ SampleType BallisticsFilter<SampleType>::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;

View file

@ -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);

View file

@ -91,11 +91,8 @@ void Compressor<SampleType>::reset()
template <typename SampleType>
SampleType Compressor<SampleType>::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<SampleType> (1.0)