Procházet zdrojové kódy

cmDspPgmKr.c : Removed body of cmDspSysPgm_KrLive() and modified

_cmDspSysPgm_TimeLine() to have 'live' and 'simulate' modes.
master
kpl před 11 roky
rodič
revize
b549a90da3
1 změnil soubory, kde provedl 80 přidání a 95 odebrání
  1. 80
    95
      dsp/cmDspPgmKr.c

+ 80
- 95
dsp/cmDspPgmKr.c Zobrazit soubor

@@ -108,31 +108,22 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
108 108
   unsigned   preGrpSymId     = cmDspSysPresetRegisterGroup(h,"tl");
109 109
   unsigned   compPreGrpSymId = cmDspSysPresetRegisterGroup(h,"tl_cmp"); 
110 110
 
111
+  cmDspInst_t* ai0p = cmDspSysAllocInst(h,"AudioIn",     NULL,  1, 0);
112
+  cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn",     NULL,  1, 1);
111 113
   cmDspInst_t* tlp  = cmDspSysAllocInst(h,"TimeLine",    "tl",  2, r.tlFn, r.tlPrefixPath );
112 114
   cmDspInst_t* scp  = cmDspSysAllocInst(h,"Score",       "sc",  1, r.scFn );
113 115
   cmDspInst_t* php  = cmDspSysAllocInst(h,"Phasor",      NULL,  1, cmDspSysSampleRate(h) );
114 116
   cmDspInst_t* wtp  = cmDspSysAllocInst(h,"WaveTable",   NULL,  4, wtSmpCnt, wtInitMode, NULL, wtLoopCnt );
115 117
   cmDspInst_t* pts  = cmDspSysAllocInst(h,"PortToSym",   NULL,  2, "on", "off" );
118
+  cmDspInst_t* mip  = cmDspSysAllocInst(h,"MidiIn",      NULL,  0 );
116 119
   cmDspInst_t* mfp  = cmDspSysAllocInst(h,"MidiFilePlay",NULL,  0 );
120
+  cmDspInst_t* mop  = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, r.midiDevice,r.midiOutPort);
117 121
   cmDspInst_t* sfp  = cmDspSysAllocInst(h,"ScFol",       NULL,  1, r.scFn );
118 122
   cmDspInst_t* amp  = cmDspSysAllocInst(h,"ActiveMeas",  NULL,  1, 100 );
119 123
   cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod",       NULL,  2, r.modFn, "m1" );
120 124
   cmDspInst_t* asp  = cmDspSysAllocInst(h,"AmSync",      NULL,  0 );
121 125
 
122 126
 
123
-  cmDspInst_t* mop = NULL;
124
-  
125
-  if( cmTextIsNotEmpty(r.midiDevice) && cmTextIsNotEmpty(r.midiOutPort) )
126
-  {
127
-    /*
128
-#ifdef OS_OSX
129
-    deviceName = "RME - Fireface UFX (23148636)";
130
-    portName   = "Port 2";
131
-#endif
132
-    */
133
-
134
-    mop  = cmDspSysAllocInst( h,"MidiOut", NULL,     2, r.midiDevice, r.midiOutPort);
135
-  }
136 127
 
137 128
   cmDspInst_t* achan0      = cmDspSysAllocInst(h, "AvailCh",     NULL, 1, xfadeChCnt );
138 129
   cmDspInst_t* achan1      = cmDspSysAllocInst(h, "AvailCh",     NULL, 1, xfadeChCnt );
@@ -193,6 +184,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
193 184
 
194 185
 
195 186
   cmDspSysNewPage(h,"Controls");
187
+  cmDspInst_t* liveb= cmDspSysAllocInst(h,"Button", "live",   2, kCheckDuiId,  0.0 );
188
+  cmDspInst_t* simb = cmDspSysAllocInst(h,"Button", "simulate",2,kCheckDuiId,  0.0 );
196 189
   cmDspInst_t* onb  = cmDspSysAllocInst(h,"Button", "start",  2, kButtonDuiId, 1.0 );
197 190
   cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop",   2, kButtonDuiId, 1.0 );
