Filter.h
Go to the documentation of this file.
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 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 */
14 
15 #ifndef QM_DSP_FILTER_H
16 #define QM_DSP_FILTER_H
17 
18 #include "base/Restrict.h"
19 
20 #include <vector>
21 
22 class Filter
23 {
24 public:
25  struct Parameters {
26  std::vector<double> a;
27  std::vector<double> b;
28  };
29 
36  Filter(Parameters params);
37 
38  ~Filter();
39 
40  void reset();
41 
47  void process(const double *const QM_R__ in,
48  double *const QM_R__ out,
49  const int n);
50 
51  int getOrder() const { return m_order; }
52 
53 private:
54  int m_order;
55  int m_sz;
56  std::vector<double> m_a;
57  std::vector<double> m_b;
58  std::vector<double> m_bufa;
59  std::vector<double> m_bufb;
60  int m_offa;
61  int m_offb;
62  int m_offmax;
63  bool m_fir;
64 
65  Filter(const Filter &); // not supplied
66  Filter &operator=(const Filter &); // not supplied
67 };
68 
69 #endif
std::vector< double > m_a
Definition: Filter.h:56
int m_offb
Definition: Filter.h:61
~Filter()
Definition: Filter.cpp:59
Filter & operator=(const Filter &)
#define QM_R__
Definition: Restrict.h:15
void process(const double *const QM_R__ in, double *const QM_R__ out, const int n)
Filter the input sequence.
Definition: Filter.cpp:77
int m_order
Definition: Filter.h:54
Definition: Filter.h:22
Filter(Parameters params)
Construct an IIR filter with numerators b and denominators a.
Definition: Filter.cpp:21
std::vector< double > a
Definition: Filter.h:26
void reset()
Definition: Filter.cpp:64
std::vector< double > m_b
Definition: Filter.h:57
int m_sz
Definition: Filter.h:55
int m_offa
Definition: Filter.h:60
int getOrder() const
Definition: Filter.h:51
int m_offmax
Definition: Filter.h:62
bool m_fir
Definition: Filter.h:63
std::vector< double > b
Definition: Filter.h:27
std::vector< double > m_bufa
Definition: Filter.h:58
std::vector< double > m_bufb
Definition: Filter.h:59