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:
parent
29691aaf4f
commit
39d8399653
3 changed files with 8 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue