cmMidiFile.c : Remove offset at beginning of each MIDI file by default.

This commit is contained in:
kevin 2016-04-14 19:37:56 -04:00
parent d1b77e9f7e
commit 9088a7bb22

View File

@ -430,6 +430,7 @@ void _cmMidiFileSetAccumulateTicks( _cmMidiFile_t* p )
cmMidiTrackMsg_t* nextTrkMsg[ p->trkN ]; // next msg in each track cmMidiTrackMsg_t* nextTrkMsg[ p->trkN ]; // next msg in each track
unsigned long long atick = 0; unsigned long long atick = 0;
unsigned i; unsigned i;
bool fl = true;
// iniitalize nextTrkTick[] and nextTrkMsg[]. // iniitalize nextTrkTick[] and nextTrkMsg[].
for(i=0; i<p->trkN; ++i) for(i=0; i<p->trkN; ++i)
@ -449,6 +450,13 @@ void _cmMidiFileSetAccumulateTicks( _cmMidiFile_t* p )
if( k == cmInvalidIdx ) if( k == cmInvalidIdx )
break; break;
if( fl && nextTrkMsg[k]->dtick > 0 )
{
fl = false;
nextTrkMsg[k]->dtick = 1;
nextTrkMsg[k]->atick = 1;
}
// store the current atick // store the current atick
atick = nextTrkMsg[k]->atick; atick = nextTrkMsg[k]->atick;
@ -1243,7 +1251,7 @@ void cmMidiFileCalcNoteDurations( cmMidiFileH_t h )
if( sustainPedalDownMsg != NULL ) if( sustainPedalDownMsg != NULL )
{ {
// TODO: the correct way to handle this is to maintain multiple sustain pedals // TODO: the correct way to handle this is to maintain multiple sustain pedals
cmErrMsg(&p->err,kSustainPedalMfRC,"Sustain pedal down with no intervening sustain pedal up."); //cmErrMsg(&p->err,kSustainPedalMfRC,"Sustain pedal down with no intervening sustain pedal up.");
} }
else else
{ {