Browse Source

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 years ago
parent
commit
ab9f8c0caa
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      cmProc4.c

+ 8
- 5
cmProc4.c View File

323
     return ret_idx;
323
     return ret_idx;
324
   }
324
   }
325
 
325
 
326
-  if( status != kNoteOnMdId )
326
+  if( (status&0xf0) != kNoteOnMdId )
327
     return ret_idx;
327
     return ret_idx;
328
 
328
 
329
   ++p->eventIdx;
329
   ++p->eventIdx;
721
 
721
 
722
   //cmScFolExec(p->sfp, smpIdx, status, d0, d1);
722
   //cmScFolExec(p->sfp, smpIdx, status, d0, d1);
723
 
723
 
724
-  if( status != kNoteOnMdId )
724
+  if( (status&0xf0) != kNoteOnMdId )
725
     return cmInvalidIdx;
725
     return cmInvalidIdx;
726
 
726
 
727
   if( p->curLocIdx == cmInvalidIdx )
727
   if( p->curLocIdx == cmInvalidIdx )
2018
 
2018
 
2019
 bool cmScMatcherInputMidi(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 )
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
     return false;
2025
     return false;
2023
 
2026
 
2024
   unsigned mi = p->mn-1;
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
   // shift the new MIDI event onto the end of the MIDI buffer
2031
   // shift the new MIDI event onto the end of the MIDI buffer
2029
   memmove(p->midiBuf, p->midiBuf+1, sizeof(cmScMatchMidi_t)*mi);
2032
   memmove(p->midiBuf, p->midiBuf+1, sizeof(cmScMatchMidi_t)*mi);
3209
       break;
3212
       break;
3210
 
3213
 
3211
     // if the time line MIDI msg a note-on
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
       rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );
3217
       rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );
3215
 
3218
 

Loading…
Cancel
Save