Sfoglia il codice sorgente

cmDspPgmKr.c:Added use of ScaleRange to score measurement values.

master
kevin 11 anni fa
parent
commit
62ab5588e1
1 ha cambiato i file con 116 aggiunte e 71 eliminazioni
  1. 116
    71
      dsp/cmDspPgmKr.c

+ 116
- 71
dsp/cmDspPgmKr.c Vedi File

@@ -86,6 +86,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
86 86
   cmDspInst_t* pts  = cmDspSysAllocInst(h,"PortToSym",   NULL,  2, "on", "off" );
87 87
   cmDspInst_t* mfp  = cmDspSysAllocInst(h,"MidiFilePlay",NULL,  0 );
88 88
   cmDspInst_t* sfp  = cmDspSysAllocInst(h,"ScFol",       NULL,  1, r.scFn );
89
+  cmDspInst_t* srp  = cmDspSysAllocInst(h,"ScaleRange",  NULL,  0 );
89 90
   cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod",       NULL,  2, r.modFn, "m1" );
90 91
   cmDspInst_t* kr0p = cmDspSysAllocInst(h,"Kr",          NULL,   2, krWndSmpCnt, krHopFact );
91 92
   cmDspInst_t* kr1p = cmDspSysAllocInst(h,"Kr",          NULL,   2, krWndSmpCnt, krHopFact );
@@ -105,6 +106,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
105 106
   cmDspInst_t* prd  = cmDspSysAllocInst(h,"Printer", NULL,   1, "DYN:" );
106 107
   cmDspInst_t* pre  = cmDspSysAllocInst(h,"Printer", NULL,   1, "EVEN:" );
107 108
   cmDspInst_t* prt  = cmDspSysAllocInst(h,"Printer", NULL,   1, "TEMPO:");
109
+  //cmDspInst_t* prc  = cmDspSysAllocInst(h,"Printer", NULL,   1, "COST:");
108 110
   //cmDspInst_t* prv  = cmDspSysAllocInst(h,"Printer", NULL,   1, "Value:");
109 111
   cmDspSysNewColumn(h,0);
110 112
 
@@ -136,6 +138,26 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
136 138
   cmDspInst_t* ogain = cmDspSysAllocInst(h,"Scalar", "Out Gain",   5, kNumberDuiId, 0.0,   10.0,0.01,   3.0 );  
137 139
   //cmDspInst_t* reload = cmDspSysAllocInst(h,"Button", "Reload",     2, kButtonDuiId, 0.0 );
138 140
 
141
+  cmDspInst_t* imin_dyn   = cmDspSysAllocScalar( h, "Min In Dyn",      0.0, 10.0, 1.0, 0.0);
142
+  cmDspInst_t* imax_dyn   = cmDspSysAllocScalar( h, "Max In Dyn",      0.0, 10.0, 1.0, 4.0);
143
+  cmDspInst_t* omin_dyn   = cmDspSysAllocScalar( h, "Min Out Dyn",     0.0, 100.0, 0.5, 0.0);
144
+  cmDspInst_t* omax_dyn   = cmDspSysAllocScalar( h, "Max Out Dyn",     0.0, 100.0, 0.5, 100.0);
145
+
146
+  cmDspInst_t* imin_even   = cmDspSysAllocScalar( h, "Min In Even",      0.0, 10.0, 0.01, 0.0);
147
+  cmDspInst_t* imax_even   = cmDspSysAllocScalar( h, "Max In Even",      0.0, 10.0, 0.01, 1.0);
148
+  cmDspInst_t* omin_even   = cmDspSysAllocScalar( h, "Min Out Even",     0.0, 100.0, 0.5, 0.0);
149
+  cmDspInst_t* omax_even   = cmDspSysAllocScalar( h, "Max Out Even",     0.0, 100.0, 0.5, 100.0);
150
+
151
+  cmDspInst_t* imin_tempo   = cmDspSysAllocScalar( h, "Min In Tempo",      0.0, 200.0, 1.0, 80.0);
152
+  cmDspInst_t* imax_tempo   = cmDspSysAllocScalar( h, "Max In Tempo",      0.0, 200.0, 1.0, 120.0);
153
+  cmDspInst_t* omin_tempo   = cmDspSysAllocScalar( h, "Min Out Tempo",     0.0, 100.0, 0.5, 0.0);
154
+  cmDspInst_t* omax_tempo   = cmDspSysAllocScalar( h, "Max Out Tempo",     0.0, 100.0, 0.5, 100.0);
155
+
156
+  cmDspInst_t* imin_cost   = cmDspSysAllocScalar( h, "Min In Cost",      0.0, 200.0, 1.0, 80.0);
157
+  cmDspInst_t* imax_cost   = cmDspSysAllocScalar( h, "Max In Cost",      0.0, 200.0, 1.0, 120.0);
158
+  cmDspInst_t* omin_cost   = cmDspSysAllocScalar( h, "Min Out Cost",     0.0, 100.0, 0.5, 0.0);
159
+  cmDspInst_t* omax_cost   = cmDspSysAllocScalar( h, "Max Out Cost",     0.0, 100.0, 0.5, 100.0);
160
+
139 161
 
