forked from monome/aleph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prgm.c
executable file
·1559 lines (1323 loc) · 37.8 KB
/
prgm.c
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
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//prgm.c, aleph-bfin
#include "prgm.h"
// data types
typedef struct _prgmData {
ModuleData super;
ParamData mParamData[eParamNumParams];
//audio buffer
volatile fract32 sampleBuffer[BUFFER_SIZE];
} prgmData;
ModuleData *gModuleData;
// pointer to SDRAM (all external memory)
prgmData *data;
// samples|buffers
sampleBuffer onchipbuffer[N_CHN];
s32 samples[32];
u32 offset;
// sequencer
s32 pp[N_CHN]; // step ping pong buffer
// cv|trig
fract32 cv[N_CHN+1]; // cv outputs (6 cv channels, 1 cv aux)
fract32 trig = 0; // trig bus
// channels
prgmChn *chn[N_CHN]; // mix channels
// virtual outputs
fract32 vout[N_CHN] = { 0, 0, 0, 0, 0, 0 };
// aux
fract32 aux = 0;
// master
prgmMaster *master; // master section
// function declarations
// memory allocation
static void init_channel_parameters(prgmChn *c, u8 n);
static void init_master_parameters(void);
//set head offsets
static void set_start(prgmChn *c, u32 offset);
static void set_loop(prgmChn *c, u32 offset);
// inputs
static fract32 (*set_input(u8 n))();
static fract32 in_noinput(void);
static fract32 in_in0(void);
static fract32 in_in1(void);
static fract32 in_vout0(void);
static fract32 in_vrev0(void);
static fract32 in_vpad0(void);
static fract32 in_vout1(void);
static fract32 in_vrev1(void);
static fract32 in_vpad1(void);
static fract32 in_vout2(void);
static fract32 in_vrev2(void);
static fract32 in_vpad2(void);
static fract32 in_vout3(void);
static fract32 in_vrev3(void);
static fract32 in_vpad3(void);
static fract32 in_vout4(void);
static fract32 in_vrev4(void);
static fract32 in_vpad4(void);
static fract32 in_vout5(void);
static fract32 in_vrev5(void);
static fract32 in_vpad5(void);
static fract32 in_aux(void);
static fract32 in_arev(void);
// cv
static fract32 (*set_cvprocess(u8 n))();
static fract32 cv_off(prgmChn *c);
static fract32 cv_imp(prgmChn *c);
static fract32 cv_lin(prgmChn *c);
static fract32 cv_pre(prgmChn *c);
static fract32 cv_bpf(prgmChn *c);
static fract32 cv_dly(prgmChn *c);
static fract32 cv_lfo(prgmChn *c);
static fract32 cv_env(prgmChn *c);
static fract32 cv_gate(prgmChn *c);
static fract32 cv_rpt(prgmChn *c);
// audio
static fract32 (*set_process(u8 n))();
static fract32 pf_off(prgmChn *c);
static fract32 pf_imp(prgmChn *c);
static fract32 pf_lin(prgmChn *c);
static fract32 pf_tape(prgmChn *c);
static fract32 pf_deck(prgmChn *c);
static fract32 pf_pre(prgmChn *c);
static fract32 pf_bpf(prgmChn *c);
static fract32 pf_dly(prgmChn *c);
static fract32 pf_rpt(prgmChn *c);
static fract32 pf_mute(prgmChn *c);
static fract32 pf_holdmute(prgmChn *c);
static fract32 pf_unmute(prgmChn *c);
// outputs
static fract32 (*set_output(u8 n))();
static fract32 out_off(void);
static fract32 out_vout0(void);
static fract32 out_vout1(void);
static fract32 out_vout2(void);
static fract32 out_vout3(void);
static fract32 out_vout4(void);
static fract32 out_vout5(void);
static fract32 out_aux(void);
static void route_mix(s32 t, s32 r);
//MDMA DEBUG
void bfin_debug (u8 reg)
{
switch (reg)
{
case 0:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DMAEN;
break;
case 1:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & WDSIZE_8;
break;
case 2:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & WDSIZE_16;
break;
case 3:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & WDSIZE_32;
break;
case 4:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DMA2D;
break;
case 5:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DI_SEL;
break;
case 6:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DI_EN;
break;
case 7:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & NDSIZE;
break;
case 8:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & FLOW_STOP;
break;
case 9:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & FLOW_AUTO;
break;
case 10:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & FLOW_ARRAY;
break;
case 11:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & FLOW_SMALL;
break;
case 12:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & FLOW_LARGE;
break;
case 13:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DMA_DONE;
break;
case 14:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DMA_ERR;
break;
case 15:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DFETCH;
break;
case 16:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CONFIG & DMA_RUN;
break;
case 17:
gModuleData->paramData[eParamDebug].value = MDMA_S0_NEXT_DESC_PTR;
break;
case 18:
gModuleData->paramData[eParamDebug].value = MDMA_S0_START_ADDR;
break;
case 19:
gModuleData->paramData[eParamDebug].value = MDMA_S0_X_COUNT;
break;
case 20:
gModuleData->paramData[eParamDebug].value = MDMA_S0_Y_COUNT;
break;
case 21:
gModuleData->paramData[eParamDebug].value = MDMA_S0_X_MODIFY;
break;
case 22:
gModuleData->paramData[eParamDebug].value = MDMA_S0_Y_MODIFY;
break;
case 23:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CURR_DESC_PTR;
break;
case 24:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CURR_ADDR;
break;
case 25:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CURR_X_COUNT;
break;
case 26:
gModuleData->paramData[eParamDebug].value = MDMA_S0_CURR_Y_COUNT;
break;
case 27:
gModuleData->paramData[eParamDebug].value = MDMA_S0_IRQ_STATUS;
break;
case 28:
gModuleData->paramData[eParamDebug].value = MDMA_S0_PERIPHERAL_MAP;
break;
default:
break;
}
}
//function definitions
void init_channel_parameters(prgmChn *c, u8 n) {
c->input = set_input(0);
c->cvprocess = set_cvprocess(0);
c->cvframe = 0;
// buffers are initialised in module_init!
c->loop = 0;
c->x = 0;
c->y = 0;
c->c0 = 0;
c->c1 = 0;
c->c2 = 0;
c->c3 = 0;
c->trig = 0;
c->retrig = 0;
c->send_retrig = 0;
c->flag = 0;
c->process = set_process(0);
c->a = 0;
c->amod = n;
c->amodl = 0;
c->b = 0;
c->c = 0;
c->d = 0;
c->aux = 0;
c->auxmod = n;
c->auxmodl = 0;
c->auxcv = 0;
c->snd = FR32_MAX;
c->sndmod = n;
c->sndmodl = 0;
c->to_mix = 1;
c->to_grp1 = 0;
c->to_grp2 = 0;
c->deck_input = 0;
c->mute = 0;
c->auxmute = 0;
c->hold = 0;
c->tmp = 0;
filter_1p_lo_init(&(c->pSlew), 0xf);
filter_1p_lo_set_slew(&(c->pSlew), 0x5f000000); //parameter slew
filter_1p_lo_init(&(c->auxSlew), 0xf);
filter_1p_lo_set_slew(&(c->auxSlew), 0x7f000000); //aux slew
filter_1p_lo_init(&(c->sndSlew), 0xf);
filter_1p_lo_set_slew(&(c->sndSlew), 0x7f000000); //send slew
}
void init_master_parameters() {
master->output3 = set_output(0);
master->output4 = set_output(0);
master->direct = FR32_MAX;
master->grp1 = FR32_MAX;
master->grp2 = FR32_MAX;
master->output = FR32_MAX;
}
// inputs
fract32 (*set_input(u8 n))() {
static fract32 (*inputs[])() =
{
in_noinput,
in_aux,
in_arev,
in_in0,
in_in1,
in_vout0,
in_vrev0,
in_vpad0,
in_vout1,
in_vrev1,
in_vpad1,
in_vout2,
in_vrev2,
in_vpad2,
in_vout3,
in_vrev3,
in_vpad3,
in_vout4,
in_vrev4,
in_vpad4,
in_vout5,
in_vrev5,
in_vpad5,
};
return (n < 1 || n > N_INPUTS) ? *inputs[0] : *inputs[n];
}
// cv processes
static fract32 (*set_cvprocess(u8 n))() {
static fract32 (*process[])() =
{
cv_off, //0
cv_imp, //1
cv_lin, //2
cv_off, //3 tape
cv_off, //4 deck
cv_pre, //5
cv_bpf, //6
cv_dly, //7
cv_lfo, //8
cv_env, //9
cv_gate, //10
cv_rpt, //11
cv_off, //12 mute
cv_off, //13 holdmute
cv_off, //14 unmute
};
return (n < 1 || n > 15) ? *process[0] : *process[n];
}
// audio processes
fract32 (*set_process(u8 n))() {
static fract32 (*process[])() =
{
pf_off, //0
pf_imp, //1
pf_lin, //2
pf_tape, //3
pf_deck, //4
pf_pre, //5
pf_bpf, //6
pf_dly, //7
pf_off, //8 lfo
pf_off, //9 env
pf_off, //10 gate
pf_rpt, //11
pf_mute, //12
pf_holdmute, //13
pf_unmute, //14
};
return (n < 1 || n > 15) ? *process[0] : *process[n];
}
// direct outs
fract32 (*set_output(u8 n))() {
static fract32 (*outputs[])() =
{
out_off,
out_vout0,
out_vout1,
out_vout2,
out_vout3,
out_vout4,
out_vout5,
out_aux,
};
return (n < 1 || n > N_DIROUTS) ? *outputs[0] : *outputs[n];
}
static inline void param_setup(u32 id, ParamValue v) {
gModuleData->paramData[id].value = v;
// module_set_param(id, v);
}
void module_load_sample(s32 sample) {
}
void module_init(void) {
data = (prgmData*)SDRAM_ADDRESS;
gModuleData = &(data->super);
strcpy(gModuleData->name, "aleph-prgm");
gModuleData->paramData = data->mParamData;
gModuleData->numParams = eParamNumParams;
u32 i, n;
// init channels
for(n=0; n<N_CHN; n++)
{
chn[n] = (PrgmChnptr)malloc(sizeof(prgmChn));
init_channel_parameters(chn[n], n);
}
// init master
master = (PrgmMasterptr)malloc(sizeof(prgmMaster));
init_master_parameters();
// init channel buffers
for(n=0; n<N_CHN; n++)
{
buffer_init(&(onchipbuffer[n]), data->sampleBuffer, BUFFER_SIZE);
}
// init channel playheads
for(n=0; n<N_CHN; n++)
{
for (i=0; i<N_HEADS; i++)
{
buffer_head_init(&(chn[n])->head[i], &(onchipbuffer[n]));
}
}
// zero sample buffer
for(i=0; i<BUFFER_SIZE; i++)
{
data->sampleBuffer[i] = 0x00000000;
}
for(n=0; n<32; n++)
{
samples[n] = 0;
}
// init static variables
offset = 0;
trig = 0;
for(n=0; n<N_CHN+1; n++)
{
cv[n] = 0x00000000;
}
// init parameters
for(i=0; i<module_get_num_params(); i++) param_setup(i, 0);
}
void module_deinit(void) {}
extern u32 module_get_num_params(void) {
return eParamNumParams;
}
// process frame
void module_process_frame(void) {
u8 i;
fract32 cvtmp, tmp, mod, a, b;
cvtmp = tmp = mod = 0x00000000;
// cv | auxcv
for(i=0;i<N_CHN;i++)
{
if(!chn[i]->flag)
{
cv[i] = 0x00000000;
}
else
{
// cv outputs
cv[i] = chn[i]->cvprocess(chn[i]);
// mix aux
// w aux modulation
if (chn[i]->auxmodl != 0)
{
mod = add_fr1x32(chn[i]->aux, mult_fr1x32x32(cv[chn[i]->auxmod], chn[i]->auxmodl));
if (mod < 0) mod = 0;
// aux
tmp = add_fr1x32(tmp, mult_fr1x32x32(vout[i], mod));
// auxcv
cvtmp = add_fr1x32(cvtmp, mult_fr1x32x32(cv[i], chn[i]->auxcv));
}
// w/o aux modulation
else
{
// aux
tmp = add_fr1x32(tmp, mult_fr1x32x32(vout[i], chn[i]->aux));
// auxcv
cvtmp = add_fr1x32(cvtmp, mult_fr1x32x32(cv[i], chn[i]->auxcv));
}
}
}
aux = tmp;
cv[6] = cvtmp;
// process audio
a = b = tmp = mod = 0x00000000;
for(i=0;i<N_CHN;i++)
{
fract32 v = 0x00000000;
// skip inactive channels
if(!chn[i]->flag)
{
vout[i] = 0x00000000;
}
else
{
// calculate active channels
vout[i] = 0x00000000;
v = vout[i] = chn[i]->process(chn[i]);
}
// mix
if(chn[i]->to_mix)
{
if (chn[i]->sndmodl != 0)
{
mod = add_fr1x32(chn[i]->snd, mult_fr1x32x32(cv[chn[i]->sndmod], chn[i]->sndmodl));
if (mod < 0) mod = 0;
tmp = add_fr1x32(tmp, mult_fr1x32x32(v, mod));
}
else tmp = add_fr1x32(tmp, mult_fr1x32x32(v, chn[i]->snd));
}
// group 1
if(chn[i]->to_grp1)
{
if (chn[i]->sndmodl != 0)
{
mod = add_fr1x32(chn[i]->snd, mult_fr1x32x32(cv[chn[i]->sndmod], chn[i]->sndmodl));
if (mod < 0) mod = 0;
a = add_fr1x32(a, mult_fr1x32x32(v, mod));
}
else a = add_fr1x32(a, mult_fr1x32x32(v, chn[i]->snd));
}
// group 2
if(chn[i]->to_grp2)
{
if (chn[i]->sndmodl != 0)
{
mod = add_fr1x32(chn[i]->snd, mult_fr1x32x32(cv[chn[i]->sndmod], chn[i]->sndmodl));
if (mod < 0) mod = 0;
b = add_fr1x32(b, mult_fr1x32x32(v, mod));
}
else b = add_fr1x32(b, mult_fr1x32x32(v, chn[i]->snd));
}
}
// add groups to mix
tmp = add_fr1x32(tmp, mult_fr1x32x32(a, master->grp1));
tmp = add_fr1x32(tmp, mult_fr1x32x32(b, master->grp2));
//if clip detection s64 clip, else s32 tmp... ON MIX!
//TRY S64 CLIP_TMP HERE TO DETECT CLIPPING AT OUTPUT MIX...
/*
if (clip > FR32_MAX) return 0;
*/
// add external inputs to mix, output mix
// if (in[2]) out[0] = add_fr1x32(mult_fr1x32x32(tmp, master->output), mult_fr1x32x32(in[2], master->direct));
out[0] = out[1] = mult_fr1x32x32(tmp, master->output);
// if (in[3]) out[1] = add_fr1x32(mult_fr1x32x32(tmp, master->output), mult_fr1x32x32(in[3], master->direct));
// out[1] = mult_fr1x32x32(tmp, master->output);
// direct outputs
out[2] = master->output3(master);
out[3] = master->output4(master);
}
//mix routing
static void route_mix(s32 n, s32 r) {
// mix
if (r == 0)
{
chn[n]->to_mix = 1;
chn[n]->to_grp1 = 0;
chn[n]->to_grp2 = 0;
}
// group 1
else if (r == 1)
{
chn[n]->to_mix = 0;
chn[n]->to_grp1 = 1;
chn[n]->to_grp2 = 0;
}
// group 1
else if (r == 2)
{
chn[n]->to_mix = 0;
chn[n]->to_grp1 = 0;
chn[n]->to_grp2 = 1;
}
// group 1 + 2
else if (r == 3)
{
chn[n]->to_mix = 0;
chn[n]->to_grp1 = 1;
chn[n]->to_grp2 = 1;
}
// mix + group 1
else if (r == 4)
{
chn[n]->to_mix = 1;
chn[n]->to_grp1 = 1;
chn[n]->to_grp2 = 0;
}
// mix + group 2
else if (r == 5)
{
chn[n]->to_mix = 1;
chn[n]->to_grp1 = 0;
chn[n]->to_grp2 = 1;
}
else ;
}
void module_clock_in(void) {
u8 n;
s32 pptmp;
// refresh step value
for (n = 0; n < N_CHN; n++)
{
pptmp = pp[n];
if (pptmp)
{
// imp
if (chn[n]->flag == 1)
{
chn[n]->trig = 1;
}
// lin
if (chn[n]->flag == 2)
{
// sample
set_loop(chn[n], samples[pptmp + 1]);
set_start(chn[n], samples[pptmp]);
chn[n]->trig = 1;
}
// tape
if (chn[n]->flag == 11)
{
/*
// command
if (((pptmp >> 24) & 0xff) == start)
{
// chn[s]->c = v;
env_tcd_set_c(&(chn[s]->envAmp), 1);
}
else if (ppval byte 0 == stop)
{
env_tcd_set_c(&(chn[s]->envAmp), 0);
}
else if (ppval byte 0 == reverse)
{
env_tcd_set_c(&(chn[s]->envAmp), 2);
}
// speed
else
{
env_tcd_set_a(&(chn[s]->envAmp), byte123 val);
}
*/
}
// deck
if (chn[n]->flag == 12)
{
/*
// command
cmd_0[output] = (pptmp >> 24) & 0xff;
cmd_1[output] = (pptmp >> 16) & 0xff;
cmd_2[output] = (pptmp >> 8) & 0xff;
cmd_3[output] = pptmp & 0xff;
uart_write(output);
*/
}
else ;
/*
{
CV TRACK?!??!
cv[n] = pp_val[n];
}
*/
pp[n] = 0;
}
}
}
void module_send_retrig(void) {
u8 n;
for (n = 0; n < N_CHN; n++)
{
if (chn[n]->retrig) chn[n]->trig = 1;
}
}
// parameters
void module_set_param(u32 idx, ParamValue v) {};
void param_set_sampleoffset(ParamValue v) {
offset = v;
}
void param_set_samplevalue(ParamValue v) {
data->sampleBuffer[offset] = v;
}
void set_start(prgmChn *c, u32 offset) {
u8 i;
for (i=0; i<N_HEADS; i++)
{
c->head[i].start = offset;
}
}
void set_loop(prgmChn *c, u32 offset) {
u8 i;
for (i=0; i<N_HEADS; i++)
{
c->head[i].end = offset;
}
}
void module_set_sqparam(u32 s, u32 idx, ParamValue v) {
switch(idx) {
case eParamDummy:
break;
case eParamOffset:
param_set_sampleoffset(v);
break;
case eParamSample:
param_set_samplevalue(v);
break;
case eParamSampleLoopPoint:
samples[s] = v;
break;
case eParamPP:
pp[s] = v;
break;
case eParamTrig:
chn[s]->trig = 1;
break;
case eParamRetrig:
chn[s]->retrig = v;
break;
case eParamSendRetrig:
chn[s]->send_retrig = v;
break;
case eParamInput:
chn[s]->input = set_input(v);
break;
case eParamFlag:
chn[s]->flag = v;
chn[s]->process = set_process(v);
chn[s]->cvprocess = set_cvprocess(v);
break;
case eParamMuteFlag:
chn[s]->mute = v;
break;
case eParamMute:
chn[s]->process = set_process(12);
break;
case eParamUnMute:
chn[s]->process = set_process(14);
break;
case eParamOffsetA:
set_start(chn[s], v);
break;
case eParamOffsetB:
set_loop(chn[s], v);
break;
case eParamA:
chn[s]->a = v;
break;
case eParamAModSrc:
chn[s]->amod = v;
break;
case eParamAModAmount:
chn[s]->amodl = v;
break;
case eParamB:
chn[s]->b = v;
break;
case eParamC:
chn[s]->c = v;
break;
case eParamD:
chn[s]->d = v;
break;
case eParamRouteSnd:
route_mix(s, v);
break;
case eParamSndLevel:
chn[s]->snd = v;
filter_1p_lo_in(&(chn[s]->sndSlew), v);
break;
case eParamSndModSrc:
chn[s]->sndmod = v;
case eParamSndModAmount:
chn[s]->sndmodl = v;
break;
case eParamAuxLevel:
chn[s]->aux = v;
break;
case eParamAuxModSrc:
chn[s]->auxmod = v;
break;
case eParamAuxModAmount:
chn[s]->auxmodl = v;
break;
case eParamAuxCvLevel:
chn[s]->auxcv = v;
break;
case eParamDirectOut3:
master->output3 = set_output(v);
break;
case eParamDirectOut4:
master->output4 = set_output(v);
break;
case eParamGroup1:
master->grp1 = v;
break;
case eParamGroup2:
master->grp2 = v;
break;
case eParamMaster:
master->output = v;
break;
case eParamStartupTime:
chn[s]->b = v;
break;
case eParamDebug:
bfin_debug(v);
break;
default:
break;
}
}
// inputs
fract32 in_noinput(void) {
return 0;
}
fract32 in_in0(void) {
return in[0];
}
fract32 in_in1(void) {
return in[1];
}
fract32 in_vout0(void) {
return vout[0];
}
fract32 in_vrev0(void) {
return negate_fr1x32(vout[0]);
}
fract32 in_vpad0(void) {
return mult_fr1x32x32(vout[0], PAD);
}
fract32 in_vout1(void) {
return vout[1];
}
fract32 in_vrev1(void) {
return negate_fr1x32(vout[1]);
}
fract32 in_vpad1(void) {
return mult_fr1x32x32(vout[1], PAD);
}
fract32 in_vout2(void) {
return vout[2];
}
fract32 in_vrev2(void) {
return negate_fr1x32(vout[2]);
}
fract32 in_vpad2(void) {
return mult_fr1x32x32(vout[2], PAD);
}
fract32 in_vout3(void) {
return vout[3];
}
fract32 in_vrev3(void) {
return negate_fr1x32(vout[3]);
}
fract32 in_vpad3(void) {
return mult_fr1x32x32(vout[3], PAD);
}
fract32 in_vout4(void) {
return vout[4];
}
fract32 in_vrev4(void) {
return negate_fr1x32(vout[4]);
}
fract32 in_vpad4(void) {
return mult_fr1x32x32(vout[4], PAD);
}
fract32 in_vout5(void) {
return vout[5];
}
fract32 in_vrev5(void) {
return negate_fr1x32(vout[5]);
}
fract32 in_vpad5(void) {
return mult_fr1x32x32(vout[5], PAD);
}
fract32 in_aux(void) {
return aux;
}
fract32 in_arev(void) {
return negate_fr1x32(aux);
}
// cv
fract32 cv_off(prgmChn *c) {
return 0;
}
fract32 cv_imp(prgmChn *c) {
fract32 tmp;
fract32 mod = mult_fr1x32x32(cv[c->amod], c->amodl);
// mode parameter: impulse length
// send retrig: on gate end