Browse Source

cmTakeSeqBldr.c : Added 'muid' to cmScTrkMidiTsb_t.

Fixed bug in _cmTsbScoreTrkFree().
master
Kevin Larke 9 years ago
parent
commit
9b86614e57
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      app/cmTakeSeqBldr.c

+ 9
- 4
app/cmTakeSeqBldr.c View File

@@ -21,7 +21,8 @@
21 21
 // Score track record: Map a score event to a MIDI event. 
22 22
 typedef struct cmScTrkMidiTsb_str
23 23
 {
24
-  unsigned mni;      // midi note index as an offset from the take marker
24
+  unsigned mni;      // MIDI note index as an offset from the take marker
25
+  unsigned muid;     // MIDI file msg  unique id
25 26
   unsigned scEvtIdx; // score event index this not is assoc'd with or -1 if it did not match
26 27
   unsigned flags;    // flags from cmScMatcherResult_t 
27 28
 } cmScTrkMidiTsb_t;
@@ -114,10 +115,13 @@ cmTsbRC_t _cmTsbScoreTrkFree( cmTsb_t* p )
114 115
     goto errLabel;
115 116
   }
116 117
   
117
-  for(i=0; i<p->scTrkTakeN; ++i)
118
-    cmMemPtrFree(&p->scTrkTakeV[i].midiV);
118
+  if( p->scTrkTakeV != NULL )
119
+  {
120
+    for(i=0; i<p->scTrkTakeN; ++i)
121
+      cmMemPtrFree(&p->scTrkTakeV[i].midiV);
119 122
 
120
-  cmMemPtrFree(&p->scTrkTakeV);
123
+    cmMemPtrFree(&p->scTrkTakeV);
124
+  }
121 125
 
122 126
   if( cmTimeLineFinalize(&p->tlH) != kOkTlRC )
123 127
     rc = cmErrMsg(&p->err,kTimeLineFailTsbRC,"Time line object finalize failed.");
@@ -231,6 +235,7 @@ cmTsbRC_t _cmTsbLoadScoreTrkFile( cmTsb_t* p, const cmChar_t* scoreTrkFn )
231 235
       // parse the note record
232 236
       if((jsRC = cmJsonMemberValues( noteObj, &errMsg,
233 237
             "mni",      kIntTId, &p->scTrkTakeV[i].midiV[j].mni,
238
+            "muid",     kIntTId, &p->scTrkTakeV[i].midiV[j].muid,
234 239
             "scEvtIdx", kIntTId, &p->scTrkTakeV[i].midiV[j].scEvtIdx,
235 240
             "flags",    kIntTId, &p->scTrkTakeV[i].midiV[j].flags,
236 241
             NULL)) != kOkJsRC )

Loading…
Cancel
Save