1 // Copyright 2007 "Gilles Degottex"
3 // This file is part of "Music"
5 // "Music" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
10 // "Music" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 std::vector<double> fir1_lowpass(int n, double cutoff);
30 std::vector<double> fir1_highpass(int n, double cutoff);
31 std::vector<double> fir1_bandpass(int n, double low_cutoff, double high_cutoff);
38 virtual double operator()(double v)=0;
40 virtual int getLength()=0;
45 class FIRRTFilter : public RTFilter
47 std::vector<double> m_imp_res;
48 std::deque<double> m_to_filter;
51 FIRRTFilter(){m_imp_res=std::vector<double>(1, 1.0);}
52 FIRRTFilter(std::vector<double>& imp_res);
53 void setImpulseResponse(std::vector<double>& imp_res) {m_imp_res=imp_res;}
55 virtual int getLength() {return m_imp_res.size();}
57 virtual double operator()(double v);
60 class RectangularHighPassRTFilter : public RTFilter
63 std::deque<double> m_summed_values;
67 RectangularHighPassRTFilter(int N=0);
70 virtual int getLength() {return m_N;}
72 virtual double operator()(double v);
74 class RectangularLowPassRTFilter : public RTFilter
77 virtual double operator()(double v);
79 class RectangularBandPassRTFilter : public RTFilter
82 virtual double operator()(double v);
85 class DummyRTFilter : public RTFilter
90 virtual int getLength() {return 1;}
92 virtual double operator()(double v) {return v;}