Selaa lähdekoodia

cmProc4.h/c : The cmMidiTrackMsg_t.uid identifier of note-on messages

fed to cmScMatcher are now tracked along with the note.  This allows score events
to be definitevly matched to a particular note-on event when the event
comes from a MIDI file.
master
Kevin Larke 9 vuotta sitten
vanhempi
commit
cf8c6af27f
2 muutettua tiedostoa jossa 10 lisäystä ja 5 poistoa
  1. 5
    4
      cmProc4.c
  2. 5
    1
      cmProc4.h

+ 5
- 4
cmProc4.c Näytä tiedosto

@@ -1275,7 +1275,7 @@ cmRC_t cmScMatcherReset( cmScMatcher* p, unsigned scLocIdx )
1275 1275
   return cmOkRC;
1276 1276
 }
1277 1277
 
1278
-bool cmScMatcherInputMidi(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 )
1278
+bool cmScMatcherInputMidi(  cmScMatcher* p, unsigned smpIdx, unsigned muid, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 )
1279 1279
 {
1280 1280
   if( (status&0xf0) != kNoteOnMdId)
1281 1281
     return false;
@@ -1293,6 +1293,7 @@ bool cmScMatcherInputMidi(  cmScMatcher* p, unsigned smpIdx, unsigned status, cm
1293 1293
   p->midiBuf[mi].scEvtIdx = cmInvalidIdx;
1294 1294
   p->midiBuf[mi].mni      = p->mni++;
1295 1295
   p->midiBuf[mi].smpIdx   = smpIdx;
1296
+  p->midiBuf[mi].muid     = muid;
1296 1297
   p->midiBuf[mi].pitch    = d0;
1297 1298
   p->midiBuf[mi].vel      = d1;
1298 1299
   if( p->mbi > 0 )
@@ -1503,7 +1504,7 @@ cmRC_t     cmScMatcherStep(  cmScMatcher* p )
1503 1504
   return cmOkRC;
1504 1505
 }
1505 1506
 
1506
-cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr )
1507
+cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned muid, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr )
1507 1508
 {
1508 1509
   bool     fl  = p->mbi > 0;
1509 1510
   cmRC_t   rc  = cmOkRC;
@@ -1513,7 +1514,7 @@ cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned status, c
1513 1514
     *scLocIdxPtr = cmInvalidIdx;
1514 1515
 
1515 1516
   // update the MIDI buffer with the incoming note
1516
-  if( cmScMatcherInputMidi(p,smpIdx,status,d0,d1) == false )
1517
+  if( cmScMatcherInputMidi(p,smpIdx,muid,status,d0,d1) == false )
1517 1518
     return rc;
1518 1519
 
1519 1520
   // if the MIDI buffer transitioned to full then perform an initial scan sync.
@@ -2485,7 +2486,7 @@ cmRC_t cmScAlignScanToTimeLineEvent( cmScMatcher* p, cmTlH_t tlH, cmTlObj_t* top
2485 2486
     // if the time line MIDI msg a note-on
2486 2487
     if( (mep->msg->status&0xf0) == kNoteOnMdId )
2487 2488
     {
2488
-      rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );
2489
+      rc = cmScMatcherExec(p, mep->obj.seqSmpIdx, mep->msg->uid, mep->msg->status, mep->msg->u.chMsgPtr->d0, mep->msg->u.chMsgPtr->d1, NULL );
2489 2490
 
2490 2491
       switch( rc )
2491 2492
       {

+ 5
- 1
cmProc4.h Näytä tiedosto

@@ -145,6 +145,7 @@ extern "C" {
145 145
   typedef struct
146 146
   {
147 147
     unsigned mni;    // unique identifier for this MIDI note - used to recognize when the cmScMatcher backtracks.
148
+    unsigned muid;   // MIDI file event msg unique id (See cmMidiTrackMsg_t.uid)
148 149
     unsigned smpIdx; // time stamp of this event
149 150
     unsigned pitch;  // MIDI note pitch
150 151
     unsigned vel;    //  "    "   velocity
@@ -208,6 +209,7 @@ extern "C" {
208 209
     unsigned scEvtIdx;  // score event index 
209 210
     unsigned mni;       // index of the performed MIDI event associated with this score location
210 211
     unsigned smpIdx;    // sample time index of performed MIDI event
212
+    unsigned muid;      // MIDI file event msg unique id (See cmMidiTrackMsg_t.uid)
211 213
     unsigned pitch;     // performed pitch 
212 214
     unsigned vel;       // performed velocity
213 215
     unsigned flags;     // smTruePosFl | smFalsePosFl 
@@ -297,12 +299,14 @@ extern "C" {
297 299
   // will be set with the matched scLocIdx of the match.
298 300
   // If this call does not result in a successful match *scLocIdxPtr is set
299 301
   // to cmInvalidIdx.
302
+  // 'muid' is the unique id associated with this MIDI event under the circumstances
303
+  // that the event came from a MIDI file.  See cmMidiFile.h cmMidiTrackMsg_t.uid.
300 304
   // Return:
301 305
   // cmOkRC  - Continue processing MIDI events.
302 306
   // cmEofRC - The end of the score was encountered.
303 307
   // cmInvalidArgRC - scan failed or the object was in an invalid state to attempt a match.
304 308
   // cmSubSysFailRC - a scan resync failed in cmScMatcherStep().
305
-  cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr );
309
+  cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned muid, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr );
306 310
 
307 311
   void cmScMatcherPrint( cmScMatcher* p );
308 312
 

Loading…
Peruuta
Tallenna