SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
audiofilter.h
Go to the documentation of this file.
1 // Copyright (C) 2019 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef _SDRBASE_AUDIO_AUDIOFILTER_H_
19 #define _SDRBASE_AUDIO_AUDIOFILTER_H_
20 
21 #include "export.h"
22 #include "dsp/iirfilter.h"
23 
45 public:
46  AudioFilter();
47  ~AudioFilter();
48 
49  void useHP(bool useHP) { m_useHP = useHP; }
50  bool usesHP() const { return m_useHP; }
51  void setDecimFilters(int srHigh, int srLow, float fcHigh, float fcLow, float gain = 1.0f);
52  float run(const float& sample);
53  float runHP(const float& sample);
54  float runLP(const float& sample);
55 
56 private:
57  void calculate2(bool highPass, double fc, float *a, float *b, float fgain); // two pole Chebyshev calculation
58  void cheby(bool highPass, double fc, float pr, int np, double *a, double *b, float fgain);
59  void cheby_sub(bool highPass, double fc, float pr, int np, int stage,
60  double& a0, double& a1, double& a2, double& b1, double& b2);
61 
64  bool m_useHP;
65  float m_lpva[3];
66  float m_lpvb[3];
67  float m_hpva[3];
68  float m_hpvb[3];
69  static const float m_lpa[3];
70  static const float m_lpb[3];
71  static const float m_hpa[3];
72  static const float m_hpb[3];
73 
74 };
75 
76 #endif // _SDRBASE_AUDIO_AUDIOFILTER_H_
bool m_useHP
Definition: audiofilter.h:64
uint8_t b2
Definition: decimators.h:57
IIRFilter< float, 2 > m_filterLP
Definition: audiofilter.h:62
void useHP(bool useHP)
Definition: audiofilter.h:49
uint8_t b1
Definition: decimators.h:56
IIRFilter< float, 2 > m_filterHP
Definition: audiofilter.h:63
#define SDRBASE_API
Definition: export.h:40
bool usesHP() const
Definition: audiofilter.h:50