24 lines
483 B
C++
24 lines
483 B
C++
#include "filter.h"
|
|
|
|
void Resonator::clear()
|
|
{
|
|
xp = xpp = yp = ypp = 0;
|
|
}
|
|
|
|
void Resonator::process(float* output, const float* const input, uint32_t frames)
|
|
{
|
|
for(uint32_t i = 0; i < frames; ++i){
|
|
float x = static_cast<float>(input[i] * scale);
|
|
float y = x - xpp - app * ypp + ap * yp;
|
|
output[i] = y;
|
|
xpp = xp;
|
|
xp = x;
|
|
ypp = yp;
|
|
yp = y;
|
|
}
|
|
}
|
|
|
|
void Resonator::set(double _app, double _ap, double _scale)
|
|
{
|
|
app = _app; ap = _ap; scale = _scale;
|
|
} |