198 191
   cmDspInst_t* prtb = cmDspSysAllocInst(h,"Button", "print",  2, kButtonDuiId, 1.0 );
@@ -204,6 +197,18 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
204 197
   cmDspInst_t* prc  = cmDspSysAllocInst(h,"Printer", NULL,   1, "COST:");
205 198
   //cmDspInst_t* prv  = cmDspSysAllocInst(h,"Printer", NULL,   1, "Value:");
206 199
 
200
+  // Record <-> Live switches
201
+  cmDspInst_t* tlRt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
202
+  cmDspInst_t* wtRt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
203
+  cmDspInst_t* mfpRt = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
204
+  cmDspInst_t* amRt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
205
+  cmDspInst_t* au0Sw = cmDspSysAllocInst(h,"1ofN",   NULL, 2, 2, 0);
206
+  cmDspInst_t* au1Sw = cmDspSysAllocInst(h,"1ofN",   NULL, 2, 2, 0);
207
+
208
+  cmDspInst_t* d0Rt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
209
+  cmDspInst_t* d1Rt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
210
+  cmDspInst_t* stRt  = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
211
+
207 212
   //--------------- Preset controls
208 213
   cmDspInst_t* preset    = cmDspSysAllocInst(   h, "Preset", NULL, 1, preGrpSymId );
209 214
   cmDspInst_t* presetLbl = cmDspSysAllocInst(   h, "Text",   "Preset",      1, "" );
@@ -216,6 +221,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
216 221
   cmDspInst_t* prePath    = cmDspSysAllocInst(   h, "Fname",  "prePath",   3, true,NULL,r.tlPrefixPath);
217 222
   
218 223
 
224
+  cmDspSysNewColumn(h,0);
225
+
219 226
   //--------------- Recorded performance evaluation and Active Measurement related controls
220 227
   cmDspInst_t* clrBtn  = cmDspSysAllocButton( h, "clear",  0);
221 228
   cmDspInst_t* prtBtn  = cmDspSysAllocButton( h, "dump",  0);
@@ -231,7 +238,8 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
231 238
   cmDspSysInstallCb( h, mlst,   "val",    amp, "val", NULL );
232 239
   cmDspSysInstallCb( h, mlst,   "cost",   amp, "cst", NULL );
233 240
   cmDspSysInstallCb( h, mlst,   "typeId", amCmd, "add", NULL );
234
-  cmDspSysInstallCb( h, sfp,    "out",    amp, "sfloc", NULL );
241
+  cmDspSysInstallCb( h, sfp,    "out",    amRt, "f-in", NULL );
242
+  cmDspSysInstallCb( h, amRt,   "f-out-0",amp, "sfloc", NULL );
235 243
   cmDspSysInstallCb( h, amp,    "even",   pre, "in", NULL );
236 244
   cmDspSysInstallCb( h, amp,    "dyn",    prd, "in", NULL );
237 245
   cmDspSysInstallCb( h, amp,    "tempo",  prt, "in", NULL );
@@ -352,28 +360,32 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
352 360
   if((rc = cmDspSysLastRC(h)) != kOkDspRC )
353 361
     return rc;
354 362
 
355
-  // phasor->wt->aout
356
-  cmDspSysConnectAudio(h, php,  "out", wtp,  "phs" );   // phs -> wt
357
-
358
-  cmDspSysConnectAudio(h, wtp,  "out",   kr00, "in"  );  // wt -> kr
363
+  cmDspSysConnectAudio(h, php,  "out",   wtp,  "phs" );     // phs -> wt
364
+  cmDspSysConnectAudio(h, wtp,  "out",   au0Sw, "a-in-0" ); // wt  -> sw
365
+  cmDspSysConnectAudio(h, ai0p, "out",   au0Sw, "a-in-1" ); // ain -> sw
366
+  cmDspSysConnectAudio(h, au0Sw,"a-out", kr00, "in"  );     // sw  -> kr
359 367
   cmDspSysConnectAudio(h, kr00, "out",   fad0, "in-0");  
360 368
   cmDspSysConnectAudio(h, fad0, "out-0", mix0, "in-0");
