1 /*
2   ZynAddSubFX - a software synthesizer
3 
4   DynamicFilter.h - "WahWah" effect and others
5   Copyright (C) 2002-2005 Nasca Octavian Paul
6   Author: Nasca Octavian Paul
7 
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
12 
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License (version 2 or later) for more details.
17 
18   You should have received a copy of the GNU General Public License (version 2)
19   along with this program; if not, write to the Free Software Foundation,
20   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 
22 */
23 
24 #ifndef DYNAMICFILTER_H
25 #define DYNAMICFILTER_H
26 
27 #include "Effect.h"
28 #include "EffectLFO.h"
29 
30 /**DynamicFilter Effect*/
31 class DynamicFilter:public Effect
32 {
33     public:
34         DynamicFilter(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize);
35         ~DynamicFilter();
36         void out(const Stereo<float *> &smp);
37 
38         void setpreset(unsigned char npreset);
39         void changepar(int npar, unsigned char value);
40         unsigned char getpar(int npar) const;
41         void cleanup(void);
42 
43     private:
44         //Parametrii DynamicFilter
45         EffectLFO     lfo;          //lfo-ul DynamicFilter
46         unsigned char Pvolume;      //Volume
47         unsigned char Pdepth;       //the depth of the lfo
48         unsigned char Pampsns;      //how the filter varies according to the input amplitude
49         unsigned char Pampsnsinv;   //if the filter freq is lowered if the input amplitude rises
50         unsigned char Pampsmooth;   //how smooth the input amplitude changes the filter
51 
52         //Parameter Control
53         void setvolume(unsigned char _Pvolume);
54         void setdepth(unsigned char _Pdepth);
55         void setampsns(unsigned char _Pampsns);
56 
57         void reinitfilter(void);
58 
59         //Internal Values
60         float depth, ampsns, ampsmooth;
61 
62         class Filter * filterl, *filterr;
63         float ms1, ms2, ms3, ms4; //mean squares
64 };
65 
66 #endif
67