140 162
   if((rc = cmDspSysLastRC(h)) != kOkDspRC )
141 163
     return rc;
@@ -252,7 +274,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
252 274
   cmDspSysInstallCb(h, modp, "off0", of0p, "val", NULL );
253 275
   cmDspSysInstallCb(h, modp, "inv0", iv0p, "val", NULL );
254 276
   cmDspSysInstallCb(h, modp, "wet0", wet0, "val", NULL );
255
-  cmDspSysInstallCb(h, modp, "xf0", xfad, "gate-0", NULL );
277
+  cmDspSysInstallCb(h, modp, "xf0",  xfad, "gate-0", NULL );
256 278
 
257 279
   cmDspSysInstallCb(h, modp, "mod1", md1p, "val", NULL );
258 280
   cmDspSysInstallCb(h, modp, "win1", kr1p, "wndn",NULL );
@@ -262,60 +284,89 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
262 284
   cmDspSysInstallCb(h, modp, "off1", of1p, "val", NULL );
263 285
   cmDspSysInstallCb(h, modp, "inv1", iv1p, "val", NULL );
264 286
   cmDspSysInstallCb(h, modp, "wet1", wet1, "val", NULL );
265
-  cmDspSysInstallCb(h, modp, "xf1", xfad, "gate-1", NULL );
266
-
287
+  cmDspSysInstallCb(h, modp, "xf1",  xfad, "gate-1", NULL );
288
+
289
+
290
+  cmDspSysInstallCb(h, sfp,      "dyn", srp, "val_in", NULL );
291
+  cmDspSysInstallCb(h, imin_dyn, "val", srp, "min_in",  NULL );
292
+  cmDspSysInstallCb(h, imax_dyn, "val", srp, "max_in",  NULL );
293
+  cmDspSysInstallCb(h, omin_dyn, "val", srp, "min_out", NULL );
294
+  cmDspSysInstallCb(h, omax_dyn, "val", srp, "max_out", NULL );
295
+  //cmDspSysInstallCb(h, srp, "val_out", th0p, "val", NULL );
296
+  //cmDspSysInstallCb(h, srp, "val_out", th1p, "val", NULL );
297
+
298
+  cmDspSysInstallCb(h, sfp,      "even", srp, "val_in", NULL );
299
+  cmDspSysInstallCb(h, imin_even, "val", srp, "min_in",  NULL );
300
+  cmDspSysInstallCb(h, imax_even, "val", srp, "max_in",  NULL );
301
+  cmDspSysInstallCb(h, omin_even, "val", srp, "min_out", NULL );
302
+  cmDspSysInstallCb(h, omax_even, "val", srp, "max_out", NULL );
303
+  //cmDspSysInstallCb(h, srp, "val_out", th0p, "val", NULL );
304
+  //cmDspSysInstallCb(h, srp, "val_out", th1p, "val", NULL );
305
+  
306
+  cmDspSysInstallCb(h, sfp,      "tempo", srp, "val_in", NULL );
307
+  cmDspSysInstallCb(h, imin_tempo, "val", srp, "min_in",  NULL );
308
+  cmDspSysInstallCb(h, imax_tempo, "val", srp, "max_in",  NULL );
309
+  cmDspSysInstallCb(h, omin_tempo, "val", srp, "min_out", NULL );
310
+  cmDspSysInstallCb(h, omax_tempo, "val", srp, "max_out", NULL );
311
+  //cmDspSysInstallCb(h, srp, "val_out", th0p, "val", NULL );
312
+  //cmDspSysInstallCb(h, srp, "val_out", th1p, "val", NULL );
313
+
314
+  cmDspSysInstallCb(h, sfp,      "cost", srp, "val_in", NULL );
315
+  cmDspSysInstallCb(h, imin_cost, "val", srp, "min_in",  NULL );
316
+  cmDspSysInstallCb(h, imax_cost, "val", srp, "max_in",  NULL );
317
+  cmDspSysInstallCb(h, omin_cost, "val", srp, "min_out", NULL );
318
+  cmDspSysInstallCb(h, omax_cost, "val", srp, "max_out", NULL );
319
+  //cmDspSysInstallCb(h, srp, "val_out", th0p, "val", NULL );
320
+  //cmDspSysInstallCb(h, srp, "val_out", th1p, "val", NULL );
267 321
   
