Bläddra i källkod

cmDspPgm.c : Added _cmDspSysPgm_All_In_And_Out() and other minor changes to test Focusrite audio interface.

master
kevin.larke 4 år sedan
förälder
incheckning
d4af37682b
1 ändrade filer med 56 tillägg och 7 borttagningar
  1. 56
    7
      dsp/cmDspPgm.c

+ 56
- 7
dsp/cmDspPgm.c Visa fil

@@ -128,13 +128,18 @@ cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
128 128
 {
129 129
   
130 130
   cmDspRC_t rc = kOkDspRC;
131
+
132
+
133
+  //const cmChar_t* deviceName = "Scarlett 18i20 USB";
134
+  //const cmChar_t* portName   = "Scarlett 18i20 USB MIDI 1";
135
+  
131 136
   const cmChar_t* deviceName = "Fastlane";
132 137
   const cmChar_t* portName   = "Fastlane MIDI A";
133 138
 
134 139
   //const cmChar_t* deviceName = "DKV-M4";
135 140
   //const cmChar_t* portName   = "DKV-M4 MIDI 1";
136 141
 
137
-  const char*     fn0   = "media/midi/kriesberg/part2/piano_score_part_2_draft_1_master_m191-195.mid";
142
+  const char*     fn0   = "media/audio/midi/988-v25.mid";
138 143
   const cmChar_t* fn    = cmFsMakeFn(cmFsUserDir(),fn0,NULL,NULL );
139 144
   cmDspInst_t* fnp =  cmDspSysAllocInst(h,"Fname",    NULL,  3, false,"MIDI Files (*.mid)\tMIDI Files (*.{mid})",fn);
140 145
 
@@ -155,12 +160,16 @@ cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
155 160
    
156 161
   cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 0 );
157 162
   cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 1 );
163
+  cmDspInst_t* ao2p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 2 );
164
+  cmDspInst_t* ao3p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 3 );
158 165
 
159 166
   cmDspInst_t* im0p = cmDspSysAllocInst(h,"AMeter","In 0",  0);
160 167
   cmDspInst_t* im1p = cmDspSysAllocInst(h,"AMeter","In 1", 0);
161 168
 
162 169
   cmDspInst_t* om0p = cmDspSysAllocInst(h,"AMeter","Out 0", 0);
163 170
   cmDspInst_t* om1p = cmDspSysAllocInst(h,"AMeter","Out 1",0);
171
+  cmDspInst_t* om2p = cmDspSysAllocInst(h,"AMeter","Out 2", 0);
172
+  cmDspInst_t* om3p = cmDspSysAllocInst(h,"AMeter","Out 3",0);
164 173
 
165 174
 
166 175
   // check for allocation errors
@@ -199,6 +208,12 @@ cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
199 208
   cmDspSysConnectAudio(h, ai1p,"out", ao1p, "in" );         // ain1  -> aout1 
200 209
   cmDspSysConnectAudio(h, ai1p,"out", om1p, "in" );         // ain1  -> omtr1 
201 210
 
211
+  cmDspSysConnectAudio(h, ai0p,"out", ao2p, "in" );         // ain0  -> aout2 
212
+  cmDspSysConnectAudio(h, ai0p,"out", om2p, "in" );         // ain0  -> omtr0
213
+  
214
+  cmDspSysConnectAudio(h, ai1p,"out", ao3p, "in" );         // ain1  -> aout3 
215
+  cmDspSysConnectAudio(h, ai1p,"out", om3p, "in" );         // ain0  -> omtr0 
216
+  
202 217
  errLabel:
203 218
 
204 219
   cmFsFreeFn(fn);
@@ -348,8 +363,8 @@ cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
348 363
   cmDspInst_t* php =  cmDspSysAllocInst(h,"Phasor",   NULL,  0 );
349 364
   cmDspInst_t* wtp =  cmDspSysAllocInst(h,"WaveTable",NULL,  2, cmDspSysSampleRate(h), 2 );
350 365
 
351
-  cmDspInst_t* ai0p = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 0 );
352
-  cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 1 );
366
+  cmDspInst_t* ai0p = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 2 );
367
+  cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 3 );
353 368
    
354 369
   // MOTU Traveler: Use channels 2&3 (out plugs:3&4) because 0&1 do not show up on plugs 1&2.
355 370
   cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 2 );
@@ -387,6 +402,39 @@ cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
387 402
   return kOkDspRC;
388 403
 }
389 404
 
