|
@@ -36,6 +36,9 @@
|
36
|
36
|
|
37
|
37
|
#include "cmDspPgmKrChain.h"
|
38
|
38
|
|
|
39
|
+#undef KR2
|
|
40
|
+
|
|
41
|
+
|
39
|
42
|
cmDspRC_t krLoadRsrc(cmDspSysH_t h, cmErr_t* err, krRsrc_t* r)
|
40
|
43
|
{
|
41
|
44
|
cmDspRC_t rc;
|
|
@@ -71,7 +74,7 @@ const cmChar_t* _mlbl(const cmChar_t* prefix, unsigned ch )
|
71
|
74
|
#define mlbl(a) _mlbl(a,mch)
|
72
|
75
|
#define lbl(a) cmDspSysPrintLabel(a,ach)
|
73
|
76
|
|
74
|
|
-
|
|
77
|
+#ifndef KR2
|
75
|
78
|
void _cmDspSys_TlXformChain( cmDspSysH_t h, cmDspTlXform_t* c, unsigned preGrpSymId, unsigned cmpPreGrpSymId, cmDspInst_t* modp, unsigned ach, unsigned mch )
|
76
|
79
|
{
|
77
|
80
|
unsigned measRtrChCnt = 6; // note: router channel 6 is not connected
|
|
@@ -361,4 +364,186 @@ void _cmDspSys_TlXformChain( cmDspSysH_t h, cmDspTlXform_t* c, unsigned preGrpS
|
361
|
364
|
c->cmp = cmp;
|
362
|
365
|
|
363
|
366
|
}
|
|
367
|
+#endif
|
|
368
|
+
|
|
369
|
+//=======================================================================================================================
|
|
370
|
+//=======================================================================================================================
|
|
371
|
+// KR2 Modeless Transform based on cmDspKr2 and cmSpecDist2
|
|
372
|
+//=======================================================================================================================
|
|
373
|
+//=======================================================================================================================
|
|
374
|
+
|
|
375
|
+#ifdef KR2
|
|
376
|
+void _cmDspSys_TlXformChain( cmDspSysH_t h, cmDspTlXform_t* c, unsigned preGrpSymId, unsigned cmpPreGrpSymId, cmDspInst_t* modp, unsigned ach, unsigned mch )
|
|
377
|
+{
|
|
378
|
+ unsigned measRtrChCnt = 6; // note: router channel 6 is not connected
|
|
379
|
+
|
|
380
|
+ int krWndSmpCnt = 2048;
|
|
381
|
+ int krHopFact = 4;
|
|
382
|
+
|
|
383
|
+ unsigned xfadeChCnt = 2;
|
|
384
|
+ double xfadeMs = 50;
|
|
385
|
+ bool xfadeInitFl = true;
|
|
386
|
+ double mixGain = 1.0;
|
|
387
|
+
|
|
388
|
+ bool cmpBypassFl = false;
|
|
389
|
+ double cmpInGain = 3.0;
|
|
390
|
+ double cmpThreshDb = -40.0;
|
|
391
|
+ double cmpRatio_num = 5.0;
|
|
392
|
+ double cmpAtkMs = 20.0;
|
|
393
|
+ double cmpRlsMs = 100.0;
|
|
394
|
+ double cmpMakeup = 1.0;
|
|
395
|
+ double cmpWndMaxMs = 1000.0;
|
|
396
|
+ double cmpWndMs = 200.0;
|
|
397
|
+
|
|
398
|
+ cmDspInst_t* achan = cmDspSysAllocInst(h, "AvailCh", NULL, 1, xfadeChCnt );
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+ // Parameter-> kr routers (routers used to cross-fade between the two kr units)
|
|
402
|
+ unsigned paramRtChCnt = 2;
|
|
403
|
+ cmDspInst_t* wnd_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
404
|
+ cmDspInst_t* hop_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
405
|
+ cmDspInst_t* ceil_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
406
|
+ cmDspInst_t* expo_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
407
|
+ cmDspInst_t* mix_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
408
|
+ cmDspInst_t* thr_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
409
|
+ cmDspInst_t* upr_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
410
|
+ cmDspInst_t* lwr_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
411
|
+ cmDspInst_t* wet_rt = cmDspSysAllocInst(h, "Router", NULL, 2, paramRtChCnt, paramRtChCnt-1 );
|
|
412
|
+
|
|
413
|
+ // Audio processors
|
|
414
|
+ cmDspInst_t* kr0 = cmDspSysAllocInst(h, "Kr2", NULL, 2, krWndSmpCnt, krHopFact );
|
|
415
|
+ cmDspInst_t* kr1 = cmDspSysAllocInst(h, "Kr2", NULL, 2, krWndSmpCnt, krHopFact );
|
|
416
|
+ cmDspInst_t* xfad = cmDspSysAllocInst(h, "Xfader", NULL, 3, xfadeChCnt, xfadeMs, xfadeInitFl );
|
|
417
|
+ cmDspInst_t* mix = cmDspSysAllocInst(h, "AMix", NULL, 3, xfadeChCnt, mixGain, mixGain );
|
|
418
|
+ cmDspInst_t* cmp = cmDspSysAllocInst(h, "Compressor", NULL, 8, cmpBypassFl, cmpThreshDb, cmpRatio_num, cmpAtkMs, cmpRlsMs, cmpMakeup, cmpWndMs, cmpWndMaxMs );
|
|
419
|
+
|
|
420
|
+ // Internal audio connections
|
|
421
|
+ cmDspSysConnectAudio(h, kr0, "out", xfad, "in-0");
|
|
422
|
+ cmDspSysConnectAudio(h, kr1, "out", xfad, "in-1");
|
|
423
|
+ cmDspSysConnectAudio(h, xfad, "out-0", mix, "in-0");
|
|
424
|
+ cmDspSysConnectAudio(h, xfad, "out-1", mix, "in-1");
|
|
425
|
+ cmDspSysConnectAudio(h, mix, "out", cmp, "in" );
|
|
426
|
+
|
|
427
|
+ // active channel <-> cross-fade connections
|
|
428
|
+ cmDspSysInstallCb(h, achan, "reset", xfad, "reset", NULL);
|
|
429
|
+ cmDspSysInstallCb(h, achan, "gate-0", xfad, "gate-0", NULL );
|
|
430
|
+ cmDspSysInstallCb(h, achan, "gate-1", xfad, "gate-1", NULL );
|
|
431
|
+ cmDspSysInstallCb(h, xfad, "state-0", achan, "dis-0", NULL );
|
|
432
|
+ cmDspSysInstallCb(h, xfad, "state-1", achan, "dis-1", NULL );
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+ // Parameter number controls
|
|
436
|
+ cmDspInst_t* wnd_ctl = cmDspSysAllocMsgListP(h,preGrpSymId,NULL, lbl("WndSmpCnt"), NULL, "wndSmpCnt", 2);
|
|
437
|
+ cmDspInst_t* hop_ctl = cmDspSysAllocMsgListP(h,preGrpSymId,NULL, lbl("HopFact"), NULL, "hopFact", 2);
|
|
438
|
+ cmDspInst_t* ceil_ctl= cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Ceiling"), 0.0, 100.0, 0.1, 30.0 );
|
|
439
|
+ cmDspInst_t* expo_ctl= cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Expo"), -10.0, 10.0, 0.01, 2.0 );
|
|
440
|
+ cmDspInst_t* mix_ctl = cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Mix"), 0.0, 1.0, 0.01, 0.0 );
|
|
441
|
+ cmDspInst_t* thr_ctl = cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Threshold"), 0.0, 100.0, 0.1, 60.0 );
|
|
442
|
+ cmDspInst_t* upr_ctl = cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Upr slope"), -10.0, 10.0, 0.01, 0.0 );
|
|
443
|
+ cmDspInst_t* lwr_ctl = cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Lwr slope"), -10.0, 10.0, 0.01, 2.0 );
|
|
444
|
+ cmDspInst_t* wet_ctl = cmDspSysAllocScalarP( h,preGrpSymId,NULL, lbl("Wet Dry"), 0.0, 1.0, 0.001, 1.0 );
|
|
445
|
+
|
|
446
|
+ cmDspSysInstallCb(h, wnd_ctl, "out", wnd_rt, "f-in", NULL );
|
|
447
|
+ cmDspSysInstallCb(h, achan, "ch", wnd_rt, "sel", NULL ); // ach->rt sel
|
|
448
|
+ cmDspSysInstallCb(h, wnd_rt, "f-out-0", kr0, "wndn", NULL ); // wndn->kr
|
|
449
|
+ cmDspSysInstallCb(h, wnd_rt, "f-out-1", kr1, "wndn", NULL ); // wndn->kr
|
|
450
|
+
|
|
451
|
+ cmDspSysInstallCb(h, hop_ctl, "out", hop_rt, "f-in", NULL );
|
|
452
|
+ cmDspSysInstallCb(h, achan, "ch", hop_rt, "sel", NULL ); // ach->rt sel
|
|
453
|
+ cmDspSysInstallCb(h, hop_rt, "f-out-0", kr0, "hopf", NULL ); // hopf->kr
|
|
454
|
+ cmDspSysInstallCb(h, hop_rt, "f-out-1", kr1, "hopf", NULL ); // hopf->kr
|
|
455
|
+
|
|
456
|
+ cmDspSysInstallCb(h, ceil_ctl, "val", ceil_rt, "f-in", NULL );
|
|
457
|
+ cmDspSysInstallCb(h, achan, "ch", ceil_rt, "sel", NULL ); // ach->rt sel
|
|
458
|
+ cmDspSysInstallCb(h, ceil_rt, "f-out-0", kr0, "ceil", NULL ); // ceil->kr
|
|
459
|
+ cmDspSysInstallCb(h, ceil_rt, "f-out-1", kr1, "ceil", NULL ); // ceil->kr
|
|
460
|
+
|
|
461
|
+ cmDspSysInstallCb(h, expo_ctl, "val", expo_rt, "f-in", NULL );
|
|
462
|
+ cmDspSysInstallCb(h, achan, "ch", expo_rt, "sel", NULL ); // ach->rt sel
|
|
463
|
+ cmDspSysInstallCb(h, expo_rt, "f-out-0", kr0, "expo", NULL ); // expo->kr
|
|
464
|
+ cmDspSysInstallCb(h, expo_rt, "f-out-1", kr1, "expo", NULL ); // expo->kr
|
|
465
|
+
|
|
466
|
+ cmDspSysInstallCb(h, mix_ctl, "val", mix_rt, "f-in", NULL );
|
|
467
|
+ cmDspSysInstallCb(h, achan, "ch", mix_rt, "sel", NULL ); // ach->rt sel
|
|
468
|
+ cmDspSysInstallCb(h, mix_rt, "f-out-0", kr0, "mix", NULL ); // mix->kr
|
|
469
|
+ cmDspSysInstallCb(h, mix_rt, "f-out-1", kr1, "mix", NULL ); // mix->kr
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+ cmDspSysInstallCb(h, thr_ctl, "val", thr_rt, "f-in", NULL );
|
|
473
|
+ cmDspSysInstallCb(h, achan, "ch", thr_rt, "sel", NULL ); // ach->rt sel
|
|
474
|
+ cmDspSysInstallCb(h, thr_rt, "f-out-0", kr0, "thrh", NULL ); // thr->kr
|
|
475
|
+ cmDspSysInstallCb(h, thr_rt, "f-out-1", kr1, "thrh", NULL ); // thr->kr
|
|
476
|
+
|
|
477
|
+ cmDspSysInstallCb(h, upr_ctl, "val", upr_rt, "f-in", NULL );
|
|
478
|
+ cmDspSysInstallCb(h, achan, "ch", upr_rt, "sel", NULL ); // ach->rt sel
|
|
479
|
+ cmDspSysInstallCb(h, upr_rt, "f-out-0", kr0, "uprs", NULL ); // upr->kr
|
|
480
|
+ cmDspSysInstallCb(h, upr_rt, "f-out-1", kr1, "uprs", NULL ); // upr->kr
|
|
481
|
+
|
|
482
|
+ cmDspSysInstallCb(h, lwr_ctl, "val", lwr_rt, "f-in", NULL );
|
|
483
|
+ cmDspSysInstallCb(h, achan, "ch", lwr_rt, "sel", NULL ); // ach->rt sel
|
|
484
|
+ cmDspSysInstallCb(h, lwr_rt, "f-out-0", kr0, "lwrs", NULL ); // lwr->kr
|
|
485
|
+ cmDspSysInstallCb(h, lwr_rt, "f-out-1", kr1, "lwrs", NULL ); // lwr->kr
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+ cmDspSysInstallCb(h, wet_ctl, "val", wet_rt, "f-in", NULL );
|
|
489
|
+ cmDspSysInstallCb(h, achan, "ch", wet_rt, "sel", NULL ); // ach->rt sel
|
|
490
|
+ cmDspSysInstallCb(h, wet_rt, "f-out-0", kr0, "wet", NULL ); // wet->kr
|
|
491
|
+ cmDspSysInstallCb(h, wet_rt, "f-out-1", kr1, "wet", NULL ); // wet->kr
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+ cmDspSysNewColumn(h,0);
|
|
495
|
+ cmDspInst_t* cmp_byp = cmDspSysAllocCheckP( h, cmpPreGrpSymId, NULL, lbl("Bypass"), 1.0 );
|
|
496
|
+ cmDspInst_t* cmp_igain = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("In Gain"), 0.0, 10.0, 0.1, cmpInGain);
|
|
497
|
+ cmDspInst_t* cmp_thr = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("ThreshDb"), -100.0, 0.0, 0.1, cmpThreshDb);
|
|
498
|
+ cmDspInst_t* cmp_rat = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("Ratio"), 0.1, 100, 0.1, cmpRatio_num);
|
|
499
|
+ cmDspInst_t* cmp_atk = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("Atk Ms"), 0.0, 1000.0, 0.1, cmpAtkMs);
|
|
500
|
+ cmDspInst_t* cmp_rls = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("Rls Ms"), 0.0, 1000.0, 0.1, cmpRlsMs);
|
|
501
|
+ cmDspInst_t* cmp_mkup = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("Makeup"), 0.0, 10.0, 0.01, cmpMakeup);
|
|
502
|
+ cmDspInst_t* cmp_wnd = cmDspSysAllocScalarP( h, cmpPreGrpSymId, NULL, lbl("Wnd Ms"), 1.0, cmpWndMaxMs, 1.0, cmpWndMs );
|
|
503
|
+ cmDspInst_t* cmp_mtr = cmDspSysAllocInst(h,"Meter",lbl("Env"), 3, 0.0, 0.0, 1.0);
|
|
504
|
+
|
|
505
|
+ cmDspSysInstallCb(h, cmp_byp, "out", cmp, "bypass", NULL );
|
|
506
|
+ cmDspSysInstallCb(h, cmp_igain,"val", cmp, "igain", NULL );
|
|
507
|
+ cmDspSysInstallCb(h, cmp_thr, "val", cmp, "thr", NULL );
|
|
508
|
+ cmDspSysInstallCb(h, cmp_rat, "val", cmp, "ratio", NULL );
|
|
509
|
+ cmDspSysInstallCb(h, cmp_atk, "val", cmp, "atk", NULL );
|
|
510
|
+ cmDspSysInstallCb(h, cmp_rls, "val", cmp, "rls", NULL );
|
|
511
|
+ cmDspSysInstallCb(h, cmp_mkup, "val", cmp, "ogain", NULL );
|
|
512
|
+ cmDspSysInstallCb(h, cmp_wnd, "val", cmp, "wnd", NULL );
|
|
513
|
+ cmDspSysInstallCb(h, cmp, "env", cmp_mtr, "in", NULL );
|
|
514
|
+
|
|
515
|
+ cmDspSysInstallCb(h, modp, mlbl("cbyp"), cmp_byp, "in", NULL );
|
|
516
|
+ cmDspSysInstallCb(h, modp, mlbl("cigain"), cmp_igain,"val", NULL );
|
|
517
|
+ cmDspSysInstallCb(h, modp, mlbl("cthrsh"), cmp_thr, "val", NULL );
|
|
518
|
+ cmDspSysInstallCb(h, modp, mlbl("cratio"), cmp_rat, "val", NULL );
|
|
519
|
+ cmDspSysInstallCb(h, modp, mlbl("catkms"), cmp_atk, "val", NULL );
|
|
520
|
+ cmDspSysInstallCb(h, modp, mlbl("crlsms"), cmp_rls, "val", NULL );
|
|
521
|
+ cmDspSysInstallCb(h, modp, mlbl("cmakeup"), cmp_mkup, "val", NULL );
|
|
522
|
+ cmDspSysInstallCb(h, modp, mlbl("cwndms"), cmp_wnd, "val", NULL );
|
|
523
|
+
|
|
524
|
+ //
|
|
525
|
+ cmDspInst_t* xfadMs = cmDspSysAllocInst(h,"Scalar", lbl("Xfade Ms"), 5, kNumberDuiId, 0.0, 1000.0,0.01, 50.0 );
|
|
526
|
+ cmDspSysInstallCb(h, xfadMs, "val", xfad, "ms", NULL );
|
|
527
|
+ cmDspSysInstallCb(h, modp, mlbl("xfad"), xfadMs, "val", NULL);
|
|
528
|
+
|
|
529
|
+ cmDspSysInstallCb(h, modp, mlbl("win"), wnd_ctl, "sel", NULL );
|
|
530
|
+ cmDspSysInstallCb(h, modp, mlbl("hop"), hop_ctl, "sel", NULL );
|
|
531
|
+ cmDspSysInstallCb(h, modp, mlbl("ceil"), ceil_ctl, "val", NULL );
|
|
532
|
+ cmDspSysInstallCb(h, modp, mlbl("expo"), expo_ctl, "val", NULL );
|
|
533
|
+ cmDspSysInstallCb(h, modp, mlbl("mix"), mix_ctl, "val", NULL );
|
|
534
|
+ cmDspSysInstallCb(h, modp, mlbl("thr"), thr_ctl, "val", NULL );
|
|
535
|
+ cmDspSysInstallCb(h, modp, mlbl("upr"), upr_ctl, "val", NULL );
|
|
536
|
+ cmDspSysInstallCb(h, modp, mlbl("lwr"), lwr_ctl, "val", NULL );
|
|
537
|
+ cmDspSysInstallCb(h, modp, mlbl("wet"), wet_ctl, "val", NULL );
|
|
538
|
+
|
|
539
|
+ cmDspSysInstallCb(h, modp, mlbl("sw"), achan, "trig", NULL ); // See also: amp.sfloc->achan.trig
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+ c->achan = achan;
|
|
543
|
+ c->kr0 = kr0;
|
|
544
|
+ c->kr1 = kr1;
|
|
545
|
+ c->cmp = cmp;
|
|
546
|
+
|
|
547
|
+}
|
364
|
548
|
|
|
549
|
+#endif
|