1 // ----------------------------------------------------------------------------
2 //
3 //  Copyright (C) 2008-2018 Fons Adriaensen <fons@linuxaudio.org>
4 //
5 //  This program is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation; either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program 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 General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 //
18 // ----------------------------------------------------------------------------
19 
20 
21 #ifndef __EQGAIN_H
22 #define __EQGAIN_H
23 
24 
25 #include <stdint.h>
26 
27 
28 class Eqgain
29 {
30 public:
31 
32     Eqgain (void);
33     ~Eqgain (void);
34 
35     void setgain (float g)
36     {
37 	_g0 = g;
38 	_touch0++;
39     }
40     void bypass (bool s)
41     {
42 	if (s != _bypass)
43 	{
44 	    _bypass = s;
45 	    _touch0++;
46 	}
47     }
48     void prepare (int nsamp);
49     void process (int nsamp, int nchan, float *inp[], float *out[]);
50 
51 private:
52 
53     enum { BYPASS, STATIC, SMOOTH };
54 
55     volatile int16_t  _touch0;
56     volatile int16_t  _touch1;
57     bool              _bypass;
58     int               _state;
59     float             _g0, _g1;
60     float             _g, _dg;
61 };
62 
63 
64 #endif
65