1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02: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

@@ -43,6 +43,8 @@ public:
// active
bool Recording() const;
bool Stopping() const { return mStopping; }
// Whether the last attempt to start recording requested appending to tracks
bool Appending() const { return mAppending; }
bool Looping() const { return mLooping; }
@@ -52,6 +54,7 @@ public:
void SetAppending( bool value ) { mAppending = value; }
void SetLooping( bool value ) { mLooping = value; }
void SetCutting( bool value ) { mCutting = value; }
void SetStopping( bool value ) { mStopping = value; }
private:
// Audio IO callback methods
@@ -71,6 +74,7 @@ private:
bool mAppending{ false };
bool mLooping{ false };
bool mCutting{ false };
bool mStopping{ false };
};
AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project );

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();