worked on step-detection

adjusted iir biquad
added biquad-stacking
This commit is contained in:
2018-08-07 19:36:07 +02:00
parent d6ac8a72ca
commit f990485d44
5 changed files with 135 additions and 44 deletions

View File

@@ -97,9 +97,9 @@ namespace IIR {
/** configure the filter as low-pass */
void setLowPass( const float freq, const float octaves, const float sRate ) {
void setLowPass( const float freq, const float Q, const float sRate ) {
double freqFact = double(freq) / double(sRate);
setLowPass(freqFact, octaves);
setLowPass(freqFact, Q);
}
@@ -159,9 +159,9 @@ namespace IIR {
}
/** configure the filter as high-pass */
void setHighPass( const float freq, const float octaves, const float sRate ) {
void setHighPass( const float freq, const float Q, const float sRate ) {
double freqFact = double(freq) / double(sRate);
setHighPass(freqFact, octaves);
setHighPass(freqFact, Q);
}
/** configure the filter as band-pass. freqFact between ]0;0.5[ */
@@ -189,9 +189,9 @@ namespace IIR {
}
/** configure the filter as band-pass */
void setBandPass( const float freq, const float octaves, float sRate ) {
void setBandPass( const float freq, const float Q, float sRate ) {
double freqFact = double(freq) / double(sRate);
setBandPass(freqFact, octaves);
setBandPass(freqFact, Q);
}

View File

@@ -0,0 +1,42 @@
#ifndef BIQUADSTACK_H
#define BIQUADSTACK_H
#include <vector>
#include "BiQuad.h"
namespace IIR {
template <typename Scalar> class BiQuadStack {
std::vector<BiQuad<Scalar>> filters;
public:
BiQuadStack() {
;
}
BiQuadStack(const int num) {
filters.resize(num);
}
void resize(const int num) {
filters.resize(num);
}
BiQuad<Scalar>& operator [] (const size_t idx) {
return filters.at(idx);
}
Scalar filter(Scalar val) {
for (BiQuad<Scalar>& bq : filters) {
val = bq.filter(val);
}
return val;
}
};
}
#endif // BIQUADSTACK_H