322
+
268 323
   return rc;
269 324
 }
270 325
 
271
-cmDspRC_t _cmDspSysPgm_Switcher(cmDspSysH_t h, void** userPtrPtr )
272
-{
273
-  cmDspRC_t rc = kOkDspRC;
274 326
 
327
+cmDspRC_t _cmDspSysPgm_Switcher( cmDspSysH_t h, void** userPtrPtr )
328
+{
329
+  bool            useBuiltInFl = true;
275 330
   const char*     fn0          = "media/audio/20110723-Kriesberg/Audio Files/Piano 3_01.wav";
276 331
   const cmChar_t* fn           = cmFsMakeFn(cmFsUserDir(),fn0,NULL,NULL );
277 332
 
278
-  bool   bypassFl   = false;
279
-  double inGain     = 1.0;
280
-  double dsrate     = 96000.0;
281
-  double bits       = 24.0;
282
-  bool   rectifyFl  = false;
283
-  bool   fullRectFl = false;
284
-  double clipDb     = -10.0;
285
-
286
-  double cfMinHz    = 20.0;
287
-  double cfHz       = 1000.0;
288
-  double cfAlpha    = 0.9;
289
-  bool   cfFbFl     = true;
290
-  bool   cfBypassFl = false;
291
-
292
-  unsigned outChCnt = 2;
293
-  double   xfadeMs  = 250;
333
+  bool   dsBypassFl   = false;
334
+  double dsInGain     = 1.0;
335
+  double dsSrate      = 96000.0;
336
+  double dsBits       = 24.0;
337
+  bool   dsRectifyFl  = false;
338
+  bool   dsFullRectFl = false;
339
+  double dsClipDb     = -10.0;
294 340
 
341
+  double cfMinHz      = 20.0;
342
+  double cfHz         = 1000.0;
343
+  double cfAlpha      = 0.9;
344
+  bool   cfFbFl       = true;
345
+  bool   cfBypassFl   = false;
295 346
 
296
-  cmDspInst_t* gsw = cmDspSysAllocInst(h,"GSwitch", NULL, 2, 12,2 );
347
+  unsigned xfChCnt = 2;
348
+  double   xfMs    = 250;
297 349
 
298
-  cmDspInst_t* ofp =  cmDspSysAllocInst(h,"Scalar", "Offset",  5, kNumberDuiId, 0.0,  cmDspSysSampleRate(h)*600.0, 1.0,  6900000.0);
350
+  cmDspInst_t* ofp =  cmDspSysAllocInst(h,"Scalar", "Offset",  5, kNumberDuiId, 0.0,  cmDspSysSampleRate(h)*600.0, 1.0,  0.0);
299 351
   cmDspInst_t* fnp =  cmDspSysAllocInst(h,"Fname",    NULL,  3, false,"Audio Files (*.wav,*.aiff,*.aif)\tAudio Files (*.{wav,aiff,aif})",fn);
300 352
   cmDspInst_t* php =  cmDspSysAllocInst(h,"Phasor",   NULL,  0 );
301 353
   cmDspInst_t* wtp =  cmDspSysAllocInst(h,"WaveTable",NULL,  2, ((int)cmDspSysSampleRate(h)), 1 );
302
-
303
-  cmDspInst_t* dst =  cmDspSysAllocInst(h,"DistDs",   NULL, 3, bypassFl, inGain, dsrate, bits  ); 
304
-  cmDspInst_t* cf  = cmDspSysAllocInst( h,"CombFilt", NULL, 5, cfBypassFl, cfMinHz, cfFbFl, cfMinHz, cfAlpha );
305 354
   
306
-  cmDspInst_t* xfad  = cmDspSysAllocInst(h,"Xfader", NULL,    2, outChCnt, xfadeMs );
307
-
355
+  cmDspInst_t* ds  =  cmDspSysAllocInst(h,"DistDs",   NULL, 3, dsBypassFl, dsInGain, dsSrate, dsBits  ); 
356
+  cmDspInst_t* cf  = cmDspSysAllocInst( h,"CombFilt", NULL, 5, cfBypassFl, cfMinHz, cfFbFl, cfMinHz, cfAlpha );
308 357
 
309
-  cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 0 );
310
-  cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 1 );
358
+  cmDspInst_t* xfad  = cmDspSysAllocInst(h,"Xfader", NULL,    2, xfChCnt, xfMs );
311 359
 
