1 // generated from file '../src/LV2/faust/dallaswah.dsp' by dsp2cc:
2 // Code generated with Faust (https://faust.grame.fr)
3 
4 
5 namespace dallaswah {
6 
7 class Dsp: public PluginLV2 {
8 private:
9 	uint32_t fSampleRate;
10 	FAUSTFLOAT fVslider0;
11 	FAUSTFLOAT	*fVslider0_;
12 	double fConst0;
13 	double fConst3;
14 	double fConst4;
15 	int iVec0[2];
16 	double fConst5;
17 	double fVec1[2];
18 	double fRec1[2];
19 	double fConst6;
20 	double fConst8;
21 	FAUSTFLOAT fVslider1;
22 	FAUSTFLOAT	*fVslider1_;
23 	double fConst9;
24 	FAUSTFLOAT fVslider2;
25 	FAUSTFLOAT	*fVslider2_;
26 	double fRec4[2];
27 	double fRec3[2];
28 	double fRec2[2];
29 	double fConst10;
30 	double fConst11;
31 	double fConst12;
32 	double fConst13;
33 	double fRec7[2];
34 	double fRec6[2];
35 	double fRec5[2];
36 	FAUSTFLOAT fVslider3;
37 	FAUSTFLOAT	*fVslider3_;
38 	double fRec8[2];
39 	double fConst15;
40 	double fConst17;
41 	double fConst18;
42 	double fConst19;
43 	double fConst20;
44 	double fConst21;
45 	double fConst22;
46 	double fConst23;
47 	double fConst25;
48 	double fConst27;
49 	double fConst29;
50 	double fConst30;
51 	double fConst31;
52 	double fConst32;
53 	double fRec0[5];
54 	double fConst34;
55 	double fConst36;
56 	double fConst38;
57 	double fConst40;
58 	double fConst42;
59 	double fConst44;
60 	double fConst45;
61 	double fConst46;
62 	double fConst47;
63 	double fConst48;
64 	double fConst49;
65 	double fConst50;
66 	double fConst51;
67 	double fConst52;
68 	double fConst53;
69 
70 	void connect(uint32_t port,void* data);
71 	void clear_state_f();
72 	void init(uint32_t sample_rate);
73 	void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
74 
75 	static void clear_state_f_static(PluginLV2*);
76 	static void init_static(uint32_t sample_rate, PluginLV2*);
77 	static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
78 	static void del_instance(PluginLV2 *p);
79 	static void connect_static(uint32_t port,void* data, PluginLV2 *p);
80 public:
81 	Dsp();
82 	~Dsp();
83 };
84 
85 
86 
Dsp()87 Dsp::Dsp()
88 	: PluginLV2() {
89 	version = PLUGINLV2_VERSION;
90 	id = "dallaswah";
91 	name = N_("Dallas Wah");
92 	mono_audio = compute_static;
93 	stereo_audio = 0;
94 	set_samplerate = init_static;
95 	activate_plugin = 0;
96 	connect_ports = connect_static;
97 	clear_state = clear_state_f_static;
98 	delete_instance = del_instance;
99 }
100 
~Dsp()101 Dsp::~Dsp() {
102 }
103 
clear_state_f()104 inline void Dsp::clear_state_f()
105 {
106 	for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) iVec0[l0] = 0;
107 	for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) fVec1[l1] = 0.0;
108 	for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) fRec1[l2] = 0.0;
109 	for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) fRec4[l3] = 0.0;
110 	for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) fRec3[l4] = 0.0;
111 	for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) fRec2[l5] = 0.0;
112 	for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) fRec7[l6] = 0.0;
113 	for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) fRec6[l7] = 0.0;
114 	for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) fRec5[l8] = 0.0;
115 	for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) fRec8[l9] = 0.0;
116 	for (int l10 = 0; (l10 < 5); l10 = (l10 + 1)) fRec0[l10] = 0.0;
117 }
118 
clear_state_f_static(PluginLV2 * p)119 void Dsp::clear_state_f_static(PluginLV2 *p)
120 {
121 	static_cast<Dsp*>(p)->clear_state_f();
122 }
123 
init(uint32_t sample_rate)124 inline void Dsp::init(uint32_t sample_rate)
125 {
126 	fSampleRate = sample_rate;
127 	fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
128 	double fConst1 = (1833.7929316777988 / fConst0);
129 	double fConst2 = (fConst1 + 1.0);
130 	fConst3 = (1.0 / fConst2);
131 	fConst4 = (1.0 - fConst1);
132 	fConst5 = (0.01 / fConst2);
133 	fConst6 = mydsp_faustpower2_f(fConst0);
134 	double fConst7 = (2.4203899133154399e-19 * fConst0);
135 	fConst8 = (fConst0 * ((fConst6 * (-7.7348245376198901e-17 - fConst7)) + 6.9335873555484602e-11));
136 	fConst9 = (0.10471975511965977 / fConst0);
137 	fConst10 = std::exp((0.0 - (100.0 / fConst0)));
138 	fConst11 = (1.0 - fConst10);
139 	fConst12 = std::exp((0.0 - (10.0 / fConst0)));
140 	fConst13 = (1.0 - fConst12);
141 	double fConst14 = (1.09962424162848e-18 * fConst0);
142 	fConst15 = ((fConst6 * (-4.9081562024677497e-17 - fConst14)) + 1.1209103273650301e-11);
143 	double fConst16 = (1.7918901081266399e-19 * fConst0);
144 	fConst17 = ((fConst6 * (fConst16 + 2.1845348295102101e-17)) + 4.0298733331264199e-26);
145 	fConst18 = (fConst6 * ((3.6305848699731698e-19 * fConst6) + -2.7822356237811299e-12));
146 	fConst19 = ((1.6494363624427299e-18 * fConst6) + -2.8397698687053998e-13);
147 	fConst20 = (4.1922046243452401e-13 - (2.6878351621899599e-19 * fConst6));
148 	fConst21 = (fConst0 * ((fConst6 * (7.7348245376198901e-17 - fConst7)) + -6.9335873555484602e-11));
149 	fConst22 = ((fConst6 * (4.9081562024677497e-17 - fConst14)) + -1.1209103273650301e-11);
150 	fConst23 = ((fConst6 * (fConst16 + -2.1845348295102101e-17)) + -4.0298733331264199e-26);
151 	double fConst24 = (6.0509747832886095e-20 * fConst0);
152 	fConst25 = (fConst0 * ((fConst0 * ((fConst0 * (fConst24 + -3.8674122688099401e-17)) + 1.3911178118905599e-12)) + -3.4667936777742301e-11));
153 	double fConst26 = (2.7490606040712101e-19 * fConst0);
154 	fConst27 = ((fConst0 * ((fConst0 * (fConst26 + -2.4540781012338699e-17)) + 1.4198849343526999e-13)) + -5.6045516368251698e-12);
155 	double fConst28 = (4.4797252703165901e-20 * fConst0);
156 	fConst29 = ((fConst0 * ((fConst0 * (1.0922674147551e-17 - fConst28)) + -2.09610231217262e-13)) + -2.0149366665632099e-26);
157 	fConst30 = (fConst0 * ((fConst0 * ((fConst0 * (fConst24 + 3.8674122688099401e-17)) + 1.3911178118905599e-12)) + 3.4667936777742301e-11));
158 	fConst31 = ((fConst0 * ((fConst0 * (fConst26 + 2.4540781012338699e-17)) + 1.4198849343526999e-13)) + 5.6045516368251698e-12);
159 	fConst32 = ((fConst0 * ((fConst0 * (-1.0922674147551e-17 - fConst28)) + -2.09610231217262e-13)) + 2.0149366665632099e-26);
160 	double fConst33 = (7.0791743200520402e-21 * fConst0);
161 	fConst34 = ((fConst0 * ((fConst0 * (-5.5238902898921503e-16 - fConst33)) + -8.6311711901986799e-13)) + -5.6213535639818098e-12);
162 	double fConst35 = (2.3234786046117102e-21 * fConst0);
163 	fConst36 = ((fConst0 * ((fConst0 * (-8.6410831164332904e-17 - fConst35)) + -1.3357552590519501e-13)) + -3.41675778537176e-12);
164 	double fConst37 = (2.83510090714092e-21 * fConst0);
165 	fConst38 = ((fConst0 * ((fConst0 * (fConst37 + 1.04896968320146e-16)) + 1.5953481862304399e-13)) + -1.5335728307264501e-26);
166 	double fConst39 = (2.8316697280208203e-20 * fConst0);
167 	fConst40 = ((fConst6 * (fConst39 + 1.1047780579784301e-15)) + -1.12427071279636e-11);
168 	double fConst41 = (9.2939144184468497e-21 * fConst0);
169 	fConst42 = ((fConst6 * (fConst41 + 1.7282166232866601e-16)) + -6.8335155707435103e-12);
170 	double fConst43 = (1.13404036285637e-20 * fConst0);
171 	fConst44 = ((fConst6 * (-2.0979393664029301e-16 - fConst43)) + -3.0671456614528898e-26);
172 	fConst45 = (1.72623423803974e-12 - (4.2475045920312298e-20 * fConst6));
173 	fConst46 = (2.6715105181039001e-13 - (1.3940871627670301e-20 * fConst6));
174 	fConst47 = ((1.7010605442845499e-20 * fConst6) + -3.1906963724608798e-13);
175 	fConst48 = ((fConst6 * (fConst39 + -1.1047780579784301e-15)) + 1.12427071279636e-11);
176 	fConst49 = ((fConst6 * (fConst41 + -1.7282166232866601e-16)) + 6.8335155707435103e-12);
177 	fConst50 = ((fConst6 * (2.0979393664029301e-16 - fConst43)) + 3.0671456614528898e-26);
178 	fConst51 = ((fConst0 * ((fConst0 * (5.5238902898921503e-16 - fConst33)) + -8.6311711901986799e-13)) + 5.6213535639818098e-12);
179 	fConst52 = ((fConst0 * ((fConst0 * (8.6410831164332904e-17 - fConst35)) + -1.3357552590519501e-13)) + 3.41675778537176e-12);
180 	fConst53 = ((fConst0 * ((fConst0 * (fConst37 + -1.04896968320146e-16)) + 1.5953481862304399e-13)) + 1.5335728307264501e-26);
181 	clear_state_f();
182 }
183 
init_static(uint32_t sample_rate,PluginLV2 * p)184 void Dsp::init_static(uint32_t sample_rate, PluginLV2 *p)
185 {
186 	static_cast<Dsp*>(p)->init(sample_rate);
187 }
188 
compute(int count,FAUSTFLOAT * input0,FAUSTFLOAT * output0)189 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
190 {
191 #define fVslider0 (*fVslider0_)
192 #define fVslider1 (*fVslider1_)
193 #define fVslider2 (*fVslider2_)
194 #define fVslider3 (*fVslider3_)
195 	double fSlow0 = double(fVslider0);
196 	double fSlow1 = (0.01 * fSlow0);
197 	double fSlow2 = (1.0 - fSlow1);
198 	double fSlow3 = (fConst5 * fSlow0);
199 	int iSlow4 = int(double(fVslider1));
200 	int iSlow5 = (iSlow4 == 0);
201 	int iSlow6 = (iSlow4 == 1);
202 	double fSlow7 = (fConst9 * double(fVslider2));
203 	double fSlow8 = (4.748558434412966e-05 * (std::exp((5.0 * (1.0 - std::max<double>(0.01, double(fVslider3))))) + -1.0));
204 	for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
205 		double fTemp0 = double(input0[i0]);
206 		iVec0[0] = 1;
207 		fVec1[0] = (fSlow3 * fTemp0);
208 		fRec1[0] = ((fConst3 * ((fSlow1 * fTemp0) + (fConst4 * fRec1[1]))) - fVec1[1]);
209 		fRec4[0] = (fRec4[1] + (fSlow7 * (0.0 - fRec2[1])));
210 		fRec3[0] = ((fSlow7 * fRec4[0]) + (double((1 - iVec0[1])) + fRec3[1]));
211 		fRec2[0] = fRec3[0];
212 		double fTemp1 = std::fabs(fTemp0);
213 		fRec7[0] = std::max<double>(fTemp1, ((fConst12 * fRec7[1]) + (fConst13 * fTemp1)));
214 		fRec6[0] = ((fConst10 * fRec6[1]) + (fConst11 * fRec7[0]));
215 		fRec5[0] = ((0.99299999999999999 * fRec5[1]) + (0.0070000000000000062 * std::max<double>(0.02, std::min<double>(1.0, fRec6[0]))));
216 		double fThen0 = (1.0 - std::max<double>(0.02, std::min<double>(0.97999999999999998, (0.5 * (fRec2[0] + 1.0)))));
217 		fRec8[0] = (fSlow8 + (0.99299999999999999 * fRec8[1]));
218 		double fThen1 = (iSlow6 ? fRec5[0] : fThen0);
219 		double fTemp2 = (iSlow5 ? fRec8[0] : fThen1);
220 		double fTemp3 = (fConst30 + ((fTemp2 * ((fConst0 * (fConst31 + (fConst32 * fTemp2))) + -5.3875311940192799e-25)) + 1.4985432184024801e-10));
221 		fRec0[0] = (fRec1[0] - (((((fRec0[1] * (fConst8 + ((fTemp2 * ((fConst0 * (fConst15 + (fConst17 * fTemp2))) + -2.1550124776077101e-24)) + 5.9941728736099297e-10))) + (fRec0[2] * (fConst18 + ((fTemp2 * ((fConst6 * (fConst19 + (fConst20 * fTemp2))) + -3.23251871641157e-24)) + 8.9912593104148899e-10)))) + (fRec0[3] * (fConst21 + ((fTemp2 * ((fConst0 * (fConst22 + (fConst23 * fTemp2))) + -2.1550124776077101e-24)) + 5.9941728736099297e-10)))) + (fRec0[4] * (fConst25 + ((fTemp2 * ((fConst0 * (fConst27 + (fConst29 * fTemp2))) + -5.3875311940192799e-25)) + 1.4985432184024801e-10)))) / fTemp3));
222 		output0[i0] = FAUSTFLOAT(((fSlow2 * fTemp0) + (fConst0 * ((((((fRec0[0] * (fConst34 + (fTemp2 * (fConst36 + (fConst38 * fTemp2))))) + (fRec0[1] * (fConst40 + (fTemp2 * (fConst42 + (fConst44 * fTemp2)))))) + (fConst0 * (fRec0[2] * (fConst45 + (fTemp2 * (fConst46 + (fConst47 * fTemp2))))))) + (fRec0[3] * (fConst48 + (fTemp2 * (fConst49 + (fConst50 * fTemp2)))))) + (fRec0[4] * (fConst51 + (fTemp2 * (fConst52 + (fConst53 * fTemp2)))))) / fTemp3))));
223 		iVec0[1] = iVec0[0];
224 		fVec1[1] = fVec1[0];
225 		fRec1[1] = fRec1[0];
226 		fRec4[1] = fRec4[0];
227 		fRec3[1] = fRec3[0];
228 		fRec2[1] = fRec2[0];
229 		fRec7[1] = fRec7[0];
230 		fRec6[1] = fRec6[0];
231 		fRec5[1] = fRec5[0];
232 		fRec8[1] = fRec8[0];
233 		for (int j0 = 4; (j0 > 0); j0 = (j0 - 1)) {
234 			fRec0[j0] = fRec0[(j0 - 1)];
235 		}
236 	}
237 #undef fVslider0
238 #undef fVslider1
239 #undef fVslider2
240 #undef fVslider3
241 }
242 
compute_static(int count,FAUSTFLOAT * input0,FAUSTFLOAT * output0,PluginLV2 * p)243 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
244 {
245 	static_cast<Dsp*>(p)->compute(count, input0, output0);
246 }
247 
248 
connect(uint32_t port,void * data)249 void Dsp::connect(uint32_t port,void* data)
250 {
251 	switch ((PortIndex)port)
252 	{
253 	case WAH:
254 		fVslider3_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
255 		break;
256 	case FREQ:
257 		fVslider2_ = (float*)data; // , 24.0, 24.0, 360.0, 1.0
258 	// static const value_pair fVslider1_values[] = {{"manual"},{"auto"},{"alien"},{0}};
259 	case MODE:
260 		fVslider1_ = (float*)data; // , 0.0, 0.0, 2.0, 1.0
261 		break;
262 	case WET_DRY:
263 		fVslider0_ = (float*)data; // , 100.0, 0.0, 100.0, 1.0
264 		break;
265 	default:
266 		break;
267 	}
268 }
269 
connect_static(uint32_t port,void * data,PluginLV2 * p)270 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
271 {
272 	static_cast<Dsp*>(p)->connect(port, data);
273 }
274 
275 
plugin()276 PluginLV2 *plugin() {
277 	return new Dsp();
278 }
279 
del_instance(PluginLV2 * p)280 void Dsp::del_instance(PluginLV2 *p)
281 {
282 	delete static_cast<Dsp*>(p);
283 }
284 
285 /*
286 typedef enum
287 {
288    WAH,
289    FREQ,
290    MODE,
291    WET_DRY,
292 } PortIndex;
293 */
294 
295 } // end namespace dallaswah
296