Bug 1707 - MIDI Loop Play misses first few notes on looping.

The problem was that Audacity did not refill its buffers until the note-off of the last note played.  That was (in the James Bond case) 2.9s after the end of the loop.  The fix was to not add note off events after mT1 and instead use gAllNotesOff.
This commit is contained in:
James Crook 2017-08-03 14:34:54 +01:00
parent a3c4c5afb5
commit dddac6e47d
1 changed files with 4 additions and 1 deletions

View File

@ -3955,10 +3955,13 @@ void AudioIO::GetNextEvent()
mNextEvent = mIterator->next(&mNextIsNoteOn,
(void **) &mNextEventTrack,
&nextOffset, mT1 + mMidiLoopOffset);
mNextEventTime = mT1 + mMidiLoopOffset + 1;
if (mNextEvent) {
mNextEventTime = (mNextIsNoteOn ? mNextEvent->time :
mNextEvent->get_end_time()) + nextOffset;;
} else { // terminate playback at mT1
}
if (mNextEventTime > (mT1 + mMidiLoopOffset)){ // terminate playback at mT1
mNextEvent = &gAllNotesOff;
mNextEventTime = mT1 + mMidiLoopOffset - ALG_EPS;
mNextIsNoteOn = true; // do not look at duration