mirror of
https://github.com/thestk/stk
synced 2026-01-13 21:11:53 +00:00
Version 4.3.0
This commit is contained in:
committed by
Stephen Sinclair
parent
2cbce2d8bd
commit
27d9b79dc7
@@ -8,7 +8,7 @@
|
||||
frequency response while maintaining a constant
|
||||
filter gain.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -22,10 +22,20 @@ BiQuad :: BiQuad() : Filter()
|
||||
b[0] = 1.0;
|
||||
a[0] = 1.0;
|
||||
Filter::setCoefficients( b, a );
|
||||
Stk::addSampleRateAlert( this );
|
||||
}
|
||||
|
||||
BiQuad :: ~BiQuad()
|
||||
{
|
||||
Stk::removeSampleRateAlert( this );
|
||||
}
|
||||
|
||||
void BiQuad :: sampleRateChanged( StkFloat newRate, StkFloat oldRate )
|
||||
{
|
||||
if ( !ignoreSampleRateChange_ ) {
|
||||
errorString_ << "BiQuad::sampleRateChanged: you may need to recompute filter coefficients!";
|
||||
handleError( StkError::WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
void BiQuad :: clear(void)
|
||||
@@ -99,26 +109,3 @@ StkFloat BiQuad :: lastOut(void) const
|
||||
{
|
||||
return Filter::lastOut();
|
||||
}
|
||||
|
||||
StkFloat BiQuad :: computeSample( StkFloat input )
|
||||
{
|
||||
inputs_[0] = gain_ * input;
|
||||
outputs_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
outputs_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
inputs_[2] = inputs_[1];
|
||||
inputs_[1] = inputs_[0];
|
||||
outputs_[2] = outputs_[1];
|
||||
outputs_[1] = outputs_[0];
|
||||
|
||||
return outputs_[0];
|
||||
}
|
||||
|
||||
StkFloat BiQuad :: tick( StkFloat input )
|
||||
{
|
||||
return this->computeSample( input );
|
||||
}
|
||||
|
||||
StkFrames& BiQuad :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return Filter::tick( frames, channel );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user