forked from striso/striso-control-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynth.cpp
977 lines (937 loc) · 42.6 KB
/
synth.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
//----------------------------------------------------------
// name: "synth.dsp.tmp"
//
// Code generated with Faust 2.37.3 (https://faust.grame.fr)
//----------------------------------------------------------
/* link with : "" */
#include "fastpow.h"
#include <math.h>
#ifndef FAUSTPOWER
#define FAUSTPOWER
//#include <cmath>
template <int N> inline int faustpower(int x) { return faustpower<N/2>(x) * faustpower<N-N/2>(x); }
template <> inline int faustpower<0>(int x) { return 1; }
template <> inline int faustpower<1>(int x) { return x; }
template <> inline int faustpower<2>(int x) { return x*x; }
template <int N> inline float faustpower(float x) { return faustpower<N/2>(x) * faustpower<N-N/2>(x); }
template <> inline float faustpower<0>(float x) { return 1; }
template <> inline float faustpower<1>(float x) { return x; }
template <> inline float faustpower<2>(float x) { return x*x; }
#endif
extern "C" {
#include "ch.h"
#include "hal.h"
#include "synth.h"
}
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX_VAL (1<<23)
#define VOLUME_FILTER 0.99f
class dsp {
protected:
int fSamplingFreq;
};
struct Meta {
virtual void declare(const char* key, const char* value) = 0;
};
// variables
synth_interface_t synth_interface;
static float dump;
float volume = 1.0f;
static int32_t *outbuf;
static int32_t *inbuf;
static float output0[CHANNEL_BUFFER_SIZE] = {0.0};
static float output1[CHANNEL_BUFFER_SIZE] = {0.0};
static float* output[2] = {output0, output1};
// Intrinsics
// Class
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
#ifndef FAUSTCLASS
#define FAUSTCLASS mydsp
#endif
class mydsp : public dsp {
private:
class SIG0 {
private:
int fSampleRate;
public:
int getNumInputs() { return 0; }
int getNumOutputs() { return 1; }
void init(int sample_rate) {
fSampleRate = sample_rate;
}
void fill(int count, float output[]) {
for (int i=0; i<count; i++) {
output[i] = (9.3132257504915938e-10f * rand_hoaglin());
}
}
};
float fConst4;
float fConst6;
float fConst8;
float fConst10;
float fConst12;
FAUSTFLOAT fslider0;
static float ftbl0[4096];
FAUSTFLOAT fslider1;
float fVec0[2];
float fConst13;
float fConst14;
float fRec2[2];
float fRec1[3];
float fConst16;
float fConst18;
FAUSTFLOAT fslider2;
float fRec3[3];
float fConst20;
float fConst22;
FAUSTFLOAT fslider3;
float fRec4[3];
float fConst26;
float fConst28;
float fConst30;
FAUSTFLOAT fslider4;
float fRec5[3];
float fConst31;
FAUSTFLOAT fslider5;
float fConst32;
float fConst33;
float fRec6[2];
float fRec7[2];
float fConst34;
float fConst38;
float fConst40;
float fConst42;
FAUSTFLOAT fslider6;
FAUSTFLOAT fslider7;
float fConst43;
float fRec13[2];
float fRec12[3];
float fConst44;
float fConst48;
float fConst50;
float fConst52;
float fConst53;
float fConst55;
FAUSTFLOAT fslider8;
float fRec16[3];
float fConst56;
float fRec15[3];
float fConst57;
float fConst58;
float fRec14[2];
float fRec9[2];
float fRec10[2];
FAUSTFLOAT fslider9;
float fVec1[2];
float fRec18[2];
float fRec17[3];
float fRec19[3];
float fRec20[3];
FAUSTFLOAT fslider10;
float fRec21[3];
FAUSTFLOAT fslider11;
float fRec22[2];
float fRec23[2];
FAUSTFLOAT fslider12;
float fRec29[2];
float fRec28[3];
float fRec25[2];
float fRec26[2];
FAUSTFLOAT fslider13;
float fVec2[2];
float fRec31[2];
float fRec30[3];
float fRec32[3];
float fRec33[3];
FAUSTFLOAT fslider14;
float fRec34[3];
FAUSTFLOAT fslider15;
float fRec35[2];
float fRec36[2];
FAUSTFLOAT fslider16;
float fRec42[2];
float fRec41[3];
float fRec38[2];
float fRec39[2];
FAUSTFLOAT fslider17;
float fVec3[2];
float fRec44[2];
float fRec43[3];
float fRec45[3];
float fRec46[3];
FAUSTFLOAT fslider18;
float fRec47[3];
FAUSTFLOAT fslider19;
float fRec48[2];
float fRec49[2];
FAUSTFLOAT fslider20;
float fRec55[2];
float fRec54[3];
float fRec51[2];
float fRec52[2];
FAUSTFLOAT fslider21;
float fVec4[2];
float fRec57[2];
float fRec56[3];
float fRec58[3];
float fRec59[3];
FAUSTFLOAT fslider22;
float fRec60[3];
FAUSTFLOAT fslider23;
float fRec61[2];
float fRec62[2];
FAUSTFLOAT fslider24;
float fRec68[2];
float fRec67[3];
float fRec64[2];
float fRec65[2];
FAUSTFLOAT fslider25;
float fVec5[2];
float fRec70[2];
float fRec69[3];
float fRec71[3];
float fRec72[3];
FAUSTFLOAT fslider26;
float fRec73[3];
FAUSTFLOAT fslider27;
float fRec74[2];
float fRec75[2];
FAUSTFLOAT fslider28;
float fRec81[2];
float fRec80[3];
float fRec77[2];
float fRec78[2];
float fConst59;
float fRec0[3];
float fConst60;
int fSampleRate;
public:
virtual void metadata(Meta* m) {
m->declare("fast.lib/author", "Piers Titus van der Torren ([email protected])");
m->declare("fast.lib/licence", "Apache-2.0");
m->declare("fast.lib/name", "Faust Fast Approximations Library");
m->declare("filename", "synth.dsp.tmp");
m->declare("filters.lib/lowpass0_highpass1", "Copyright (C) 2003-2019 by Julius O. Smith III <[email protected]>");
m->declare("filters.lib/name", "Faust Filters Library");
m->declare("filters.lib/svf:author", "Oleg Nesterov");
m->declare("filters.lib/svf:copyright", "Copyright (C) 2020 Oleg Nesterov <[email protected]>");
m->declare("filters.lib/svf:license", "MIT-style STK-4.3 license");
m->declare("filters.lib/version", "0.3");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
m->declare("maths.lib/version", "2.5");
m->declare("name", "synth.dsp.tmp");
m->declare("platform.lib/name", "Generic Platform Library");
m->declare("platform.lib/version", "0.2");
m->declare("routes.lib/name", "Faust Signal Routing Library");
m->declare("routes.lib/version", "0.2");
m->declare("signals.lib/name", "Faust Signal Routing Library");
m->declare("signals.lib/version", "0.1");
}
virtual int getNumInputs() { return 0; }
virtual int getNumOutputs() { return 1; }
static void classInit(int sample_rate) {
SIG0 sig0;
sig0.init(sample_rate);
sig0.fill(4096,ftbl0);
}
virtual void instanceConstants(int sample_rate) {
fSampleRate = sample_rate;
float fConst0 = min(192000.0f, max(1.0f, (float)fSampleRate));
float fConst1 = faustpower<2>(fConst0);
float fConst2 = faustpower<2>((251.32741228718345f / fConst0));
float fConst3 = ((fConst2 * ((0.20330000000000001f * fConst2) + 0.31755f)) + 1.0f);
fConst4 = (2.0f * ((63165.468166971892f * (faustpower<2>(fConst3) / fConst1)) + -1.0f));
float fConst5 = (63165.468166971892f * (fConst3 / fConst0));
fConst6 = (((fConst3 * (fConst5 + -191.85298647876598f)) / fConst0) + 1.0f);
float fConst7 = (((fConst3 * (fConst5 + 191.85298647876598f)) / fConst0) + 1.0f);
fConst8 = (1.0f / fConst7);
float fConst9 = faustpower<2>((4084.0704496667308f / fConst0));
fConst10 = (4084.0704496667308f * (((fConst9 * ((0.20330000000000001f * fConst9) + 0.31755f)) + 1.0f) / fConst0));
float fConst11 = faustpower<2>((8168.1408993334617f / fConst0));
fConst12 = (8168.1408993334617f * (((fConst11 * ((0.20330000000000001f * fConst11) + 0.31755f)) + 1.0f) / fConst0));
fConst13 = (0.061156102924877762f * fConst0);
fConst14 = (8.1757989159999997f / fConst0);
float fConst15 = faustpower<2>((942.47779607693792f / fConst0));
fConst16 = (942.47779607693792f * (((fConst15 * ((0.20330000000000001f * fConst15) + 0.31755f)) + 1.0f) / fConst0));
float fConst17 = faustpower<2>((1884.9555921538758f / fConst0));
fConst18 = (1884.9555921538758f * (((fConst17 * ((0.20330000000000001f * fConst17) + 0.31755f)) + 1.0f) / fConst0));
float fConst19 = faustpower<2>((2827.4333882308138f / fConst0));
fConst20 = (2827.4333882308138f * (((fConst19 * ((0.20330000000000001f * fConst19) + 0.31755f)) + 1.0f) / fConst0));
float fConst21 = faustpower<2>((5340.7075111026479f / fConst0));
fConst22 = (5340.7075111026479f * (((fConst21 * ((0.20330000000000001f * fConst21) + 0.31755f)) + 1.0f) / fConst0));
float fConst23 = faustpower<2>((62.831853071795862f / fConst0));
float fConst24 = ((fConst23 * ((0.20330000000000001f * fConst23) + 0.31755f)) + 1.0f);
float fConst25 = faustpower<2>(fConst24);
fConst26 = (2.0f * ((3947.8417604357433f * (fConst25 / fConst1)) + -1.0f));
float fConst27 = (3947.8417604357433f * (fConst24 / fConst0));
fConst28 = (((fConst24 * (fConst27 + -88.495567706754741f)) / fConst0) + 1.0f);
float fConst29 = (((fConst24 * (fConst27 + 88.495567706754741f)) / fConst0) + 1.0f);
fConst30 = (1.0f / fConst29);
fConst31 = (fConst25 / (fConst1 * fConst29));
fConst32 = (3000.0f * fConst31);
fConst33 = (3.1415926535897931f / fConst0);
fConst34 = (0.80000000000000004f * fConst31);
float fConst35 = faustpower<2>((314.15926535897933f / fConst0));
float fConst36 = ((fConst35 * ((0.20330000000000001f * fConst35) + 0.31755f)) + 1.0f);
float fConst37 = faustpower<2>(fConst36);
fConst38 = (2.0f * ((98696.044010893587f * (fConst37 / fConst1)) + -1.0f));
float fConst39 = (98696.044010893587f * (fConst36 / fConst0));
fConst40 = (((fConst36 * (fConst39 + -314.15926535897933f)) / fConst0) + 1.0f);
float fConst41 = (((fConst36 * (fConst39 + 314.15926535897933f)) / fConst0) + 1.0f);
fConst42 = (1.0f / fConst41);
fConst43 = (0.010937499999999999f / fConst0);
fConst44 = (fConst37 / (fConst1 * fConst41));
float fConst45 = faustpower<2>((125.66370614359172f / fConst0));
float fConst46 = ((fConst45 * ((0.20330000000000001f * fConst45) + 0.31755f)) + 1.0f);
float fConst47 = faustpower<2>(fConst46);
fConst48 = (2.0f * ((15791.367041742973f * (fConst47 / fConst1)) + -1.0f));
float fConst49 = (15791.367041742973f * (fConst46 / fConst0));
fConst50 = (((fConst46 * (fConst49 + -232.71056693257725f)) / fConst0) + 1.0f);
float fConst51 = (((fConst46 * (fConst49 + 232.71056693257725f)) / fConst0) + 1.0f);
fConst52 = (1.0f / fConst51);
fConst53 = (((fConst46 * (fConst49 + -95.926493239382992f)) / fConst0) + 1.0f);
float fConst54 = (((fConst46 * (fConst49 + 95.926493239382992f)) / fConst0) + 1.0f);
fConst55 = (1.0f / fConst54);
fConst56 = (fConst47 / (fConst1 * fConst54));
fConst57 = (fConst47 / (fConst1 * fConst51));
fConst58 = powf(0.5f,(10.0f / fConst0));
fConst59 = (1.3700000000000001f * fConst44);
fConst60 = (0 - (2.0f / fConst7));
}
virtual void instanceResetUserInterface() {
fslider0 = 0.0f;
fslider1 = 69.0f;
fslider2 = 0.0f;
fslider3 = 0.0f;
fslider4 = 0.0f;
fslider5 = 0.0f;
fslider6 = 0.0f;
fslider7 = 0.1875f;
fslider8 = 1.0f;
fslider9 = 69.0f;
fslider10 = 0.0f;
fslider11 = 0.0f;
fslider12 = 0.0f;
fslider13 = 69.0f;
fslider14 = 0.0f;
fslider15 = 0.0f;
fslider16 = 0.0f;
fslider17 = 69.0f;
fslider18 = 0.0f;
fslider19 = 0.0f;
fslider20 = 0.0f;
fslider21 = 69.0f;
fslider22 = 0.0f;
fslider23 = 0.0f;
fslider24 = 0.0f;
fslider25 = 69.0f;
fslider26 = 0.0f;
fslider27 = 0.0f;
fslider28 = 0.0f;
}
virtual void instanceClear() {
for (int i=0; i<2; i++) fVec0[i] = 0;
for (int i=0; i<2; i++) fRec2[i] = 0;
for (int i=0; i<3; i++) fRec1[i] = 0;
for (int i=0; i<3; i++) fRec3[i] = 0;
for (int i=0; i<3; i++) fRec4[i] = 0;
for (int i=0; i<3; i++) fRec5[i] = 0;
for (int i=0; i<2; i++) fRec6[i] = 0;
for (int i=0; i<2; i++) fRec7[i] = 0;
for (int i=0; i<2; i++) fRec13[i] = 0;
for (int i=0; i<3; i++) fRec12[i] = 0;
for (int i=0; i<3; i++) fRec16[i] = 0;
for (int i=0; i<3; i++) fRec15[i] = 0;
for (int i=0; i<2; i++) fRec14[i] = 0;
for (int i=0; i<2; i++) fRec9[i] = 0;
for (int i=0; i<2; i++) fRec10[i] = 0;
for (int i=0; i<2; i++) fVec1[i] = 0;
for (int i=0; i<2; i++) fRec18[i] = 0;
for (int i=0; i<3; i++) fRec17[i] = 0;
for (int i=0; i<3; i++) fRec19[i] = 0;
for (int i=0; i<3; i++) fRec20[i] = 0;
for (int i=0; i<3; i++) fRec21[i] = 0;
for (int i=0; i<2; i++) fRec22[i] = 0;
for (int i=0; i<2; i++) fRec23[i] = 0;
for (int i=0; i<2; i++) fRec29[i] = 0;
for (int i=0; i<3; i++) fRec28[i] = 0;
for (int i=0; i<2; i++) fRec25[i] = 0;
for (int i=0; i<2; i++) fRec26[i] = 0;
for (int i=0; i<2; i++) fVec2[i] = 0;
for (int i=0; i<2; i++) fRec31[i] = 0;
for (int i=0; i<3; i++) fRec30[i] = 0;
for (int i=0; i<3; i++) fRec32[i] = 0;
for (int i=0; i<3; i++) fRec33[i] = 0;
for (int i=0; i<3; i++) fRec34[i] = 0;
for (int i=0; i<2; i++) fRec35[i] = 0;
for (int i=0; i<2; i++) fRec36[i] = 0;
for (int i=0; i<2; i++) fRec42[i] = 0;
for (int i=0; i<3; i++) fRec41[i] = 0;
for (int i=0; i<2; i++) fRec38[i] = 0;
for (int i=0; i<2; i++) fRec39[i] = 0;
for (int i=0; i<2; i++) fVec3[i] = 0;
for (int i=0; i<2; i++) fRec44[i] = 0;
for (int i=0; i<3; i++) fRec43[i] = 0;
for (int i=0; i<3; i++) fRec45[i] = 0;
for (int i=0; i<3; i++) fRec46[i] = 0;
for (int i=0; i<3; i++) fRec47[i] = 0;
for (int i=0; i<2; i++) fRec48[i] = 0;
for (int i=0; i<2; i++) fRec49[i] = 0;
for (int i=0; i<2; i++) fRec55[i] = 0;
for (int i=0; i<3; i++) fRec54[i] = 0;
for (int i=0; i<2; i++) fRec51[i] = 0;
for (int i=0; i<2; i++) fRec52[i] = 0;
for (int i=0; i<2; i++) fVec4[i] = 0;
for (int i=0; i<2; i++) fRec57[i] = 0;
for (int i=0; i<3; i++) fRec56[i] = 0;
for (int i=0; i<3; i++) fRec58[i] = 0;
for (int i=0; i<3; i++) fRec59[i] = 0;
for (int i=0; i<3; i++) fRec60[i] = 0;
for (int i=0; i<2; i++) fRec61[i] = 0;
for (int i=0; i<2; i++) fRec62[i] = 0;
for (int i=0; i<2; i++) fRec68[i] = 0;
for (int i=0; i<3; i++) fRec67[i] = 0;
for (int i=0; i<2; i++) fRec64[i] = 0;
for (int i=0; i<2; i++) fRec65[i] = 0;
for (int i=0; i<2; i++) fVec5[i] = 0;
for (int i=0; i<2; i++) fRec70[i] = 0;
for (int i=0; i<3; i++) fRec69[i] = 0;
for (int i=0; i<3; i++) fRec71[i] = 0;
for (int i=0; i<3; i++) fRec72[i] = 0;
for (int i=0; i<3; i++) fRec73[i] = 0;
for (int i=0; i<2; i++) fRec74[i] = 0;
for (int i=0; i<2; i++) fRec75[i] = 0;
for (int i=0; i<2; i++) fRec81[i] = 0;
for (int i=0; i<3; i++) fRec80[i] = 0;
for (int i=0; i<2; i++) fRec77[i] = 0;
for (int i=0; i<2; i++) fRec78[i] = 0;
for (int i=0; i<3; i++) fRec0[i] = 0;
}
virtual void init(int sample_rate) {
classInit(sample_rate);
instanceInit(sample_rate);
}
virtual void instanceInit(int sample_rate) {
instanceConstants(sample_rate);
instanceResetUserInterface();
instanceClear();
}
virtual int getSampleRate() {
return fSampleRate;
}
virtual void buildUserInterfaceEmbedded() {
synth_interface.acc_abs = &fslider8;
synth_interface.pedal = &fslider7;
synth_interface.rot_x = &fslider2;
synth_interface.rot_y = &fslider3;
synth_interface.rot_z = &fslider0;
synth_interface.note[0] = &fslider25;
synth_interface.pres[0] = &fslider27;
synth_interface.vpres[0] = &fslider28;
synth_interface.but_y[0] = &fslider26;
synth_interface.note[1] = &fslider21;
synth_interface.pres[1] = &fslider23;
synth_interface.vpres[1] = &fslider24;
synth_interface.but_y[1] = &fslider22;
synth_interface.note[2] = &fslider17;
synth_interface.pres[2] = &fslider19;
synth_interface.vpres[2] = &fslider20;
synth_interface.but_y[2] = &fslider18;
synth_interface.note[3] = &fslider13;
synth_interface.pres[3] = &fslider15;
synth_interface.vpres[3] = &fslider16;
synth_interface.but_y[3] = &fslider14;
synth_interface.note[4] = &fslider9;
synth_interface.pres[4] = &fslider11;
synth_interface.vpres[4] = &fslider12;
synth_interface.but_y[4] = &fslider10;
synth_interface.note[5] = &fslider1;
synth_interface.pres[5] = &fslider5;
synth_interface.vpres[5] = &fslider6;
synth_interface.but_y[5] = &fslider4;
}
virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
//zone1
//zone2
float fSlow0 = float(fslider0);
float fSlow1 = ((int((fSlow0 > 0.0f)))?fConst12:fConst10);
float fSlow2 = fabsf(fSlow0);
float fSlow3 = ((0.5f * fSlow2) + 1.0f);
float fSlow4 = (fSlow3 * fSlow1);
float fSlow5 = ((fSlow3 * (fSlow1 * (fSlow4 + 0.125f))) + 1.0f);
float fSlow6 = ((faustpower<2>(fSlow3) * faustpower<2>(fSlow1)) + -1.0f);
float fSlow7 = ((fSlow3 * (fSlow1 * (fSlow4 + -0.125f))) + 1.0f);
float fSlow8 = float(fslider1);
float fSlow9 = fastpow2((0.083333333333333329f * fSlow8));
int iSlow10 = int(min((fConst13 / fSlow9), (float)4096));
float fSlow11 = float(iSlow10);
float fSlow12 = (fConst14 * (fSlow9 * fSlow11));
float fSlow13 = (fSlow2 * fSlow3);
float fSlow14 = float(fslider2);
float fSlow15 = ((int((fSlow14 > 0.0f)))?fConst18:fConst16);
float fSlow16 = fabsf(fSlow14);
float fSlow17 = ((0.5f * fSlow16) + 1.0f);
float fSlow18 = (fSlow17 * fSlow15);
float fSlow19 = ((fSlow17 * (fSlow15 * (fSlow18 + 0.125f))) + 1.0f);
float fSlow20 = ((faustpower<2>(fSlow17) * faustpower<2>(fSlow15)) + -1.0f);
float fSlow21 = ((fSlow17 * (fSlow15 * (fSlow18 + -0.125f))) + 1.0f);
float fSlow22 = (fSlow16 * fSlow17);
float fSlow23 = float(fslider3);
float fSlow24 = ((int((fSlow23 > 0.0f)))?fConst22:fConst20);
float fSlow25 = fabsf(fSlow23);
float fSlow26 = ((0.5f * fSlow25) + 1.0f);
float fSlow27 = (fSlow26 * fSlow24);
float fSlow28 = ((fSlow26 * (fSlow24 * (fSlow27 + 0.20000000000000001f))) + 1.0f);
float fSlow29 = ((faustpower<2>(fSlow26) * faustpower<2>(fSlow24)) + -1.0f);
float fSlow30 = ((fSlow26 * (fSlow24 * (fSlow27 + -0.20000000000000001f))) + 1.0f);
float fSlow31 = (0.20000000000000001f * (fSlow25 * fSlow26));
float fSlow32 = float(fslider4);
float fSlow33 = float(fslider5);
float fSlow34 = (fConst32 * fSlow33);
float fSlow35 = (fConst34 * fSlow33);
float fSlow36 = max((float(fslider6) + -0.02f), (float)0);
float fSlow37 = (fSlow36 / (fSlow36 + 0.5f));
float fSlow38 = ((0.20000000000000001f * float(fslider7)) + 0.01f);
float fSlow39 = (1.0f - (fConst43 * (fSlow8 / max(min((16.0f * fSlow33), (0.5f * (fSlow33 + 1.0f))), fSlow38))));
float fSlow40 = faustpower<2>(fSlow33);
float fSlow41 = float(fslider8);
float fSlow42 = max((8.1757989159999997f * fSlow9), (float)200);
float fSlow43 = float(fslider9);
float fSlow44 = fastpow2((0.083333333333333329f * fSlow43));
int iSlow45 = int(min((fConst13 / fSlow44), (float)4096));
float fSlow46 = float(iSlow45);
float fSlow47 = (fConst14 * (fSlow44 * fSlow46));
float fSlow48 = float(fslider10);
float fSlow49 = float(fslider11);
float fSlow50 = (fConst32 * fSlow49);
float fSlow51 = (fConst34 * fSlow49);
float fSlow52 = max((float(fslider12) + -0.02f), (float)0);
float fSlow53 = (fSlow52 / (fSlow52 + 0.5f));
float fSlow54 = (1.0f - (fConst43 * (fSlow43 / max(min((16.0f * fSlow49), (0.5f * (fSlow49 + 1.0f))), fSlow38))));
float fSlow55 = faustpower<2>(fSlow49);
float fSlow56 = max((8.1757989159999997f * fSlow44), (float)200);
float fSlow57 = float(fslider13);
float fSlow58 = fastpow2((0.083333333333333329f * fSlow57));
int iSlow59 = int(min((fConst13 / fSlow58), (float)4096));
float fSlow60 = float(iSlow59);
float fSlow61 = (fConst14 * (fSlow58 * fSlow60));
float fSlow62 = float(fslider14);
float fSlow63 = float(fslider15);
float fSlow64 = (fConst32 * fSlow63);
float fSlow65 = (fConst34 * fSlow63);
float fSlow66 = max((float(fslider16) + -0.02f), (float)0);
float fSlow67 = (fSlow66 / (fSlow66 + 0.5f));
float fSlow68 = (1.0f - (fConst43 * (fSlow57 / max(min((16.0f * fSlow63), (0.5f * (fSlow63 + 1.0f))), fSlow38))));
float fSlow69 = faustpower<2>(fSlow63);
float fSlow70 = max((8.1757989159999997f * fSlow58), (float)200);
float fSlow71 = float(fslider17);
float fSlow72 = fastpow2((0.083333333333333329f * fSlow71));
int iSlow73 = int(min((fConst13 / fSlow72), (float)4096));
float fSlow74 = float(iSlow73);
float fSlow75 = (fConst14 * (fSlow72 * fSlow74));
float fSlow76 = float(fslider18);
float fSlow77 = float(fslider19);
float fSlow78 = (fConst32 * fSlow77);
float fSlow79 = (fConst34 * fSlow77);
float fSlow80 = max((float(fslider20) + -0.02f), (float)0);
float fSlow81 = (fSlow80 / (fSlow80 + 0.5f));
float fSlow82 = (1.0f - (fConst43 * (fSlow71 / max(min((16.0f * fSlow77), (0.5f * (fSlow77 + 1.0f))), fSlow38))));
float fSlow83 = faustpower<2>(fSlow77);
float fSlow84 = max((8.1757989159999997f * fSlow72), (float)200);
float fSlow85 = float(fslider21);
float fSlow86 = fastpow2((0.083333333333333329f * fSlow85));
int iSlow87 = int(min((fConst13 / fSlow86), (float)4096));
float fSlow88 = float(iSlow87);
float fSlow89 = (fConst14 * (fSlow86 * fSlow88));
float fSlow90 = float(fslider22);
float fSlow91 = float(fslider23);
float fSlow92 = (fConst32 * fSlow91);
float fSlow93 = (fConst34 * fSlow91);
float fSlow94 = max((float(fslider24) + -0.02f), (float)0);
float fSlow95 = (fSlow94 / (fSlow94 + 0.5f));
float fSlow96 = (1.0f - (fConst43 * (fSlow85 / max(min((16.0f * fSlow91), (0.5f * (fSlow91 + 1.0f))), fSlow38))));
float fSlow97 = faustpower<2>(fSlow91);
float fSlow98 = max((8.1757989159999997f * fSlow86), (float)200);
float fSlow99 = float(fslider25);
float fSlow100 = fastpow2((0.083333333333333329f * fSlow99));
int iSlow101 = int(min((fConst13 / fSlow100), (float)4096));
float fSlow102 = float(iSlow101);
float fSlow103 = (fConst14 * (fSlow100 * fSlow102));
float fSlow104 = float(fslider26);
float fSlow105 = float(fslider27);
float fSlow106 = (fConst32 * fSlow105);
float fSlow107 = (fConst34 * fSlow105);
float fSlow108 = max((float(fslider28) + -0.02f), (float)0);
float fSlow109 = (fSlow108 / (fSlow108 + 0.5f));
float fSlow110 = (1.0f - (fConst43 * (fSlow99 / max(min((16.0f * fSlow105), (0.5f * (fSlow105 + 1.0f))), fSlow38))));
float fSlow111 = faustpower<2>(fSlow105);
float fSlow112 = max((8.1757989159999997f * fSlow100), (float)200);
//zone2b
//zone3
FAUSTFLOAT* output0 = output[0];
//LoopGraphScalar
for (int i=0; i<count; i++) {
fVec0[0] = fSlow8;
fRec2[0] = (fSlow12 + (fRec2[1] - float((iSlow10 * ((fSlow12 + fRec2[1]) > fSlow11)))));
int iTemp0 = int(fRec2[0]);
float fTemp1 = ftbl0[iTemp0];
float fTemp2 = (fTemp1 + ((fRec2[0] - float(iTemp0)) * (ftbl0[((iTemp0 + 1) % iSlow10)] - fTemp1)));
fRec1[0] = (fTemp2 - (((fSlow7 * fRec1[2]) + (2.0f * (fSlow6 * fRec1[1]))) / fSlow5));
fRec3[0] = (fTemp2 - (((fSlow21 * fRec3[2]) + (2.0f * (fSlow20 * fRec3[1]))) / fSlow19));
fRec4[0] = (fTemp2 - (((fSlow30 * fRec4[2]) + (2.0f * (fSlow29 * fRec4[1]))) / fSlow28));
fRec5[0] = (fSlow32 - (fConst30 * ((fConst28 * fRec5[2]) + (fConst26 * fRec5[1]))));
float fTemp3 = (((3947.8417604357433f * fRec5[0]) + (7895.6835208714865f * fRec5[1])) + (3947.8417604357433f * fRec5[2]));
float fTemp4 = (fConst31 * fTemp3);
float fTemp5 = max(fTemp4, (float)0);
float fTemp6 = tanf((fConst33 * ((fSlow34 * (fTemp3 * fTemp5)) + 200.0f)));
float fTemp7 = ((fTemp6 * (fTemp6 + 0.5f)) + 1.0f);
float fTemp8 = (fRec6[1] + (fTemp6 * (fTemp2 - fRec7[1])));
float fTemp9 = (fTemp8 / fTemp7);
fRec6[0] = ((2.0f * fTemp9) - fRec6[1]);
float fTemp10 = (fRec7[1] + ((fTemp6 * fTemp8) / fTemp7));
fRec7[0] = ((2.0f * fTemp10) - fRec7[1]);
float fRec8 = fTemp9;
float fTemp11 = max((-1 * fTemp4), (float)0);
fRec13[0] = (fSlow39 * (max(fRec13[1], fSlow37) * float((fabsf((fSlow8 - fVec0[1])) < 1.0f))));
fRec12[0] = (fSlow40 + (fRec13[0] - (fConst42 * ((fConst40 * fRec12[2]) + (fConst38 * fRec12[1])))));
float fTemp12 = (((98696.044010893587f * fRec12[0]) + (197392.08802178717f * fRec12[1])) + (98696.044010893587f * fRec12[2]));
fRec16[0] = (fSlow41 - (fConst55 * ((fConst53 * fRec16[2]) + (fConst48 * fRec16[1]))));
fRec15[0] = ((fConst56 * (((15791.367041742973f * fRec16[0]) + (31582.734083485946f * fRec16[1])) + (15791.367041742973f * fRec16[2]))) - (fConst52 * ((fConst50 * fRec15[2]) + (fConst48 * fRec15[1]))));
fRec14[0] = (fConst58 * max(fRec14[1], min((fConst57 * (((15791.367041742973f * fRec15[0]) + (31582.734083485946f * fRec15[1])) + (15791.367041742973f * fRec15[2]))), (float)2)));
float fTemp13 = max((fRec14[0] + -1.0f), (float)0);
float fTemp14 = tanf((fConst33 * min((fSlow42 * (faustpower<2>((fTemp13 + (fConst44 * (fTemp12 * (1.0f - fTemp11))))) + 1.0f)), (float)16000)));
float fTemp15 = ((fTemp14 * (fTemp14 + (1.0f / ((8.0f * fTemp11) + 1.0f)))) + 1.0f);
float fTemp16 = (fRec9[1] + (fTemp14 * (fTemp2 - fRec10[1])));
float fTemp17 = (fTemp16 / fTemp15);
fRec9[0] = ((2.0f * fTemp17) - fRec9[1]);
float fTemp18 = (fRec10[1] + ((fTemp14 * fTemp16) / fTemp15));
fRec10[0] = ((2.0f * fTemp18) - fRec10[1]);
float fRec11 = fTemp18;
fVec1[0] = fSlow43;
fRec18[0] = (fSlow47 + (fRec18[1] - float((iSlow45 * ((fSlow47 + fRec18[1]) > fSlow46)))));
int iTemp19 = int(fRec18[0]);
float fTemp20 = ftbl0[iTemp19];
float fTemp21 = (fTemp20 + ((fRec18[0] - float(iTemp19)) * (ftbl0[((iTemp19 + 1) % iSlow45)] - fTemp20)));
fRec17[0] = (fTemp21 - (((fSlow7 * fRec17[2]) + (2.0f * (fSlow6 * fRec17[1]))) / fSlow5));
fRec19[0] = (fTemp21 - (((fSlow21 * fRec19[2]) + (2.0f * (fSlow20 * fRec19[1]))) / fSlow19));
fRec20[0] = (fTemp21 - (((fSlow30 * fRec20[2]) + (2.0f * (fSlow29 * fRec20[1]))) / fSlow28));
fRec21[0] = (fSlow48 - (fConst30 * ((fConst28 * fRec21[2]) + (fConst26 * fRec21[1]))));
float fTemp22 = (((3947.8417604357433f * fRec21[0]) + (7895.6835208714865f * fRec21[1])) + (3947.8417604357433f * fRec21[2]));
float fTemp23 = (fConst31 * fTemp22);
float fTemp24 = max(fTemp23, (float)0);
float fTemp25 = tanf((fConst33 * ((fSlow50 * (fTemp22 * fTemp24)) + 200.0f)));
float fTemp26 = ((fTemp25 * (fTemp25 + 0.5f)) + 1.0f);
float fTemp27 = (fRec22[1] + (fTemp25 * (fTemp21 - fRec23[1])));
float fTemp28 = (fTemp27 / fTemp26);
fRec22[0] = ((2.0f * fTemp28) - fRec22[1]);
float fTemp29 = (fRec23[1] + ((fTemp25 * fTemp27) / fTemp26));
fRec23[0] = ((2.0f * fTemp29) - fRec23[1]);
float fRec24 = fTemp28;
float fTemp30 = max((-1 * fTemp23), (float)0);
fRec29[0] = (fSlow54 * (max(fRec29[1], fSlow53) * float((fabsf((fSlow43 - fVec1[1])) < 1.0f))));
fRec28[0] = (fSlow55 + (fRec29[0] - (fConst42 * ((fConst40 * fRec28[2]) + (fConst38 * fRec28[1])))));
float fTemp31 = (((98696.044010893587f * fRec28[0]) + (197392.08802178717f * fRec28[1])) + (98696.044010893587f * fRec28[2]));
float fTemp32 = tanf((fConst33 * min((fSlow56 * (faustpower<2>((fTemp13 + (fConst44 * (fTemp31 * (1.0f - fTemp30))))) + 1.0f)), (float)16000)));
float fTemp33 = ((fTemp32 * (fTemp32 + (1.0f / ((8.0f * fTemp30) + 1.0f)))) + 1.0f);
float fTemp34 = (fRec25[1] + (fTemp32 * (fTemp21 - fRec26[1])));
float fTemp35 = (fTemp34 / fTemp33);
fRec25[0] = ((2.0f * fTemp35) - fRec25[1]);
float fTemp36 = (fRec26[1] + ((fTemp32 * fTemp34) / fTemp33));
fRec26[0] = ((2.0f * fTemp36) - fRec26[1]);
float fRec27 = fTemp36;
fVec2[0] = fSlow57;
fRec31[0] = (fSlow61 + (fRec31[1] - float((iSlow59 * ((fSlow61 + fRec31[1]) > fSlow60)))));
int iTemp37 = int(fRec31[0]);
float fTemp38 = ftbl0[iTemp37];
float fTemp39 = (fTemp38 + ((fRec31[0] - float(iTemp37)) * (ftbl0[((iTemp37 + 1) % iSlow59)] - fTemp38)));
fRec30[0] = (fTemp39 - (((fSlow7 * fRec30[2]) + (2.0f * (fSlow6 * fRec30[1]))) / fSlow5));
fRec32[0] = (fTemp39 - (((fSlow21 * fRec32[2]) + (2.0f * (fSlow20 * fRec32[1]))) / fSlow19));
fRec33[0] = (fTemp39 - (((fSlow30 * fRec33[2]) + (2.0f * (fSlow29 * fRec33[1]))) / fSlow28));
fRec34[0] = (fSlow62 - (fConst30 * ((fConst28 * fRec34[2]) + (fConst26 * fRec34[1]))));
float fTemp40 = (((3947.8417604357433f * fRec34[0]) + (7895.6835208714865f * fRec34[1])) + (3947.8417604357433f * fRec34[2]));
float fTemp41 = (fConst31 * fTemp40);
float fTemp42 = max(fTemp41, (float)0);
float fTemp43 = tanf((fConst33 * ((fSlow64 * (fTemp40 * fTemp42)) + 200.0f)));
float fTemp44 = ((fTemp43 * (fTemp43 + 0.5f)) + 1.0f);
float fTemp45 = (fRec35[1] + (fTemp43 * (fTemp39 - fRec36[1])));
float fTemp46 = (fTemp45 / fTemp44);
fRec35[0] = ((2.0f * fTemp46) - fRec35[1]);
float fTemp47 = (fRec36[1] + ((fTemp43 * fTemp45) / fTemp44));
fRec36[0] = ((2.0f * fTemp47) - fRec36[1]);
float fRec37 = fTemp46;
float fTemp48 = max((-1 * fTemp41), (float)0);
fRec42[0] = (fSlow68 * (max(fRec42[1], fSlow67) * float((fabsf((fSlow57 - fVec2[1])) < 1.0f))));
fRec41[0] = (fSlow69 + (fRec42[0] - (fConst42 * ((fConst40 * fRec41[2]) + (fConst38 * fRec41[1])))));
float fTemp49 = (((98696.044010893587f * fRec41[0]) + (197392.08802178717f * fRec41[1])) + (98696.044010893587f * fRec41[2]));
float fTemp50 = tanf((fConst33 * min((fSlow70 * (faustpower<2>((fTemp13 + (fConst44 * (fTemp49 * (1.0f - fTemp48))))) + 1.0f)), (float)16000)));
float fTemp51 = ((fTemp50 * (fTemp50 + (1.0f / ((8.0f * fTemp48) + 1.0f)))) + 1.0f);
float fTemp52 = (fRec38[1] + (fTemp50 * (fTemp39 - fRec39[1])));
float fTemp53 = (fTemp52 / fTemp51);
fRec38[0] = ((2.0f * fTemp53) - fRec38[1]);
float fTemp54 = (fRec39[1] + ((fTemp50 * fTemp52) / fTemp51));
fRec39[0] = ((2.0f * fTemp54) - fRec39[1]);
float fRec40 = fTemp54;
fVec3[0] = fSlow71;
fRec44[0] = (fSlow75 + (fRec44[1] - float((iSlow73 * ((fSlow75 + fRec44[1]) > fSlow74)))));
int iTemp55 = int(fRec44[0]);
float fTemp56 = ftbl0[iTemp55];
float fTemp57 = (fTemp56 + ((fRec44[0] - float(iTemp55)) * (ftbl0[((iTemp55 + 1) % iSlow73)] - fTemp56)));
fRec43[0] = (fTemp57 - (((fSlow7 * fRec43[2]) + (2.0f * (fSlow6 * fRec43[1]))) / fSlow5));
fRec45[0] = (fTemp57 - (((fSlow21 * fRec45[2]) + (2.0f * (fSlow20 * fRec45[1]))) / fSlow19));
fRec46[0] = (fTemp57 - (((fSlow30 * fRec46[2]) + (2.0f * (fSlow29 * fRec46[1]))) / fSlow28));
fRec47[0] = (fSlow76 - (fConst30 * ((fConst28 * fRec47[2]) + (fConst26 * fRec47[1]))));
float fTemp58 = (((3947.8417604357433f * fRec47[0]) + (7895.6835208714865f * fRec47[1])) + (3947.8417604357433f * fRec47[2]));
float fTemp59 = (fConst31 * fTemp58);
float fTemp60 = max(fTemp59, (float)0);
float fTemp61 = tanf((fConst33 * ((fSlow78 * (fTemp58 * fTemp60)) + 200.0f)));
float fTemp62 = ((fTemp61 * (fTemp61 + 0.5f)) + 1.0f);
float fTemp63 = (fRec48[1] + (fTemp61 * (fTemp57 - fRec49[1])));
float fTemp64 = (fTemp63 / fTemp62);
fRec48[0] = ((2.0f * fTemp64) - fRec48[1]);
float fTemp65 = (fRec49[1] + ((fTemp61 * fTemp63) / fTemp62));
fRec49[0] = ((2.0f * fTemp65) - fRec49[1]);
float fRec50 = fTemp64;
float fTemp66 = max((-1 * fTemp59), (float)0);
fRec55[0] = (fSlow82 * (max(fRec55[1], fSlow81) * float((fabsf((fSlow71 - fVec3[1])) < 1.0f))));
fRec54[0] = (fSlow83 + (fRec55[0] - (fConst42 * ((fConst40 * fRec54[2]) + (fConst38 * fRec54[1])))));
float fTemp67 = (((98696.044010893587f * fRec54[0]) + (197392.08802178717f * fRec54[1])) + (98696.044010893587f * fRec54[2]));
float fTemp68 = tanf((fConst33 * min((fSlow84 * (faustpower<2>((fTemp13 + (fConst44 * (fTemp67 * (1.0f - fTemp66))))) + 1.0f)), (float)16000)));
float fTemp69 = ((fTemp68 * (fTemp68 + (1.0f / ((8.0f * fTemp66) + 1.0f)))) + 1.0f);
float fTemp70 = (fRec51[1] + (fTemp68 * (fTemp57 - fRec52[1])));
float fTemp71 = (fTemp70 / fTemp69);
fRec51[0] = ((2.0f * fTemp71) - fRec51[1]);
float fTemp72 = (fRec52[1] + ((fTemp68 * fTemp70) / fTemp69));
fRec52[0] = ((2.0f * fTemp72) - fRec52[1]);
float fRec53 = fTemp72;
fVec4[0] = fSlow85;
fRec57[0] = (fSlow89 + (fRec57[1] - float((iSlow87 * ((fSlow89 + fRec57[1]) > fSlow88)))));
int iTemp73 = int(fRec57[0]);
float fTemp74 = ftbl0[iTemp73];
float fTemp75 = (fTemp74 + ((fRec57[0] - float(iTemp73)) * (ftbl0[((iTemp73 + 1) % iSlow87)] - fTemp74)));
fRec56[0] = (fTemp75 - (((fSlow7 * fRec56[2]) + (2.0f * (fSlow6 * fRec56[1]))) / fSlow5));
fRec58[0] = (fTemp75 - (((fSlow21 * fRec58[2]) + (2.0f * (fSlow20 * fRec58[1]))) / fSlow19));
fRec59[0] = (fTemp75 - (((fSlow30 * fRec59[2]) + (2.0f * (fSlow29 * fRec59[1]))) / fSlow28));
fRec60[0] = (fSlow90 - (fConst30 * ((fConst28 * fRec60[2]) + (fConst26 * fRec60[1]))));
float fTemp76 = (((3947.8417604357433f * fRec60[0]) + (7895.6835208714865f * fRec60[1])) + (3947.8417604357433f * fRec60[2]));
float fTemp77 = (fConst31 * fTemp76);
float fTemp78 = max(fTemp77, (float)0);
float fTemp79 = tanf((fConst33 * ((fSlow92 * (fTemp76 * fTemp78)) + 200.0f)));
float fTemp80 = ((fTemp79 * (fTemp79 + 0.5f)) + 1.0f);
float fTemp81 = (fRec61[1] + (fTemp79 * (fTemp75 - fRec62[1])));
float fTemp82 = (fTemp81 / fTemp80);
fRec61[0] = ((2.0f * fTemp82) - fRec61[1]);
float fTemp83 = (fRec62[1] + ((fTemp79 * fTemp81) / fTemp80));
fRec62[0] = ((2.0f * fTemp83) - fRec62[1]);
float fRec63 = fTemp82;
float fTemp84 = max((-1 * fTemp77), (float)0);
fRec68[0] = (fSlow96 * (max(fRec68[1], fSlow95) * float((fabsf((fSlow85 - fVec4[1])) < 1.0f))));
fRec67[0] = (fSlow97 + (fRec68[0] - (fConst42 * ((fConst40 * fRec67[2]) + (fConst38 * fRec67[1])))));
float fTemp85 = (((98696.044010893587f * fRec67[0]) + (197392.08802178717f * fRec67[1])) + (98696.044010893587f * fRec67[2]));
float fTemp86 = tanf((fConst33 * min((fSlow98 * (faustpower<2>((fTemp13 + (fConst44 * (fTemp85 * (1.0f - fTemp84))))) + 1.0f)), (float)16000)));
float fTemp87 = ((fTemp86 * (fTemp86 + (1.0f / ((8.0f * fTemp84) + 1.0f)))) + 1.0f);
float fTemp88 = (fRec64[1] + (fTemp86 * (fTemp75 - fRec65[1])));
float fTemp89 = (fTemp88 / fTemp87);
fRec64[0] = ((2.0f * fTemp89) - fRec64[1]);
float fTemp90 = (fRec65[1] + ((fTemp86 * fTemp88) / fTemp87));
fRec65[0] = ((2.0f * fTemp90) - fRec65[1]);
float fRec66 = fTemp90;
fVec5[0] = fSlow99;
fRec70[0] = (fSlow103 + (fRec70[1] - float((iSlow101 * ((fSlow103 + fRec70[1]) > fSlow102)))));
int iTemp91 = int(fRec70[0]);
float fTemp92 = ftbl0[iTemp91];
float fTemp93 = (fTemp92 + ((fRec70[0] - float(iTemp91)) * (ftbl0[((iTemp91 + 1) % iSlow101)] - fTemp92)));
fRec69[0] = (fTemp93 - (((fSlow7 * fRec69[2]) + (2.0f * (fSlow6 * fRec69[1]))) / fSlow5));
fRec71[0] = (fTemp93 - (((fSlow21 * fRec71[2]) + (2.0f * (fSlow20 * fRec71[1]))) / fSlow19));
fRec72[0] = (fTemp93 - (((fSlow30 * fRec72[2]) + (2.0f * (fSlow29 * fRec72[1]))) / fSlow28));
fRec73[0] = (fSlow104 - (fConst30 * ((fConst28 * fRec73[2]) + (fConst26 * fRec73[1]))));
float fTemp94 = (((3947.8417604357433f * fRec73[0]) + (7895.6835208714865f * fRec73[1])) + (3947.8417604357433f * fRec73[2]));
float fTemp95 = (fConst31 * fTemp94);
float fTemp96 = max(fTemp95, (float)0);
float fTemp97 = tanf((fConst33 * ((fSlow106 * (fTemp94 * fTemp96)) + 200.0f)));
float fTemp98 = ((fTemp97 * (fTemp97 + 0.5f)) + 1.0f);
float fTemp99 = (fRec74[1] + (fTemp97 * (fTemp93 - fRec75[1])));
float fTemp100 = (fTemp99 / fTemp98);
fRec74[0] = ((2.0f * fTemp100) - fRec74[1]);
float fTemp101 = (fRec75[1] + ((fTemp97 * fTemp99) / fTemp98));
fRec75[0] = ((2.0f * fTemp101) - fRec75[1]);
float fRec76 = fTemp100;
float fTemp102 = max((-1 * fTemp95), (float)0);
fRec81[0] = (fSlow110 * (max(fRec81[1], fSlow109) * float((fabsf((fSlow99 - fVec5[1])) < 1.0f))));
fRec80[0] = (fSlow111 + (fRec81[0] - (fConst42 * ((fConst40 * fRec80[2]) + (fConst38 * fRec80[1])))));
float fTemp103 = (((98696.044010893587f * fRec80[0]) + (197392.08802178717f * fRec80[1])) + (98696.044010893587f * fRec80[2]));
float fTemp104 = tanf((fConst33 * min((fSlow112 * (faustpower<2>(((fConst44 * (fTemp103 * (1.0f - fTemp102))) + fTemp13)) + 1.0f)), (float)16000)));
float fTemp105 = ((fTemp104 * (fTemp104 + (1.0f / ((8.0f * fTemp102) + 1.0f)))) + 1.0f);
float fTemp106 = (fRec77[1] + (fTemp104 * (fTemp93 - fRec78[1])));
float fTemp107 = (fTemp106 / fTemp105);
fRec77[0] = ((2.0f * fTemp107) - fRec77[1]);
float fTemp108 = (fRec78[1] + ((fTemp104 * fTemp106) / fTemp105));
fRec78[0] = ((2.0f * fTemp108) - fRec78[1]);
float fRec79 = fTemp108;
fRec0[0] = ((fConst59 * ((((((fTemp103 * (((fRec79 * faustpower<2>((1.0f - (0.5f * fTemp102)))) + (fSlow107 * ((fRec76 * fTemp94) * fTemp96))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec72[0] - fRec72[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec71[0] - fRec71[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec69[0] - fRec69[2])) / fSlow5)))))))) + (fTemp85 * (((fRec66 * faustpower<2>((1.0f - (0.5f * fTemp84)))) + (fSlow93 * ((fRec63 * fTemp76) * fTemp78))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec59[0] - fRec59[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec58[0] - fRec58[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec56[0] - fRec56[2])) / fSlow5))))))))) + (fTemp67 * (((fRec53 * faustpower<2>((1.0f - (0.5f * fTemp66)))) + (fSlow79 * ((fRec50 * fTemp58) * fTemp60))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec46[0] - fRec46[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec45[0] - fRec45[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec43[0] - fRec43[2])) / fSlow5))))))))) + (fTemp49 * (((fRec40 * faustpower<2>((1.0f - (0.5f * fTemp48)))) + (fSlow65 * ((fRec37 * fTemp40) * fTemp42))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec33[0] - fRec33[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec32[0] - fRec32[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec30[0] - fRec30[2])) / fSlow5))))))))) + (fTemp31 * (((fRec27 * faustpower<2>((1.0f - (0.5f * fTemp30)))) + (fSlow51 * ((fRec24 * fTemp22) * fTemp24))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec20[0] - fRec20[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec19[0] - fRec19[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec17[0] - fRec17[2])) / fSlow5))))))))) + (fTemp12 * (((fRec11 * faustpower<2>((1.0f - (0.5f * fTemp11)))) + (fSlow35 * ((fRec8 * fTemp3) * fTemp5))) + (6.0f * ((fSlow31 * ((fSlow24 * (fRec4[0] - fRec4[2])) / fSlow28)) + (0.125f * ((fSlow22 * ((fSlow15 * (fRec3[0] - fRec3[2])) / fSlow19)) + (fSlow13 * ((fSlow1 * (fRec1[0] - fRec1[2])) / fSlow5)))))))))) - (fConst8 * ((fConst6 * fRec0[2]) + (fConst4 * fRec0[1]))));
output0[i] = (FAUSTFLOAT)((fConst60 * fRec0[1]) + (fConst8 * (fRec0[0] + fRec0[2])));
// post processing
fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
fRec78[1] = fRec78[0];
fRec77[1] = fRec77[0];
fRec80[2] = fRec80[1]; fRec80[1] = fRec80[0];
fRec81[1] = fRec81[0];
fRec75[1] = fRec75[0];
fRec74[1] = fRec74[0];
fRec73[2] = fRec73[1]; fRec73[1] = fRec73[0];
fRec72[2] = fRec72[1]; fRec72[1] = fRec72[0];
fRec71[2] = fRec71[1]; fRec71[1] = fRec71[0];
fRec69[2] = fRec69[1]; fRec69[1] = fRec69[0];
fRec70[1] = fRec70[0];
fVec5[1] = fVec5[0];
fRec65[1] = fRec65[0];
fRec64[1] = fRec64[0];
fRec67[2] = fRec67[1]; fRec67[1] = fRec67[0];
fRec68[1] = fRec68[0];
fRec62[1] = fRec62[0];
fRec61[1] = fRec61[0];
fRec60[2] = fRec60[1]; fRec60[1] = fRec60[0];
fRec59[2] = fRec59[1]; fRec59[1] = fRec59[0];
fRec58[2] = fRec58[1]; fRec58[1] = fRec58[0];
fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
fRec57[1] = fRec57[0];
fVec4[1] = fVec4[0];
fRec52[1] = fRec52[0];
fRec51[1] = fRec51[0];
fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
fRec55[1] = fRec55[0];
fRec49[1] = fRec49[0];
fRec48[1] = fRec48[0];
fRec47[2] = fRec47[1]; fRec47[1] = fRec47[0];
fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
fRec43[2] = fRec43[1]; fRec43[1] = fRec43[0];
fRec44[1] = fRec44[0];
fVec3[1] = fVec3[0];
fRec39[1] = fRec39[0];
fRec38[1] = fRec38[0];
fRec41[2] = fRec41[1]; fRec41[1] = fRec41[0];
fRec42[1] = fRec42[0];
fRec36[1] = fRec36[0];
fRec35[1] = fRec35[0];
fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
fRec32[2] = fRec32[1]; fRec32[1] = fRec32[0];
fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
fRec31[1] = fRec31[0];
fVec2[1] = fVec2[0];
fRec26[1] = fRec26[0];
fRec25[1] = fRec25[0];
fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
fRec29[1] = fRec29[0];
fRec23[1] = fRec23[0];
fRec22[1] = fRec22[0];
fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
fRec18[1] = fRec18[0];
fVec1[1] = fVec1[0];
fRec10[1] = fRec10[0];
fRec9[1] = fRec9[0];
fRec14[1] = fRec14[0];
fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
fRec13[1] = fRec13[0];
fRec7[1] = fRec7[0];
fRec6[1] = fRec6[0];
fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
fRec2[1] = fRec2[0];
fVec0[1] = fVec0[0];
}
}
};
float mydsp::ftbl0[4096];
FAUSTCLASS dsp;
static THD_WORKING_AREA(waSynthThread, 1024);
static thread_t* pThreadDSP = 0;
static void synthThread(void *arg) { // THE SYNTH THREAD
(void)arg;
chRegSetThreadName("SYNTH");
int32_t tmp;
int count = CHANNEL_BUFFER_SIZE;
float volume_filtered = 0.0f;
//codec_pwrCtl(1); // POWER ON
//codec_muteCtl(0); // MUTE OFF
chEvtAddEvents(1);
// initialize interface with dump, for when controls are not used
synth_interface.acc_abs = &dump;
synth_interface.acc_x = &dump;
synth_interface.acc_y = &dump;
synth_interface.acc_z = &dump;
synth_interface.rot_x = &dump;
synth_interface.rot_y = &dump;
synth_interface.rot_z = &dump;
synth_interface.pedal = &dump;
// initialization
dsp.init(SAMPLINGFREQ);
// initialize interface
dsp.buildUserInterfaceEmbedded();
// computation loop
while (true) {
// palClearLine(LINE_LED_ALT);
chEvtWaitOne(1);
// palSetLine(LINE_LED_ALT);
dsp.compute(count, NULL, output);
volume_filtered = VOLUME_FILTER * volume_filtered + (1 - VOLUME_FILTER) * volume;
// convert float to int with scale, clamp and round
for (int n = 0; n < CHANNEL_BUFFER_SIZE; n++) {
tmp = (int32_t)(output0[n] * volume_filtered * MAX_VAL);
// enable LED on clip
if (tmp <= -MAX_VAL) {
tmp = -(MAX_VAL-1);
} else if (tmp >= MAX_VAL) {
tmp = MAX_VAL-1;
}
// make both audio channels the same
outbuf[2*n] = outbuf[2*n+1] = tmp * (1<<8);
}
//if (--n <= 0) {
// palToggleLine(LINE_LED1); /* Orange. */
// n = 100;
//}
// TODO: synth_tick better called here or in main?
// synth_tick();
if (chThdShouldTerminateX()) break;
}
//codec_muteCtl(1);
//codec_pwrCtl(0);
pThreadDSP=NULL;
palToggleLine(LINE_LED1);
};
void start_synth_thread(void) {
pThreadDSP = chThdCreateStatic(waSynthThread, sizeof(waSynthThread), NORMALPRIO+2, synthThread, NULL);
}
void computebufI(int32_t *inp, int32_t *outp) {
int i;
//for (i = 0; i < 32; i++) {
// inbuf[i] = inp[i];
//}
outbuf = outp;
inbuf = inp;
if (pThreadDSP) {
chSysLockFromISR();
chEvtSignalI(pThreadDSP, (eventmask_t)1);
chSysUnlockFromISR();
}
else
for (i = 0; i < PLAYBACK_BUFFER_SIZE; i++) {
outp[i] = (i - PLAYBACK_BUFFER_SIZE / 2) * 1<<22;
// square wave 34952 * (1<<8) * 2 * ((i>PLAYBACK_BUFFER_SIZE/2)-0.5);
// saw ware (i - PLAYBACK_BUFFER_SIZE / 2) * 100000; // testing noise 0;
}
}