縦続形 IIR フィルタ用ライブラリ. Library for cascade structure IIR filter.
Dependents: Demo_IIR_Filter UIT2_VariableIIR_LPF UIT2_VariableIIR_LPFHPF
IIR_Cascade.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-09-03
- Revision:
- 0:d2f279439aaf
- Child:
- 1:69a8b728e8d2
File content as of revision 0:d2f279439aaf:
//---------------------------------------------------------------- // 縦続形 IIR フィルタ(Biquad クラスを使用) // Class for IIR filter of cascade structure using Biquad class // 2015/09/03, Copyright (c) 2015 MIKAMI, Naoki //---------------------------------------------------------------- #ifndef IIR_CASCADE_HPP #define IIR_CASCADE_HPP #include "Biquad.hpp" namespace Mikami { template<int order> class IirCascade { public: // constructor IirCascade(const Biquad::Coefs ck[], float g0) : g0_(g0) { for (int n=0; n<order/2; n++) hk_[n] = new Biquad(ck[n]); Clear(); } // destructor ~IirCascade() { for (int n=0; n<order/2; n++) delete hk_[n]; } // clear internal buffer void Clear() { for (int k=0; k<order/2; k++) hk_[k]->Clear(); } // execute filter float Execute(float xn) { float yn = g0_*xn; for (int k=0; k<order/2; k++) yn = hk_[k]->Execute(yn); return yn; } private: Biquad* hk_[order/2]; // biquad IIR filter const float g0_; // gain factor // disallow copy constructor and assignment operator IirCascade(const IirCascade&); IirCascade& operator = (const IirCascade&); }; } #endif // IIR_CASCADE_HPP