361
-  cmDspSysConnectAudio(h, wtp,  "out",   kr01, "in"  );  // wt -> kr
369
+
370
+  cmDspSysConnectAudio(h, au0Sw,"a-out", kr01, "in"  );  
362 371
   cmDspSysConnectAudio(h, kr01, "out",   fad0, "in-1");  
363 372
   cmDspSysConnectAudio(h, fad0, "out-1", mix0, "in-1");
364 373
   cmDspSysConnectAudio(h, mix0, "out",   cmp0, "in");
365
-  cmDspSysConnectAudio(h, cmp0, "out",   ao0p, "in" );    // comp -> aout
374
+  cmDspSysConnectAudio(h, cmp0, "out",   ao0p, "in" );   // comp -> aout
366 375
 
367
-  cmDspSysConnectAudio(h, wtp,  "out",   kr10, "in"  );  // wt -> kr
376
+
377
+  cmDspSysConnectAudio(h, wtp,  "out",   au1Sw, "a-in-0" );  // wt -> kr
378
+  cmDspSysConnectAudio(h, ai1p, "out",   au1Sw, "a-in-1" );
379
+  cmDspSysConnectAudio(h, au1Sw,"a-out", kr10, "in"  );  
368 380
   cmDspSysConnectAudio(h, kr10, "out",   fad1, "in-0");
369 381
   cmDspSysConnectAudio(h, fad1, "out-0", mix1, "in-0");
370
-  cmDspSysConnectAudio(h, wtp,  "out",   kr11, "in"  );  // wt -> kr
382
+  cmDspSysConnectAudio(h, au1Sw,"a-out", kr11, "in"  );  // wt -> kr
371 383
   cmDspSysConnectAudio(h, kr11, "out",   fad1, "in-1");  
372 384
   cmDspSysConnectAudio(h, fad1, "out-1", mix1, "in-1");
373 385
   cmDspSysConnectAudio(h, mix1, "out",   cmp1, "in");
374 386
   cmDspSysConnectAudio(h, cmp1, "out",   ao1p, "in" );   // comp -> aout
375 387
 
376
-  cmDspSysConnectAudio(h, cmp0, "out", afop, "in0" );  // comp -> audio_file_out
388
+  cmDspSysConnectAudio(h, cmp0, "out", afop, "in0" );    // comp -> audio_file_out
377 389
   cmDspSysConnectAudio(h, cmp1, "out", afop, "in1" );
378 390
 
379 391
   // wave-table to time-line cursor
@@ -381,16 +393,32 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
381 393
 
382 394
   cmDspSysInstallCb(h, prePath, "out", tlp, "path", NULL );
383 395
 
396
+  // 'live' button -> live router selector switch 
397
+  cmDspSysInstallCb(h, liveb, "out",  wtRt, "sel", NULL );
398
+  cmDspSysInstallCb(h, liveb, "out",  tlRt, "sel", NULL );
399
+  cmDspSysInstallCb(h, liveb, "out",  mfpRt,"sel", NULL );
400
+  cmDspSysInstallCb(h, liveb, "out",  amRt, "sel", NULL );
401
+  cmDspSysInstallCb(h, liveb, "out",  au0Sw, "chidx", NULL );
402
+  cmDspSysInstallCb(h, liveb, "out",  au1Sw, "chidx", NULL );
403
+  cmDspSysInstallCb(h, simb,  "out",  au0Sw, "chidx", NULL );
404
+  cmDspSysInstallCb(h, simb,  "out",  au1Sw, "chidx", NULL );
405
+  
406
+
407
+  
384 408
   // start connections
