diff --git a/cmMidiFile.c b/cmMidiFile.c index 9f40402..af73675 100644 --- a/cmMidiFile.c +++ b/cmMidiFile.c @@ -430,6 +430,7 @@ void _cmMidiFileSetAccumulateTicks( _cmMidiFile_t* p ) cmMidiTrackMsg_t* nextTrkMsg[ p->trkN ]; // next msg in each track unsigned long long atick = 0; unsigned i; + bool fl = true; // iniitalize nextTrkTick[] and nextTrkMsg[]. for(i=0; itrkN; ++i) @@ -449,6 +450,13 @@ void _cmMidiFileSetAccumulateTicks( _cmMidiFile_t* p ) if( k == cmInvalidIdx ) break; + if( fl && nextTrkMsg[k]->dtick > 0 ) + { + fl = false; + nextTrkMsg[k]->dtick = 1; + nextTrkMsg[k]->atick = 1; + } + // store the current atick atick = nextTrkMsg[k]->atick; @@ -1243,7 +1251,7 @@ void cmMidiFileCalcNoteDurations( cmMidiFileH_t h ) if( sustainPedalDownMsg != NULL ) { // 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 {