From 7d0517a9c92132c47c05ad43949c36b7c0492e1e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 3 Jun 2016 08:34:39 -0400 Subject: [PATCH] Don't busy-wait (excess CPU usage) after stopping scrub --- src/AudioIO.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index e67ad1a06..2f5cced12 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1798,6 +1798,10 @@ int AudioIO::StartStream(const WaveTrackArray &playbackTracks, if (mListener && captureChannels > 0) mListener->OnAudioIOStopRecording(); mStreamToken = 0; + + // Don't cause a busy wait in the audio thread after stopping scrubbing + mPlayMode = PLAY_STRAIGHT; + return 0; } @@ -2100,6 +2104,10 @@ void AudioIO::StartStreamCleanup(bool bOnlyBuffers) mScrubQueue = 0; } #endif + + + // Don't cause a busy wait in the audio thread after stopping scrubbing + mPlayMode = PLAY_STRAIGHT; } #ifdef EXPERIMENTAL_MIDI_OUT @@ -2530,6 +2538,9 @@ void AudioIO::StopStream() // Tell UI to hide sample rate mListener->OnAudioIORate(0); } + + // Don't cause a busy wait in the audio thread after stopping scrubbing + mPlayMode = PLAY_STRAIGHT; } void AudioIO::SetPaused(bool state)