From 9088a7bb2261d6eb996c4ad47d24bfca9b5f3363 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 14 Apr 2016 19:37:56 -0400 Subject: [PATCH] cmMidiFile.c : Remove offset at beginning of each MIDI file by default. --- cmMidiFile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 {