385
-  cmDspSysInstallCb(h, onb, "sym", tlp, "reset", NULL );
386
-  cmDspSysInstallCb(h, onb, "sym", scp, "send",  NULL );
387
-  cmDspSysInstallCb(h, onb, "sym", mfp, "sel",   NULL );
388
-  cmDspSysInstallCb(h, onb, "sym", pts, "on",    NULL );
389
-  cmDspSysInstallCb(h, pts, "on",  wtp, "cmd",   NULL );
390
-  cmDspSysInstallCb(h, pts, "on",  modp,"cmd",   NULL );
391
-  cmDspSysInstallCb(h, onb, "sym", amCmd, "rewind", NULL );
392
-  cmDspSysInstallCb(h, onb, "sym", achan0, "trig", NULL );
393
-  cmDspSysInstallCb(h, onb, "sym", achan1, "trig", NULL );
409
+  cmDspSysInstallCb(h, onb,  "sym",    tlRt, "s-in",  NULL );
410
+  cmDspSysInstallCb(h, tlRt, "s-out-0",tlp,  "reset", NULL );
411
+  cmDspSysInstallCb(h, onb,  "sym",    scp,  "send",  NULL );
412
+  cmDspSysInstallCb(h, onb,  "sym",    mfpRt,"s-in",  NULL );
413
+  cmDspSysInstallCb(h, mfpRt,"s-out-0",mfp,  "sel",   NULL );
414
+
415
+  cmDspSysInstallCb(h, onb, "sym",     pts,   "on",    NULL );
416
+  cmDspSysInstallCb(h, pts, "on",      wtRt,  "s-in",  NULL );
417
+  cmDspSysInstallCb(h, wtRt,"s-out-0", wtp,   "cmd",   NULL );
418
+  cmDspSysInstallCb(h, pts, "on",      modp,  "cmd",   NULL );
419
+  cmDspSysInstallCb(h, onb, "sym",     amCmd, "rewind",NULL );
420
+  cmDspSysInstallCb(h, onb, "sym",     achan0,"trig",  NULL );
421
+  cmDspSysInstallCb(h, onb, "sym",     achan1,"trig",  NULL );
394 422
 
395 423
   // stop connections
396 424
   cmDspSysInstallCb(h, wtp,  "done",offb,"in",  NULL ); // 'done' from WT simulates pressing Stop btn.
@@ -410,24 +438,32 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
410 438
   cmDspSysInstallCb(h, tlp, "mesi", mfp, "esi",   NULL );
411 439
   cmDspSysInstallCb(h, tlp, "mfn",  mfp, "fn",    NULL );
412 440
   
413
-  cmDspSysInstallCb(h, scp, "sel",    sfp, "index",  NULL ); // score to score follower - to set initial search location
441
+  // score to score follower - to set initial search location
442
+  cmDspSysInstallCb(h, scp, "sel",    sfp, "index",  NULL );
414 443
   cmDspSysInstallCb(h, scp, "sel",    modp,"reset", NULL );
415 444
   
416 445
   //cmDspSysInstallCb(h, reload,"out",  modp, "reload", NULL );
417 446
 
418 447
 
419 448
   // MIDI file player to score follower
420
-  cmDspSysInstallCb(h, mfp, "smpidx", sfp, "smpidx", NULL );
421
-  cmDspSysInstallCb(h, mfp, "d1",     sfp, "d1",     NULL );
422
-  cmDspSysInstallCb(h, mfp, "d0",     sfp, "d0",     NULL );
423
-  cmDspSysInstallCb(h, mfp, "status", sfp, "status", NULL );
424
-
425
-  if( mop != NULL )
426
-  {
427
-    cmDspSysInstallCb(h, mfp, "d1",     mop, "d1",     NULL );
428
-    cmDspSysInstallCb(h, mfp, "d0",     mop, "d0",     NULL );
429
-    cmDspSysInstallCb(h, mfp, "status", mop, "status", NULL );
430
-  }
449
+  cmDspSysInstallCb(h, mfp,  "smpidx",  sfp,  "smpidx",NULL );
450
+  cmDspSysInstallCb(h, mfp,  "d1",      d1Rt, "f-in",  NULL );
451
+  cmDspSysInstallCb(h, d1Rt, "f-out-0", sfp,  "d1",    NULL );
452
+  cmDspSysInstallCb(h, d1Rt, "f-out-1", mop,  "d1",    NULL );
453
+
454
+  cmDspSysInstallCb(h, mfp,  "d0",      d0Rt,  "f-in", NULL );
455
+  cmDspSysInstallCb(h, d0Rt, "f-out-0", sfp,   "d0",   NULL );
456
+  cmDspSysInstallCb(h, d0Rt, "f-out-1", mop,   "d0",   NULL );
457
+
458
+  cmDspSysInstallCb(h, mfp, "status",   stRt, "f-in",  NULL );
459
+  cmDspSysInstallCb(h, stRt, "f-out-0", sfp,  "status",NULL );
460
+  cmDspSysInstallCb(h, stRt, "f-out-1", mop,  "status",NULL );
461
+
462
+  // MIDI input port
463
+  cmDspSysInstallCb(h, mip, "smpidx", sfp, "smpidx", NULL );
464
+  cmDspSysInstallCb(h, mip, "d1",     sfp, "d1",     NULL );
465
+  cmDspSysInstallCb(h, mip, "d0",     sfp, "d0",     NULL );
466
+  cmDspSysInstallCb(h, mip, "status", sfp, "status", NULL );
431 467
 
