1 /*
2   Rakarrack Audio FX
3 
4   Dual_Flange.h - Super Flanger
5   Copyright (C) 2010 Ryan Billing
6   Authors:
7   Ryan Billing (a.k.a Transmogrifox)  --  Signal Processing
8   Copyright (C) 2010 Ryan Billing
9 
10   Nasca Octavian Paul -- Remnants of ZynAddSubFX Echo.h structure and utility routines common to ZynSubFX source
11   Copyright (C) 2002-2005 Nasca Octavian Paul
12 
13   Higher intensity flanging accomplished by picking two points out of the delay line to create a wider notch filter.
14 
15   This program is free software; you can redistribute it and/or modify
16   it under the terms of version 2 of the GNU General Public License
17   as published by the Free Software Foundation.
18 
19   This program is distributed in the hope that it will be useful,
20   but WITHOUT ANY WARRANTY; without even the implied warranty of
21   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22   GNU General Public License (version 2) for more details.
23 
24   You should have received a copy of the GNU General Public License (version 2)
25   along with this program; if not, write to the Free Software Foundation,
26   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
27 
28 */
29 
30 #ifndef DUAL_FLANGE_H
31 #define DUAL_FLANGE_H
32 
33 #include "global.h"
34 #include "EffectLFO.h"
35 #include "delayline.h"
36 
37 class Dflange
38 {
39 public:
40     Dflange (float * efxoutl_, float * efxoutr_, double sample_rate);
41     ~Dflange ();
42     void out (float * smpsl, float * smpr, uint32_t period);
43     void setpreset (int npreset);
44     void changepar (int npar, int value);
45     int getpar (int npar);
46     void cleanup ();
47 
48     int Ppreset;
49 
50     float *efxoutl;
51     float *efxoutr;
52 
53     uint32_t PERIOD;
54 
55 private:
56     //Parameters
57     int Pwetdry;		// 0 //Wet/Dry mix.  Range -64 to 64
58     int Ppanning;		// 1 //Panning.  Range -64 to 64
59     int Plrcross;		// 2 //L/R Mixing.  Range 0 to 127
60     int Pdepth;		// 3 //Max delay deviation expressed as frequency of lowest frequency notch.  Min = 20, Max = 4000
61     int Pwidth;		// 4 //LFO amplitude.  Range 0 to 16000 (Hz)
62     int Poffset;		// 5 //Offset of notch 1 to notch 2.  Range 0 to 100 (percent)
63     int Pfb;		// 6 //Feedback parameter.  Range -64 to 64
64     int Phidamp;		// 7 //Lowpass filter delay line.  Range 20 to 20000 (Hz)
65     int Psubtract;	// 8 //Subtract wet/dry instead of add.  Nonzero is true
66     int Pzero;		// 9 //Enable through-zero flanging,   Nonzero is true
67     // 10 //LFO Speed
68     // 11 //LFO stereo diff
69     // 12 //LFO type
70     // 13 //LFO Randomness
71     int Pintense;		// 14 //Intense Mode
72 
73     float wet, dry;		//Wet/Dry mix.
74     float lpan, rpan;		//Panning.
75     float flrcross, frlcross;	// L/R Mixing.
76     float fdepth;		//Max delay deviation expressed as frequency of lowest frequency notch.  Min = 20, Max = 15000
77     float fwidth;		//LFO amplitude.
78     float foffset;		// Offset of notch 1 to notch 2.  Range 0 to 1.0
79     float ffb;			//Feedback parameter.  Range -0.99 to 0.99
80     float fhidamp;		//Lowpass filter delay line.  Range 20 to 20000 (Hz)
81     float fsubtract;		//Subtract wet/dry instead of add.  Nonzero is true
82     float fzero;		//Enable through-zero flanging
83     float logmax;
84     EffectLFO *lfo;		//lfo Flanger
85 
86     //Internally used variables
87     int maxx_delay;
88     int kl, kr, zl, zr;
89     int zcenter;
90 
91     float l, r, ldl, rdl, zdr, zdl;
92     float rflange0, rflange1, lflange0, lflange1, oldrflange0, oldrflange1, oldlflange0, oldlflange1;
93     float period_const, base, ibase;
94     float *ldelay, *rdelay, *zldelay, *zrdelay;
95     float oldl, oldr;		//pt. lpf
96     float rsA, rsB, lsA, lsB;	//Audio sample at given delay
97 
98     delayline *ldelayline0, *rdelayline0, *ldelayline1, *rdelayline1;
99     class FPreset *Fpre;
100 
101     float fSAMPLE_RATE;
102 
103 
104 };
105 
106 
107 #endif
108