1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

Momentary Stop push-down happens in yield to the idle time handler...

... So that ControlToolBar::StopPlaying now does nothing directly to the
buttons, and can be moved to another place with no dependency on ControlToolBar
This commit is contained in:
Paul Licameli
2019-07-01 09:54:52 -04:00
parent 5ab3986261
commit 2a87ea77cf
2 changed files with 21 additions and 4 deletions

View File

@@ -808,10 +808,20 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
if (!CanStopAudioStream())
return;
mStop->PushDown();
auto gAudioIO = AudioIO::Get();
auto cleanup = finally( [&]{
projectAudioManager.SetStopping( false );
} );
if (stopStream && gAudioIO->IsBusy()) {
// flag that we are stopping
projectAudioManager.SetStopping( true );
// Allow UI to update for that
while( wxTheApp->ProcessIdle() )
;
}
if(stopStream)
gAudioIO->StopStream();
@@ -1296,8 +1306,11 @@ void ControlToolBar::OnIdle(wxIdleEvent & event)
);
}
// push-downs of the stop button are only momentary and always pop up now
mStop->PopUp();
if ( projectAudioManager.Stopping() )
mStop->PushDown();
else
// push-downs of the stop button are only momentary and always pop up now
mStop->PopUp();
UpdateStatusBar();
EnableDisableButtons();