432 468
   // score follower to modulator and printers
433 469
   cmDspSysInstallCb(h, sfp, "out",  modp,    "index", NULL );
@@ -758,57 +794,6 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
758 794
 cmDspRC_t _cmDspSysPgm_KrLive(cmDspSysH_t h, void** userPtrPtr )
759 795
 {
760 796
   cmDspRC_t       rc         = kOkDspRC;
761
-  cmCtx_t*        cmCtx      = cmDspSysPgmCtx(h);
762
-  cmErr_t         err;
763
-  krRsrc_t        r;
764
-
765
-  /*
766
-  int             krWndSmpCnt = 2048;
767
-  int             krHopFact   = 4;
768
-
769
-  unsigned        xfadeChCnt  = 2;
770
-  double          xfadeMs     = 50;
771
-  bool            xfadeInitFl = true;
772
-  double          mixGain     = 1.0;
773
-
774
-  unsigned        measRtChCnt = 4; // note: router channel 4 is not connected
775
-
776
-  bool            cmpBypassFl  = false;
777
-  double          cmpInGain    = 3.0;
778
-  double          cmpThreshDb  = -40.0;
779
-  double          cmpRatio_num = 5.0;
780
-  double          cmpAtkMs     = 20.0;
781
-  double          cmpRlsMs     = 100.0;
782
-  double          cmpMakeup    = 1.0;
783
-  double          cmpWndMaxMs  = 1000.0;
784
-  double          cmpWndMs     = 200.0;
785
-  */
786
-
787
-
788
-  memset(&r,0,sizeof(r));
789
-  cmErrSetup(&err,&cmCtx->rpt,"Kr Live");
790
-
791
-  if( krLoadRsrc(h,&err,&r) != kOkDspRC )
792
-    return rc;
793
-
794
-  //unsigned   preGrpSymId     = cmDspSysPresetRegisterGroup(h,"tl");
795
-  //unsigned   compPreGrpSymId = cmDspSysPresetRegisterGroup(h,"tl_cmp"); 
796
-
797
-
798
-  cmDspInst_t* mip  = cmDspSysAllocInst(h, "MidiIn",    NULL,   0);
799
-  cmDspInst_t* mop  = cmDspSysAllocInst(h, "MidiOut",   NULL,   2, r.midiDevice, r.midiOutPort);
800
-  cmDspInst_t* ai0p = cmDspSysAllocInst(h,"AudioIn",    NULL,   1, 0 );
801
-  cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn",    NULL,   1, 0 );
802
-  cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",   NULL,   1, 0 );
803
-  cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",   NULL,   1, 0 );
804
-
805
-  cmDspSysConnectAudio(h, ai0p, "out", ao0p, "in" );
806
-  cmDspSysConnectAudio(h, ai1p, "out", ao1p, "in" );
807
-  
808
-  cmDspSysInstallCb(h, mip, "status", mop, "status", NULL);
809
-  cmDspSysInstallCb(h, mip, "d0",     mop, "d0",     NULL);
810
-  cmDspSysInstallCb(h, mip, "d1",     mop, "d1",     NULL);
811
-
812 797
   return rc;
813 798
 
814 799
 }

Načítá se…
Zrušit
Uložit