Преглед на файлове

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

master
kevin преди 9 години
родител
ревизия
69f364a5fc
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. 7
    2
      cmMidiFilePlay.c

+ 7
- 2
cmMidiFilePlay.c Целия файл

@@ -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…
Отказ
Запис