Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
3c173eece3
2 changed files with 28 additions and 0 deletions
  1. +21
    -0
      src/juce_appframework/audio/dsp/juce_IIRFilter.cpp
  2. +7
    -0
      src/juce_appframework/audio/dsp/juce_IIRFilter.h

+ 21
- 0
src/juce_appframework/audio/dsp/juce_IIRFilter.cpp View File

@@ -67,6 +67,27 @@ void IIRFilter::reset() throw()
y2 = 0;
}
float IIRFilter::processSingleSampleRaw (const float in) throw()
{
float out = coefficients[0] * in
+ coefficients[1] * x1
+ coefficients[2] * x2
- coefficients[4] * y1
- coefficients[5] * y2;
#if JUCE_INTEL
if (! (out < -1.0e-8 || out > 1.0e-8))
out = 0;
#endif
x2 = x1;
x1 = in;
y2 = y1;
y1 = out;
return out;
}
void IIRFilter::processSamples (float* const samples,
const int numSamples) throw()
{


+ 7
- 0
src/juce_appframework/audio/dsp/juce_IIRFilter.h View File

@@ -74,6 +74,13 @@ public:
void processSamples (float* const samples,
const int numSamples) throw();
/** Processes a single sample, without any locking or checking.
Use this if you need fast processing of a single value, but be aware that
this isn't thread-safe in the way that processSamples() is.
*/
float processSingleSampleRaw (const float sample) throw();
//==============================================================================
/** Sets the filter up to act as a low-pass filter.
*/


Loading…
Cancel
Save