Просмотр исходного кода

cmProc4.c : cmScMatcherMidiInput() now masks off the status byte channel

bits and checks for non-zero velocity when looking for note-on messages.
master
kevin 11 лет назад
Родитель
Сommit
ab9f8c0caa
1 измененных файлов: 8 добавлений и 5 удалений
  1. 8
    5
      cmProc4.c

+ 8
- 5
cmProc4.c Просмотреть файл

@@ -323,7 +323,7 @@ unsigned   cmScFolExec(  cmScFol* p, unsigned smpIdx, unsigned status, cmMidiByt
323 323
     return ret_idx;
324 324
   }
325 325
 
326
-  if( status != kNoteOnMdId )
326
+  if( (status&0xf0) != kNoteOnMdId )
327 327
     return ret_idx;
328 328
 
329 329
   ++p->eventIdx;
@@ -721,7 +721,7 @@ unsigned cmScTrkExec(  cmScTrk* p, unsigned smpIdx, unsigned status, cmMidiByte_
721 721
 
722 722
   //cmScFolExec(p->sfp, smpIdx, status, d0, d1);
723 723
 
724
-  if( status != kNoteOnMdId )
724
+  if( (status&0xf0) != kNoteOnMdId )
725 725
     return cmInvalidIdx;
726 726
 
727 727
   if( p->curLocIdx == cmInvalidIdx )
@@ -2018,12 +2018,15 @@ cmRC_t cmScMatcherReset( cmScMatcher* p, unsigned scLocIdx )
2018 2018
 
2019 2019
 bool cmScMatcherInputMidi(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 )
2020 2020
 {
2021
-  if( status != kNoteOnMdId )
2021
+  if( (status&0xf0) != kNoteOnMdId)
2022
+    return false;
2023
+
2024
+  if( d1 == 0 )
2022 2025
     return false;
2023 2026
 
2024 2027
   unsigned mi = p->mn-1;
2025 2028
 
2026
-  //printf("%3i %5.2f %4s\n",p->mni,(double)smpIdx/p->srate,cmMidiToSciPitch(d0,NULL,0));
2029
+  //printf("%3i %4s\n",p->mni,cmMidiToSciPitch(d0,NULL,0));
2027 2030
 
2028 2031
   // shift the new MIDI event onto the end of the MIDI buffer
2029 2032
   memmove(p->midiBuf, p->midiBuf+1, sizeof(cmScMatchMidi_t)*mi);
@@ -3209,7 +3212,7 @@ cmRC_t cmScAlignScanToTimeLineEvent( cmScMatcher* p, cmTlH_t tlH, cmTlObj_t* top
3209 3212
       break;
3210 3213
 
3211 3214
     // if the time line MIDI msg a note-on
3212
-    if( mep->msg->status == kNoteOnMdId )
3215
+    if( (mep->msg->status&0xf0) == kNoteOnMdId )
3213 3216
     {
3214 3217
       rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );
3215 3218
 

Загрузка…
Отмена
Сохранить