1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-24 01:54:22 +00:00
This commit is contained in:
jules 2008-09-22 15:51:45 +00:00
parent 457654a3f9
commit 3c173eece3
2 changed files with 28 additions and 0 deletions

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()
{

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.
*/