1 /* Copyright (C) 2013 Robin Gareus <robin@gareus.org>
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software Foundation,
15  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16  */
17 
18 
19 
20 #ifndef __TRUEPEAKDSP_H
21 #define	__TRUEPEAKDSP_H
22 
23 #include "jmeterdsp.h"
24 #include "../zita-resampler/resampler.h"
25 
26 namespace LV2M {
27 
28 class TruePeakdsp : public JmeterDSP
29 {
30 public:
31 
32     TruePeakdsp (void);
33     ~TruePeakdsp (void);
34 
35     void process (float *p, int n);
36     void process_max (float *p, int n);
37     float read (void);
38     void  read (float &m, float &p);
39     void  reset (void);
40 
41     void init (float fsamp);
42 
43 private:
44 
45     float      _m;
46     float      _p;
47     float      _z1;
48     float      _z2;
49     bool       _res;
50 		float     *_buf;
51 		Resampler  _src;
52 
53     float   _w1;  // attack filter coefficient
54     float   _w2;  // attack filter coefficient
55     float   _w3;  // release filter coefficient
56     float   _g;   // gain factor
57 };
58 
59 };
60 
61 
62 #endif
63