From e4eea36d0a7f39c93471cf48513013baaea09b84 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 26 Dec 2020 12:22:33 -0500 Subject: [PATCH] Remove old duplicate test for end of MIDI playback... ... which, anyway, had errors introduced into it (realTime mistakenly used as a duration) --- src/AudioIO.cpp | 28 ---------------------------- src/AudioIOBase.cpp | 8 -------- src/AudioIOBase.h | 4 ---- 3 files changed, 40 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index 93dfd7d38..4930a0c24 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -3340,32 +3340,6 @@ void AudioIoCallback::FillMidiBuffers() OutputEvent(); GetNextEvent(); } - - // test for end - double realTime = MidiTime() * 0.001 - - PauseTime(); - realTime -= 1; // MidiTime() runs ahead 1s - - // XXX Is this still true now? It seems to break looping --Poke - // - // The TrackPanel::OnTimer() method updates the time position - // indicator every 200ms, so it tends to not advance the - // indicator to the end of the selection (mT1) but instead stop - // up to 200ms before the end. At this point, output is shut - // down and the indicator is removed, but for a brief time, the - // indicator is clearly stopped before reaching mT1. To avoid - // this, we do not set mMidiOutputComplete until we are actually - // 0.22s beyond mT1 (even though we stop playing at mT1). This - // gives OnTimer() time to wake up and draw the final time - // position at mT1 before shutting down the stream. - const double loopDelay = 0.220; - - auto timeAtSpeed = mPlaybackSchedule.TrackDuration(realTime); - - mMidiOutputComplete = - (mPlaybackSchedule.PlayingStraight() && // PRL: what if scrubbing? - timeAtSpeed >= mPlaybackSchedule.mT1 + loopDelay); - // !mNextEvent); } double AudioIoCallback::PauseTime() @@ -4558,8 +4532,6 @@ void AudioIoCallback::CallbackCheckCompletion( if(!done) return; - // PRL: singalling MIDI output complete is necessary if - // not USE_MIDI_THREAD, otherwise it's harmlessly redundant #ifdef EXPERIMENTAL_MIDI_OUT mMidiOutputComplete = true, #endif diff --git a/src/AudioIOBase.cpp b/src/AudioIOBase.cpp index 0bb992582..4c88b63f0 100644 --- a/src/AudioIOBase.cpp +++ b/src/AudioIOBase.cpp @@ -1304,14 +1304,6 @@ void AudioIOBase::PlaybackSchedule::TrackTimeUpdate(double realElapsed) SetTrackTime( newTime ); } -double AudioIOBase::PlaybackSchedule::TrackDuration(double realElapsed) const -{ - if (mEnvelope) - return SolveWarpedLength(*mEnvelope, mT0, realElapsed); - else - return realElapsed; -} - double AudioIOBase::PlaybackSchedule::RealDuration(double trackTime1) const { double duration; diff --git a/src/AudioIOBase.h b/src/AudioIOBase.h index aa1da05aa..3d7109574 100644 --- a/src/AudioIOBase.h +++ b/src/AudioIOBase.h @@ -436,10 +436,6 @@ protected: // playback ring buffers, during usual straight or looping play void TrackTimeUpdate(double realElapsed); - // Convert a nonnegative real duration to an increment of track time - // relative to mT0. - double TrackDuration(double realElapsed) const; - // Convert time between mT0 and argument to real duration, according to // time track if one is given; result is always nonnegative double RealDuration(double trackTime1) const;