1 
2 // Based in gate_1410.c LADSPA Swh-plugins
3 
4 /*
5   rakarrack - a guitar effects software
6 
7  Expander.h  -  Noise Gate Effect definitions
8  Based on artscompressor.cc by Matthias Kretz <kretz@kde.org>
9  Stefan Westerfeld <stefan@space.twc.de>
10 
11   Copyright (C) 2008-2010 Ryan Billing & Josep Andreu
12   Author: Ryan Billing & Josep Andreu
13 
14  This program is free software; you can redistribute it and/or modify
15  it under the terms of version 2 of the GNU General Public License
16  as published by the Free Software Foundation.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License (version 2) for more details.
22 
23  You should have received a copy of the GNU General Public License
24  (version2)  along with this program; if not, write to the Free Software
25  Foundation,
26  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
27 
28 */
29 
30 
31 #ifndef EXPANDER_H
32 #define EXPANDER_H
33 
34 #include "global.h"
35 #include "AnalogFilter.h"
36 
37 class Expander
38 {
39 
40 public:
41 
42     Expander (float * efxoutl_, float * efxoutr_, double sample_rate, uint32_t intermediate_bufsize);
43     ~Expander ();
44 
45     void out (float * smps_l, float * smps_r, uint32_t period);
46 
47     void Expander_Change (int np, int value);
48     void Expander_Change_Preset (int npreset);
49     void cleanup ();
50     int getpar (int npar);
51 
52     float *efxoutl;
53     float *efxoutr;
54 
55 
56 
57     // Compressor
58 
59     int Pthreshold;		// Threshold, -80 to 0dB
60     int Pattack;			// attack time  (ms)  Set range from 10ms ... 2000ms
61     int Pdecay;			// release time (ms)  Set range from 10ms ... 500ms
62     int Pshape;			// Sharpness of transition from off to on.  Range is 0 ... 50
63     int Plpf;
64     int Phpf;
65     int Plevel;
66     int efollower;		// This is a mode allowing this object to be used as a "dynamics detector"
67     // (envelope follower).  If efollower == 1, then efxoutl is a level to be used in place of an LFO
68     // for filter modulation, etc. Then efxoutr is signal + envelope for things such as dynamic distortion.
69     // Variable efollower is set to 0 by default in constructor.  Do not set this mode unless using this object
70     // to control a parameter with signal dynamics.
71 
72 private:
73 
74     void setlpf (int Plpf);
75     void sethpf (int Phpf);
76 
77 
78     float sgain;
79     float sfactor;
80     float tfactor;
81     float tlevel;
82     float a_rate;
83     float d_rate;
84     float env;
85     float oldgain;
86     float gain;
87     float fs;
88     float level;
89 
90 
91     float* interpbuf; //buffer for filters
92     AnalogFilter *lpfl, *lpfr, *hpfl, *hpfr;
93 
94     class FPreset *Fpre;
95 
96 };
97 
98 #endif
99