Browse Source

cmMidiFilePlay.c : Fixed bug where cmMfpClock() was not using the correct dtick time.

master
kevin 9 years ago
parent
commit
69f364a5fc
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      cmMidiFilePlay.c

+ 7
- 2
cmMidiFilePlay.c View File

226
     
226
     
227
     
227
     
228
     p->cbFunc( p->userCbPtr, p->mtime, mp );
228
     p->cbFunc( p->userCbPtr, p->mtime, mp );
229
-      
229
+
230
+    unsigned atick0 = mp->atick;
231
+    
230
     ++(p->msgIdx);
232
     ++(p->msgIdx);
231
 
233
 
232
     if( p->msgIdx >= p->msgN )
234
     if( p->msgIdx >= p->msgN )
235
     // get the next msg to send
237
     // get the next msg to send
236
     mp        = p->msgV[p->msgIdx];
238
     mp        = p->msgV[p->msgIdx];
237
 
239
 
240
+    assert( mp->atick >= atick0 );
241
+    unsigned dtick = mp->atick - atick0;
242
+
238
     // we probably went past the actual mtime - so update etime
243
     // we probably went past the actual mtime - so update etime
239
     // with the delta usecs from the msg just sent and the current time
244
     // with the delta usecs from the msg just sent and the current time
240
     p->etime -= p->mtime;
245
     p->etime -= p->mtime;
241
 
246
 
242
     // calc the delta usecs from the message just sent to the next msg to send
247
     // calc the delta usecs from the message just sent to the next msg to send
243
     //p->mtime  = (mp->tick - p->msgV[p->msgIdx-1]->tick) * p->microsPerTick;
248
     //p->mtime  = (mp->tick - p->msgV[p->msgIdx-1]->tick) * p->microsPerTick;
244
-    p->mtime  = mp->dtick * p->microsPerTick;
249
+    p->mtime  = dtick * p->microsPerTick;
245
 
250
 
246
   }
251
   }
247
 
252
 

Loading…
Cancel
Save