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

This commit is contained in:
kevin 2015-11-19 12:26:47 -05:00
parent 04bfa83e38
commit 69f364a5fc

View File

@ -227,6 +227,8 @@ cmMfpRC_t cmMfpClock( cmMfpH_t h, unsigned dusecs )
p->cbFunc( p->userCbPtr, p->mtime, mp ); p->cbFunc( p->userCbPtr, p->mtime, mp );
unsigned atick0 = mp->atick;
++(p->msgIdx); ++(p->msgIdx);
if( p->msgIdx >= p->msgN ) if( p->msgIdx >= p->msgN )
@ -235,13 +237,16 @@ cmMfpRC_t cmMfpClock( cmMfpH_t h, unsigned dusecs )
// get the next msg to send // get the next msg to send
mp = p->msgV[p->msgIdx]; mp = p->msgV[p->msgIdx];
assert( mp->atick >= atick0 );
unsigned dtick = mp->atick - atick0;
// we probably went past the actual mtime - so update etime // we probably went past the actual mtime - so update etime
// with the delta usecs from the msg just sent and the current time // with the delta usecs from the msg just sent and the current time
p->etime -= p->mtime; p->etime -= p->mtime;
// calc the delta usecs from the message just sent to the next msg to send // calc the delta usecs from the message just sent to the next msg to send
//p->mtime = (mp->tick - p->msgV[p->msgIdx-1]->tick) * p->microsPerTick; //p->mtime = (mp->tick - p->msgV[p->msgIdx-1]->tick) * p->microsPerTick;
p->mtime = mp->dtick * p->microsPerTick; p->mtime = dtick * p->microsPerTick;
} }