From 03f9592f589a9baee52cde415d8fbb85e3afb1b9 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 16 Jul 2017 17:02:37 -0700 Subject: [PATCH] Bug 1690: Playback does not stop at the end of MIDI playback This was caused by the indicator-passed-selection check being inside a loop over all wave tracks. If there are no wave tracks, then the check never happened. I added a duplicate version of the check if there are no wave tracks. This may not be the best solution, but it works for now. I'm not entirely sure why the check is in the loop (or what's going on with the len and maxLen variables); as such, I just haven't touched that. Perhaps it would be safe to move the check always outside of the loop, but I'm not completely confident in that. --- src/AudioIO.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index 22394e4cb..0431c32bc 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -4573,6 +4573,19 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, chanCnt = 0; } + // Poke: If there are no playback tracks, then the earlier check + // about the time indicator being passed the end won't happen; + // do it here instead (but not if looping or scrubbing) + if (numPlaybackTracks == 0 + && gAudioIO->mPlayMode == AudioIO::PLAY_STRAIGHT) + { + if ((gAudioIO->ReversedTime() + ? gAudioIO->mTime <= gAudioIO->mT1 + : gAudioIO->mTime >= gAudioIO->mT1)) { + + callbackReturn = paComplete; + } + } #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT // Update the current time position, for scrubbing