Kaynağa Gözat

cmMidiFile.c : Added cmMidiFilePrintControlNumbers().

master
Kevin Larke 10 yıl önce
ebeveyn
işleme
c79a1d592a
1 değiştirilmiş dosya ile 34 ekleme ve 1 silme
  1. 34
    1
      cmMidiFile.c

+ 34
- 1
cmMidiFile.c Dosyayı Görüntüle

@@ -1413,6 +1413,37 @@ bool cmMidiFileIsNull( cmMidiFileH_t h )
1413 1413
 void cmMidiFileTestPrint( void* printDataPtr, const char* fmt, va_list vl )
1414 1414
 { vprintf(fmt,vl); }
1415 1415
 
1416
+
1417
+void cmMidiFilePrintControlNumbers( cmCtx_t* ctx, const char* fn )
1418
+{
1419
+  cmMidiFileH_t h = cmMidiFileNullHandle;
1420
+  cmMfRC_t rc;
1421
+
1422
+  if((rc = cmMidiFileOpen(fn, &h, ctx )) != kOkMfRC )
1423
+  {
1424
+    cmErrMsg(&ctx->err,rc,"MIDI file open failed on '%s'.",fn);
1425
+    goto errLabel;
1426
+  }
1427
+
1428
+  const cmMidiTrackMsg_t** mm;
1429
+  unsigned n = cmMidiFileMsgCount(h);
1430
+  if((mm = cmMidiFileMsgArray(h)) != NULL )
1431
+  {
1432
+    unsigned j;
1433
+    for(j=0; j<n; ++j)
1434
+    {
1435
+      const cmMidiTrackMsg_t* m = mm[j];
1436
+      
1437
+      if(  m->status == kCtlMdId && m->u.chMsgPtr->d0==66 )
1438
+        printf("%i %i\n",m->u.chMsgPtr->d0,m->u.chMsgPtr->d1);
1439
+    }
1440
+  }
1441
+
1442
+ errLabel:
1443
+  cmMidiFileClose(&h);
1444
+
1445
+}
1446
+
1416 1447
 void cmMidiFileTest( const char* fn, cmCtx_t* ctx )
1417 1448
 {
1418 1449
   cmMfRC_t      rc;
@@ -1427,7 +1458,9 @@ void cmMidiFileTest( const char* fn, cmCtx_t* ctx )
1427 1458
   if(1)
1428 1459
   {
1429 1460
     //cmMidiFilePrint(h,cmMidiFileTrackCount(h)-1,&ctx->rpt);
1430
-    cmMidiFilePrint(h,cmInvalidIdx,&ctx->rpt);
1461
+    //cmMidiFilePrint(h,cmInvalidIdx,&ctx->rpt);
1462
+    cmMidiFilePrintControlNumbers(ctx, fn );
1463
+
1431 1464
   }
1432 1465
   if( 0 )
1433 1466
   {

Loading…
İptal
Kaydet