1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 07:13:49 +01:00

Bug1404: Close realtime effect with Enable unchecked; reopen; play...

... effect should apply to the audio stream.
This commit is contained in:
Paul Licameli
2017-07-24 18:45:42 -04:00
parent 54afdc762f
commit ff60610adf
2 changed files with 26 additions and 13 deletions

View File

@@ -2842,6 +2842,9 @@ EffectUIHost::~EffectUIHost()
if (mClient)
{
if (mNeedsResume)
Resume();
mClient->CloseUI();
mClient = NULL;
}
@@ -3149,6 +3152,8 @@ void EffectUIHost::OnClose(wxCloseEvent & WXUNUSED(evt))
Hide();
if (mNeedsResume)
Resume();
mClient->CloseUI();
mClient = NULL;
@@ -3343,27 +3348,33 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
btn->PopupMenu(&menu, r.GetLeft(), r.GetBottom());
}
void EffectUIHost::Resume()
{
if (!mClient->ValidateUI()) {
// If we're previewing we should still be able to stop playback
// so don't disable transport buttons.
// mEffect->EnableApply(false); // currently this would also disable transport buttons.
// The preferred behaviour is currently undecided, so for now
// just disallow enabling until settings are valid.
mEnabled = false;
mEnableCb->SetValue(mEnabled);
return;
}
mEffect->RealtimeResume();
}
void EffectUIHost::OnEnable(wxCommandEvent & WXUNUSED(evt))
{
mEnabled = mEnableCb->GetValue();
if (mEnabled)
{
if (!mClient->ValidateUI()) {
// If we're previewing we should still be able to stop playback
// so don't disable transport buttons.
// mEffect->EnableApply(false); // currently this would also disable transport buttons.
// The preferred behaviour is currently undecided, so for now
// just disallow enabling until settings are valid.
mEnabled = false;
mEnableCb->SetValue(mEnabled);
return;
}
mEffect->RealtimeResume();
if (mEnabled) {
Resume();
mNeedsResume = false;
}
else
{
mEffect->RealtimeSuspend();
mNeedsResume = true;
}
UpdateControls();

View File

@@ -625,6 +625,7 @@ private:
void InitializeRealtime();
void CleanupRealtime();
void Resume();
private:
AudacityProject *mProject;
@@ -664,6 +665,7 @@ private:
double mPlayPos;
bool mDismissed{};
bool mNeedsResume{};
DECLARE_EVENT_TABLE()
};