update qm-dsp library
[ardour.git] / libs / qm-dsp / dsp / signalconditioning / Filter.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     QM DSP Library
5
6     Centre for Digital Music, Queen Mary, University of London.
7     This file 2005-2006 Christian Landone.
8
9     This program is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public License as
11     published by the Free Software Foundation; either version 2 of the
12     License, or (at your option) any later version.  See the file
13     COPYING included with this distribution for more information.
14 */
15
16 #ifndef FILTER_H
17 #define FILTER_H
18
19 #ifndef NULL
20 #define NULL 0
21 #endif
22
23 /**
24  * Filter specification. For a filter of order ord, the ACoeffs and
25  * BCoeffs arrays must point to ord+1 values each. ACoeffs provides
26  * the denominator and BCoeffs the numerator coefficients of the
27  * filter.
28  */
29 struct FilterConfig{
30     unsigned int ord;
31     double* ACoeffs;
32     double* BCoeffs;
33 };
34
35 /**
36  * Digital filter specified through FilterConfig structure.
37  */
38 class Filter  
39 {
40 public:
41     Filter( FilterConfig Config );
42     virtual ~Filter();
43
44     void reset();
45
46     void process( double *src, double *dst, unsigned int length );
47
48 private:
49     void initialise( FilterConfig Config );
50     void deInitialise();
51
52     unsigned int m_ord;
53
54     double* m_inBuffer;
55     double* m_outBuffer;
56
57     double* m_ACoeffs;
58     double* m_BCoeffs;
59 };
60
61 #endif