405
+
406
+cmDspRC_t _cmDspSysPgm_All_In_And_Out( cmDspSysH_t h, void** userPtrPtr )
407
+{
408
+  cmDspInst_t* ignp = cmDspSysAllocInst( h,"Scalar", "In Gain",  5, kNumberDuiId, 0.0,  4.0, 0.01,  1.0);
409
+
410
+  const unsigned inN = 18;
411
+
412
+  cmDspInst_t* ainA[inN];
413
+  cmDspInst_t* aoutA[inN];
414
+  cmDspInst_t* imtrA[inN];
415
+  
416
+  int i;
417
+  for(i=0;i<inN; ++i)
418
+  {
419
+    char label[32];
420
+    snprintf(label,32,"in %i",i);
421
+    ainA[i]  = cmDspSysAllocInst(h,"AudioIn", NULL,   1, i );
422
+    imtrA[i] = cmDspSysAllocInst(h,"AMeter",label,  0);
423
+    aoutA[i]  = cmDspSysAllocInst(h,"AudioOut", NULL,   1, i );
424
+  }
425
+
426
+  for(i=0; i<inN; ++i)
427
+  {
428
+    cmDspSysInstallCb(   h, ignp,   "val", ainA[i], "gain", NULL);  // igain -> ain
429
+    cmDspSysConnectAudio(h, ainA[i],"out", imtrA[i], "in" );         // ain  -> imtr 
430
+    cmDspSysConnectAudio(h, ainA[i],"out", aoutA[i], "in" );         // ain  -> aout 
431
+  }
432
+
433
+
434
+  return kOkDspRC;
435
+}
436
+
437
+
390 438
 //------------------------------------------------------------------------------
391 439
 //)
392 440
 //( { label:cmDspPgm_Stereo_Fx file_desc:"Stereo audio effects example program." kw:[spgm] }
@@ -463,7 +511,7 @@ cmDspRC_t _cmDspSysPgm_Stereo_Fx( cmDspSysH_t h, void** userPtrPtr )
463 511
 //( { label:cmDspPgm_PlaySine file_desc:"Play a sine signal." kw:[spgm] }
464 512
 cmDspRC_t _cmDspSysPgm_PlaySine( cmDspSysH_t h, void** userPtrPtr )
465 513
 {
466
-  bool useBuiltInFl = true;
514
+  bool useBuiltInFl = false;
467 515
   double frqHz = 440.0;
468 516
 
469 517
   cmDspInst_t* chp = cmDspSysAllocInst( h,"Scalar", "Channel",  5, kNumberDuiId, 0.0,  100.0, 1.0,  0.0);
@@ -867,8 +915,8 @@ cmDspRC_t _cmDspSysPgm_UiTest(cmDspSysH_t h, void** userPtrPtr )
867 915
 cmDspRC_t _cmDspSysPgm_Xfade( cmDspSysH_t h, void** userPtrPtr )
868 916
 {
869 917
   cmDspRC_t rc         = kOkDspRC;
870
-  unsigned  leftChIdx  = 0;
871
-  unsigned  rightChIdx = 1;
918
+  unsigned  leftChIdx  = 2;
919
+  unsigned  rightChIdx = 3;
872 920
   unsigned  chCnt      = 2;
873 921
   double    xfadeMs    = 1000;  // cross fade time
874 922
   double    sgHz       = 500;
@@ -3208,7 +3256,7 @@ cmDspRC_t _cmDspSysPgm_BinEnc( cmDspSysH_t h, void** userPtrPtr )
3208 3256
 _cmDspSysPgm_t _cmDspSysPgmArray[] = 
3209 3257
 {
3210 3258
   { "reflect",       _cmDspSysPgm_ReflectCalc,  NULL, NULL },
3211
-  { "tksblite",     _cmDspSysPgm_TksbLite,     NULL, NULL }, 
3259
+  { "tksblite",      _cmDspSysPgm_TksbLite,     NULL, NULL }, 
3212 3260
   { "tksb",          _cmDspSysPgm_Tksb,         NULL, NULL },
3213 3261
   { "time_line",     _cmDspSysPgm_TimeLine,     NULL, NULL },
3214 3262
   { "time_line_lite",_cmDspSysPgm_TimeLineLite, NULL, NULL },  
@@ -3244,6 +3292,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] =
3244 3292
   { "pedal_test",  _cmDspSysPgm_Test_Pedals,    NULL, NULL },
3245 3293
   { "midi_file",   _cmDspSysPgm_MidiFilePlay,   NULL, NULL },
3246 3294
   { "2_thru",      _cmDspSysPgm_Stereo_Through, NULL, NULL },
3295
+  { "all_in_out",  _cmDspSysPgm_All_In_And_Out, NULL, NULL },
3247 3296
   { "guitar",      _cmDspSysPgmGuitar,          NULL, NULL },
3248 3297
   { "2_fx",        _cmDspSysPgm_Stereo_Fx,      NULL, NULL },
3249 3298
   { "sine",        _cmDspSysPgm_PlaySine,       NULL, NULL },

Laddar…
Avbryt
Spara