From ab9f8c0caa2148442bc1a93835630eb4c766500d Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 3 Nov 2013 13:42:40 -0800 Subject: [PATCH] cmProc4.c : cmScMatcherMidiInput() now masks off the status byte channel bits and checks for non-zero velocity when looking for note-on messages. --- cmProc4.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmProc4.c b/cmProc4.c index 7e63acc..fb48fba 100644 --- a/cmProc4.c +++ b/cmProc4.c @@ -323,7 +323,7 @@ unsigned cmScFolExec( cmScFol* p, unsigned smpIdx, unsigned status, cmMidiByt return ret_idx; } - if( status != kNoteOnMdId ) + if( (status&0xf0) != kNoteOnMdId ) return ret_idx; ++p->eventIdx; @@ -721,7 +721,7 @@ unsigned cmScTrkExec( cmScTrk* p, unsigned smpIdx, unsigned status, cmMidiByte_ //cmScFolExec(p->sfp, smpIdx, status, d0, d1); - if( status != kNoteOnMdId ) + if( (status&0xf0) != kNoteOnMdId ) return cmInvalidIdx; if( p->curLocIdx == cmInvalidIdx ) @@ -2018,12 +2018,15 @@ cmRC_t cmScMatcherReset( cmScMatcher* p, unsigned scLocIdx ) bool cmScMatcherInputMidi( cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 ) { - if( status != kNoteOnMdId ) + if( (status&0xf0) != kNoteOnMdId) + return false; + + if( d1 == 0 ) return false; unsigned mi = p->mn-1; - //printf("%3i %5.2f %4s\n",p->mni,(double)smpIdx/p->srate,cmMidiToSciPitch(d0,NULL,0)); + //printf("%3i %4s\n",p->mni,cmMidiToSciPitch(d0,NULL,0)); // shift the new MIDI event onto the end of the MIDI buffer 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 break; // if the time line MIDI msg a note-on - if( mep->msg->status == kNoteOnMdId ) + if( (mep->msg->status&0xf0) == kNoteOnMdId ) { rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );