Sfoglia il codice sorgente

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

master
kevin 9 anni fa
parent
commit
69f364a5fc
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7
    2
      cmMidiFilePlay.c

+ 7
- 2
cmMidiFilePlay.c Vedi File

@@ -226,7 +226,9 @@ cmMfpRC_t cmMfpClock(  cmMfpH_t h, unsigned dusecs )
226 226
     
227 227
     
228 228
     p->cbFunc( p->userCbPtr, p->mtime, mp );
229
-      
229
+
230
+    unsigned atick0 = mp->atick;
231
+    
230 232
     ++(p->msgIdx);
231 233
 
232 234
     if( p->msgIdx >= p->msgN )
@@ -235,13 +237,16 @@ cmMfpRC_t cmMfpClock(  cmMfpH_t h, unsigned dusecs )
235 237
     // get the next msg to send
236 238
     mp        = p->msgV[p->msgIdx];
237 239
 
240
+    assert( mp->atick >= atick0 );
241
+    unsigned dtick = mp->atick - atick0;
242
+
238 243
     // we probably went past the actual mtime - so update etime
239 244
     // with the delta usecs from the msg just sent and the current time
240 245
     p->etime -= p->mtime;
241 246
 
242 247
     // calc the delta usecs from the message just sent to the next msg to send
243 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…
Annulla
Salva