360
+  cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, useBuiltInFl ? 0 : 2 );
361
+  cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, useBuiltInFl ? 1 : 3 );
312 362
 
363
+  
313 364
   cmDspInst_t* ign   = cmDspSysAllocScalar( h, "In Gain",      0.0, 10.0, 0.01, 1.0);
314
-  cmDspInst_t* rct   = cmDspSysAllocCheck(  h, "Rectify",   rectifyFl);
315
-  cmDspInst_t* ful   = cmDspSysAllocCheck(  h, "Full/Half", fullRectFl);
316
-  cmDspInst_t* dsr   = cmDspSysAllocScalar( h, "Srate",        0.0, 96000, 1.0, dsrate);
317
-  cmDspInst_t* dbt   = cmDspSysAllocScalar( h, "bits",         2.0,  32.0, 1.0, bits);
318
-  cmDspInst_t* clip  = cmDspSysAllocScalar( h, "Clip dB",   -100.0,   0.0, 0.1, clipDb);
365
+  cmDspInst_t* rct   = cmDspSysAllocCheck(  h, "Rectify",     dsRectifyFl);
366
+  cmDspInst_t* ful   = cmDspSysAllocCheck(  h, "Full/Half",   dsFullRectFl);
367
+  cmDspInst_t* dsr   = cmDspSysAllocScalar( h, "Srate",        0.0, 96000, 1.0, dsSrate);
368
+  cmDspInst_t* dbt   = cmDspSysAllocScalar( h, "bits",         2.0,  32.0, 1.0, dsBits);
369
+  cmDspInst_t* clip  = cmDspSysAllocScalar( h, "Clip dB",   -100.0,   0.0, 0.1, dsClipDb);
319 370
   cmDspInst_t* ogn   = cmDspSysAllocScalar( h, "Out Gain",    0.0, 10.0, 0.01, 1.0);
320 371
 
321 372
   cmDspInst_t* cfhz    = cmDspSysAllocScalar( h, "CF Hz",     25, 10000, 1, cfHz );
@@ -323,45 +374,39 @@ cmDspRC_t _cmDspSysPgm_Switcher(cmDspSysH_t h, void** userPtrPtr )
323 374
   cmDspInst_t* cfgain  = cmDspSysAllocScalar( h, "CF Gain",    0.0, 20.0, 0.001, 1.0);
324 375
   cmDspInst_t* cffb    = cmDspSysAllocInst(   h,"Button", "CF Fb",  2, kCheckDuiId, 0.0 );
325 376
 
326
-  cmDspInst_t* dfdb    = cmDspSysAllocInst(   h,"Button", "Dist Fade",  2, kCheckDuiId, 0.0 );
327
-  cmDspInst_t* cfdb    = cmDspSysAllocInst(   h,"Button", "CF Fade",  2, kCheckDuiId, 0.0 );
328
-
329
-
330
-  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
331
-    return rc;
332
-  
333
-  cmDspSysConnectAudio(h, php, "out", wtp,  "phs" );  // phasor -> wave table
377
+  cmDspInst_t* dfdb    = cmDspSysAllocInst(   h,"Button", "Dist Fader",  2, kCheckDuiId, 0.0 );
378
+  cmDspInst_t* cfdb    = cmDspSysAllocInst(   h,"Button", "CF Fade",     2, kCheckDuiId, 0.0 );
334 379
 
335
-  cmDspSysConnectAudio(h, wtp, "out",  dst,  "in" );   // wt   -> dist
336
-  cmDspSysConnectAudio(h, dst, "out",  xfad, "in-0");  // dist -> xfad
337
-  cmDspSysConnectAudio(h, xfad,"out-0",ao0p, "in" );   // xfad -> aout
338 380
 
