31 void setB0( StkFloat b0 ) { b_[0] = b0; };
34 void setB1( StkFloat b1 ) { b_[1] = b1; };
50 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
53 StkFloat
tick( StkFloat input );
81 inputs_[0] = gain_ * input;
82 lastFrame_[0] = b_[1] * inputs_[1] + b_[0] * inputs_[0];
83 inputs_[1] = inputs_[0];
90 #if defined(_STK_DEBUG_)
91 if ( channel >= frames.
channels() ) {
92 oStream_ <<
"OneZero::tick(): channel and StkFrames arguments are incompatible!";
97 StkFloat *samples = &frames[channel];
98 unsigned int hop = frames.
channels();
99 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
100 inputs_[0] = gain_ * *samples;
101 *samples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
102 inputs_[1] = inputs_[0];
105 lastFrame_[0] = *(samples-hop);
111 #if defined(_STK_DEBUG_)
113 oStream_ <<
"OneZero::tick(): channel and StkFrames arguments are incompatible!";
118 StkFloat *iSamples = &iFrames[iChannel];
119 StkFloat *oSamples = &oFrames[oChannel];
121 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
122 inputs_[0] = gain_ * *iSamples;
123 *oSamples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
124 inputs_[1] = inputs_[0];
127 lastFrame_[0] = *(oSamples-oHop);
STK abstract filter class.
Definition: Filter.h:23
STK one-zero filter class.
Definition: OneZero.h:21
void setCoefficients(StkFloat b0, StkFloat b1, bool clearState=false)
Set all filter coefficients.
~OneZero()
Class destructor.
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: OneZero.h:79
StkFloat lastOut(void) const
Return the last computed output value.
Definition: OneZero.h:50
void setB1(StkFloat b1)
Set the b[1] coefficient value.
Definition: OneZero.h:34
OneZero(StkFloat theZero=-1.0)
The default constructor creates a low-pass filter (zero at z = -1.0).
void setB0(StkFloat b0)
Set the b[0] coefficient value.
Definition: OneZero.h:31
void setZero(StkFloat theZero)
Set the zero position in the z-plane.
An STK class to handle vectorized audio data.
Definition: Stk.h:287
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:415
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:418
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
The STK namespace.
Definition: ADSR.h:8