1 /*
2     Effect.h - inherited by the all effects
3 
4     Original ZynAddSubFX author Nasca Octavian Paul
5     Copyright (C) 2002-2005 Nasca Octavian Paul
6     Copyright 2009-2011, Alan Calvert
7     Copyright 2018, Will Godfrey
8 
9     This file is part of yoshimi, which is free software: you can redistribute
10     it and/or modify it under the terms of the GNU Library General Public
11     License as published by the Free Software Foundation; either version 2 of
12     the License, or (at your option) any later version.
13 
14     yoshimi is distributed in the hope that it will be useful, but WITHOUT ANY
15     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16     FOR A PARTICULAR PURPOSE.   See the GNU General Public License (version 2 or
17     later) for more details.
18 
19     You should have received a copy of the GNU General Public License along with
20     yoshimi; if not, write to the Free Software Foundation, Inc., 51 Franklin
21     Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 
23     This file is derivative of ZynAddSubFX original code.
24     Modified march 2018
25 */
26 
27 #ifndef EFFECT_H
28 #define EFFECT_H
29 
30 #include "Params/FilterParams.h"
31 #include "Misc/SynthHelper.h"
32 
33 class Effect
34 {
35     public:
36         Effect(bool insertion_, float *efxoutl_, float *efxoutr_,
37                FilterParams *filterpars_, unsigned char Ppreset_,
38                SynthEngine *synth_);
~Effect()39         virtual ~Effect() { };
40 
41         virtual void setpreset(unsigned char npreset) = 0;
42         virtual void changepar(int npar, unsigned char value) = 0;
43         virtual unsigned char getpar(int npar) = 0;
44         virtual void out(float *smpsl, float *smpsr) = 0;
cleanup()45         virtual void cleanup() { };
getfreqresponse(float)46         virtual float getfreqresponse(float /* freq */) { return (0); };
47 
48         unsigned char Ppreset; // Currentl preset
49         float *const efxoutl;
50         float *const efxoutr;
51         synth::InterpolatedValue<float> outvolume;
52         synth::InterpolatedValue<float> volume;
53         FilterParams *filterpars;
54 
55     protected:
56         void setpanning(char Ppanning_);
57         void setlrcross(char Plrcross_);
58 
59         bool  insertion;
60         char  Ppanning;
61         synth::InterpolatedValue<float> pangainL;
62         synth::InterpolatedValue<float> pangainR;
63         char  Plrcross; // L/R mix
64         synth::InterpolatedValue<float> lrcross;
65 
66         SynthEngine *synth;
67 };
68 
69 #endif
70 
71