1 /*
2   ZynAddSubFX - a software synthesizer
3 
4   Distorsion.h - Distorsion Effect
5   Copyright (C) 2002-2005 Nasca Octavian Paul
6   Author: Nasca Octavian Paul
7 
8   Modified for rakarrack by Josep Andreu  & Ryan Billing
9 
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of version 2 of the GNU General Public License
12   as published by the Free Software Foundation.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License (version 2) for more details.
18 
19   You should have received a copy of the GNU General Public License (version 2)
20   along with this program; if not, write to the Free Software Foundation,
21   Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22 
23 */
24 
25 #ifndef NEWDIST_H
26 #define NEWDIST_H
27 
28 #include "global.h"
29 #include "AnalogFilter.h"
30 #include "Waveshaper.h"
31 #include "FilterParams.h"
32 #include "Filter.h"
33 
34 //Waveshaping(called by Distorsion effect and waveshape from OscilGen)
35 // void waveshapesmps (int n, float * smps, int type,
36 // 		    int drive);
37 
38 class NewDist
39 {
40 public:
41     NewDist (float * efxoutl_, float * efxoutr_, double sample_rate,
42         uint32_t intermdediate_bufsize, int wave_res, int wave_upq, int wave_dnq);
43     ~NewDist ();
44     void out (float * smpsl, float * smpr, uint32_t period);
45     void setpreset (int npreset);
46     void changepar (int npar, int value);
47     int getpar (int npar);
48     void cleanup ();
49     void applyfilters (float * efxoutl, float * efxoutr, uint32_t period);
50 
51     int Ppreset;
52     float outvolume;
53 
54     float *efxoutl;
55     float *efxoutr;
56     float inpll[4096];
57     float inplr[4096];
58 
59 private:
60 
61     void setvolume (int Pvolume);
62     void setpanning (int Ppanning);
63     void setlrcross (int Plrcross);
64     void setoctave (int Poctave);
65     void setlpf (int Plpf);
66     void sethpf (int Phpf);
67 
68 
69     //Parametrii
70     int Pvolume;	//Volumul or E/R
71     int Ppanning;	//Panning
72     int Plrcross;	// L/R Mixing
73     int Pdrive;		//the input amplification
74     int Plevel;		//the ouput amplification
75     int Ptype;		//Distorsion type
76     int Pnegate;	//if the input is negated
77     int Plpf;		//lowpass filter
78     int Phpf;		//highpass filter
79     int Prfreq;
80     int Pprefiltering;	//if you want to do the filtering before the distorsion
81     int Poctave;	//mix sub octave
82 
83 
84     float rfreq;
85     float panning, lrcross, octave_memoryl, togglel, octave_memoryr, toggler, octmix;
86     float *octoutl, *octoutr;
87 
88 
89     //Parametrii reali
90     float* interpbuf;//buffer for filters
91     AnalogFilter *lpfl, *lpfr, *hpfl, *hpfr, *blockDCl, *blockDCr, *DCl, *DCr;
92     class Waveshaper *wshapel, *wshaper;
93 
94 
95     class Filter *filterl, *filterr;
96     class FilterParams *filterpars;
97 
98     class FPreset *Fpre;
99 
100 };
101 
102 
103 #endif
104