339
-  cmDspSysConnectAudio(h, wtp, "out",  cf,   "in" );   // wt   -> xfad
340
-  cmDspSysConnectAudio(h, cf,  "out",  xfad, "in-1");  // xfad -> cf
341
-  cmDspSysConnectAudio(h, xfad,"out-1",ao1p, "in" );   // cf   -> aout 
342
-
343
-  cmDspSysInstallCb(h, ofp, "val", wtp, "beg", NULL ); // offset -> wavetable
344
-  cmDspSysInstallCb(h, fnp, "out", wtp, "fn", NULL);   // filename -> wavetable  
381
+  cmDspSysConnectAudio(h, php, "out",   wtp,  "phs" );  // phasor -> wave table
382
+  cmDspSysConnectAudio(h, wtp, "out",   cf,   "in" );
383
+  cmDspSysConnectAudio(h, cf,  "out",   xfad, "in-0" ); 
384
+  cmDspSysConnectAudio(h, xfad,"out-0", ao0p, "in");
385
+  cmDspSysConnectAudio(h, wtp, "out",   ds,   "in" );
386
+  cmDspSysConnectAudio(h, ds,  "out",   xfad, "in-1" );   // 
387
+  cmDspSysConnectAudio(h, xfad,"out-1", ao1p, "in");
345 388
 
389
+  cmDspSysInstallCb(h, ofp, "val", wtp, "beg", NULL ); 
390
+  cmDspSysInstallCb(h, fnp, "out", wtp, "fn", NULL);    
346 391
 
347 392
   // Distortion control connections
348
-  cmDspSysInstallCb(h, ign,  "val", dst, "igain", NULL );
349
-  cmDspSysInstallCb(h, dsr,  "val", dst, "srate", NULL );
350
-  cmDspSysInstallCb(h, dbt,  "val", dst, "bits", NULL );
351
-  cmDspSysInstallCb(h, rct,  "out", dst, "rect", NULL );
352
-  cmDspSysInstallCb(h, ful,  "out", dst, "full", NULL );
353
-  cmDspSysInstallCb(h, clip, "val", dst, "clip", NULL );
354
-
355
-  cmDspSysInstallCb(h, ogn,  "val", dst, "ogain", NULL );
356
-
357
-  cmDspSysInstallCb(h, cfhz,    "val", cf, "hz",    NULL );  
358
-  cmDspSysInstallCb(h, cfalpha, "val", cf, "alpha", NULL );
359
-  cmDspSysInstallCb(h, cffb,    "out", cf, "fb",    NULL );
360
-  cmDspSysInstallCb(h, cfgain,  "val", ao1p, "gain", NULL );
361
-
362
-  cmDspSysInstallCb(h, dfdb, "out", xfad, "gate-0", NULL);
363
-  cmDspSysInstallCb(h, cfdb, "out", xfad, "gate-1", NULL);
364
-
365
-  return cmDspSysLastRC(h);
393
+  cmDspSysInstallCb(h, ign,  "val", ds, "igain", NULL );
394
+  cmDspSysInstallCb(h, dsr,  "val", ds, "srate", NULL );
395
+  cmDspSysInstallCb(h, dbt,  "val", ds, "bits",  NULL );
396
+  cmDspSysInstallCb(h, rct,  "out", ds, "rect",  NULL );
397
+  cmDspSysInstallCb(h, ful,  "out", ds, "full",  NULL );
398
+  cmDspSysInstallCb(h, clip, "val", ds, "clip",  NULL );
399
+  cmDspSysInstallCb(h, ogn,  "val", ds, "ogain", NULL );
400
+
401
+  cmDspSysInstallCb(h, cfhz,    "val", cf,   "hz",    NULL );  
402
+  cmDspSysInstallCb(h, cfalpha, "val", cf,   "alpha", NULL );
403
+  cmDspSysInstallCb(h, cffb,    "out", cf,   "fb",    NULL );
404
+  cmDspSysInstallCb(h, cfgain,  "val", ao1p, "gain",  NULL );
405
+
406
+  cmDspSysInstallCb(h, cfdb, "out", xfad, "gate-0", NULL);
407
+  cmDspSysInstallCb(h, dfdb, "out", xfad, "gate-1", NULL);
408
+
409
+  return kOkDspRC;
366 410
 }
367 411
 
412
+

Loading…
Annulla
Salva