瀏覽代碼

cmDspPgm.c : Added _cmDspSysPgm_Test_Pedals().

master
kevin 8 年之前
父節點
當前提交
9aae45c663
共有 1 個檔案被更改,包括 77 行新增2 行删除
  1. 77
    2
      dsp/cmDspPgm.c

+ 77
- 2
dsp/cmDspPgm.c 查看文件

@@ -209,7 +209,7 @@ cmDspRC_t _cmDspSysPgm_MidiFilePlay( cmDspSysH_t h, void** userPtrPtr )
209 209
 
210 210
 //------------------------------------------------------------------------------
211 211
 //)
212
-//( { label:cmDspPgm_Midi_Test file_desc:"MIDI input/output example program." kw:[spgm] }
212
+//( { label:cmDspPgm_Test_Midi file_desc:"MIDI input/output example program." kw:[spgm] }
213 213
 cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
214 214
 {
215 215
   cmDspRC_t rc = kOkDspRC;
@@ -228,7 +228,7 @@ cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
228 228
 #endif
229 229
 
230 230
   cmDspInst_t* sendBtn = cmDspSysAllocInst( h,"Button", "Send",    2, kButtonDuiId, 0.0 );
231
-  cmDspInst_t* status  = cmDspSysAllocInst( h,"Scalar", "Status",  5, kNumberDuiId, 0.0,  127.0, 1.0,  144.0);
231
+  cmDspInst_t* status  = cmDspSysAllocInst( h,"Scalar", "Status",  5, kNumberDuiId, 0.0,  127.0, 1.0, 144.0);
232 232
   cmDspInst_t* d0      = cmDspSysAllocInst( h,"Scalar", "D0",      5, kNumberDuiId, 0.0,  127.0, 1.0,  64.0);
233 233
   cmDspInst_t* d1      = cmDspSysAllocInst( h,"Scalar", "D1",      5, kNumberDuiId, 0.0,  127.0, 1.0,  64.0);
234 234
   cmDspInst_t* midiOut = cmDspSysAllocInst( h,"MidiOut", NULL,     2, deviceName, portName);
@@ -263,6 +263,80 @@ cmDspRC_t _cmDspSysPgm_Test_Midi( cmDspSysH_t h, void** userPtrPtr )
263 263
 
264 264
 //------------------------------------------------------------------------------
265 265
 //)
266
+//( { label:cmDspPgm_Test_Pedals file_desc:"MIDI input/output example program." kw:[spgm] }
267
+cmDspRC_t _cmDspSysPgm_Test_Pedals( cmDspSysH_t h, void** userPtrPtr )
268
+{
269
+  cmDspRC_t rc = kOkDspRC;
270
+
271
+  //const cmChar_t* deviceName = "Fastlane";
272
+  //const cmChar_t* portName   = "Fastlane MIDI A";
273
+
274
+  const cmChar_t* deviceName = "Apple Inc. - IAC Driver";
275
+  const cmChar_t* portName   = "Bus 1";
276
+  
277
+  //deviceName = "MOTU - FastLane USB";
278
+  //portName   = "Port A";
279
+
280
+  //deviceName = "RME - Fireface UFX (23148636)";
281
+  //portName   = "Port 2";
282
+
283
+  cmDspInst_t* ai0 = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 0 );
284
+  cmDspInst_t* ai1 = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 1 );
285
+ 
286
+  cmDspInst_t* on0 = cmDspSysAllocButton( h, "Note On 1", 1.0 );
287
+  cmDspInst_t* of0 = cmDspSysAllocButton( h, "Off 1    ", 2.0 );
288
+  cmDspInst_t* on1 = cmDspSysAllocButton( h, "Note On 2", 3.0 );
289
+  cmDspInst_t* of1 = cmDspSysAllocButton( h, "Off 2    ", 4.0 );
290
+  cmDspInst_t* dm1 = cmDspSysAllocButton( h, "Damp On  ", 5.0 );
291
+  cmDspInst_t* dm0 = cmDspSysAllocButton( h, "Damp Off ", 6.0 );
292
+  cmDspInst_t* sf1 = cmDspSysAllocButton( h, "Soft On  ", 5.0 );
293
+  cmDspInst_t* sf0 = cmDspSysAllocButton( h, "Soft Off ", 6.0 );
294
+  cmDspInst_t* so1 = cmDspSysAllocButton( h, "Sost On  ", 5.0 );
295
+  cmDspInst_t* so0 = cmDspSysAllocButton( h, "Sost Off ", 6.0 );
296
+  
297
+  cmDspInst_t* lst = cmDspSysAllocInst(   h, "MsgList","Seq", 1, "note_list");  
298
+  cmDspInst_t* mop = cmDspSysAllocInst(   h, "MidiOut",  NULL, 2, deviceName, portName);
299
+
300
+  cmDspInst_t* ao0 = cmDspSysAllocInst(h,"AudioOut", NULL,   1, 2 );
301
+  cmDspInst_t* ao1 = cmDspSysAllocInst(h,"AudioOut", NULL,   1, 3 );
302
+  
303
+  //cmDspInst_t* prt = cmDspSysAllocInst( h,"Printer", NULL, 1, "" );
304
+  
305
+  // check for allocation errors
306
+  if((rc = cmDspSysLastRC(h)) != kOkDspRC )
307
+    goto errLabel;
308
+
309
+  cmDspSysConnectAudio( h, ai0, "out", ao0, "in" );
310
+  cmDspSysConnectAudio( h, ai1, "out", ao1, "in" );
311
+  
312
+  cmDspSysInstallCb(  h, on0, "out", lst, "sel", NULL );
313
+  cmDspSysInstallCb(  h, of0, "out", lst, "sel", NULL );
314
+  cmDspSysInstallCb(  h, on1, "out", lst, "sel", NULL );
315
+  cmDspSysInstallCb(  h, of1, "out", lst, "sel", NULL );
316
+  cmDspSysInstallCb(  h, dm1, "out", lst, "sel", NULL );
317
+  cmDspSysInstallCb(  h, dm0, "out", lst, "sel", NULL );
318
+  cmDspSysInstallCb(  h, sf1, "out", lst, "sel", NULL );
319
+  cmDspSysInstallCb(  h, sf0, "out", lst, "sel", NULL );
320
+  cmDspSysInstallCb(  h, so1, "out", lst, "sel", NULL );
321
+  cmDspSysInstallCb(  h, so0, "out", lst, "sel", NULL );
322
+
323
+  //cmDspSysInstallCb(   h, lst,     "d1",     prt,     "in", NULL );
324
+  //cmDspSysInstallCb(   h, lst,     "d0",     prt,     "in", NULL );
325
+  //cmDspSysInstallCb(   h, lst,     "status", prt,     "in", NULL );
326
+
327
+
328
+  cmDspSysInstallCb(   h, lst,  "d1",     mop, "d1",     NULL);
329
+  cmDspSysInstallCb(   h, lst,  "d0",     mop, "d0",     NULL);
330
+  cmDspSysInstallCb(   h, lst,  "status", mop, "status", NULL);
331
+  
332
+
333
+ errLabel:
334
+  return rc;
335
+  
336
+}
337
+
338
+//------------------------------------------------------------------------------
339
+//)
266 340
 //( { label:cmDspPgm_Stereo_Through file_desc:"Stereo audio through example program." kw:[spgm] }
267 341
 cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
268 342
 {
@@ -3167,6 +3241,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] =
3167 3241
   { "pickups",     _cmDspSysPgm_Pickups0,       NULL, NULL },
3168 3242
   { "sync_recd",   _cmDspSysPgm_SyncRecd,       NULL, NULL },
3169 3243
   { "midi_test",   _cmDspSysPgm_Test_Midi,      NULL, NULL },
3244
+  { "pedal_test",  _cmDspSysPgm_Test_Pedals,    NULL, NULL },
3170 3245
   { "midi_file",   _cmDspSysPgm_MidiFilePlay,   NULL, NULL },
3171 3246
   { "2_thru",      _cmDspSysPgm_Stereo_Through, NULL, NULL },
3172 3247
   { "guitar",      _cmDspSysPgmGuitar,          NULL, NULL },

Loading…
取消
儲存