1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-08 22:23:59 +01:00

Don't push effects that can't be undone onto the Undo Stack

This commit is contained in:
Steve Daulton
2015-12-30 16:56:30 +00:00
parent 159f0263f3
commit 1d6d08c47d
8 changed files with 50 additions and 6 deletions

View File

@@ -42,6 +42,7 @@ EffectManager::EffectManager()
mRealtimeSuspended = true;
mRealtimeLatency = 0;
mRealtimeLock.Leave();
mSkipStateFlag = false;
#if defined(EXPERIMENTAL_EFFECTS_RACK)
mRack = NULL;
@@ -92,6 +93,7 @@ bool EffectManager::DoEffect(const PluginID & ID,
bool shouldPrompt /* = true */)
{
this->SetSkipStateFlag(false);
Effect *effect = GetEffect(ID);
if (!effect)
@@ -171,6 +173,16 @@ bool EffectManager::IsHidden(const PluginID & ID)
return false;
}
void EffectManager::SetSkipStateFlag(bool flag)
{
mSkipStateFlag = flag;
}
bool EffectManager::GetSkipStateFlag()
{
return mSkipStateFlag;
}
bool EffectManager::SupportsAutomation(const PluginID & ID)
{
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);

View File

@@ -91,7 +91,11 @@ public:
wxString GetDefaultPreset(const PluginID & ID);
void SetBatchProcessing(const PluginID & ID, bool start);
// Realtime effect processing
/** Allow effects to disable saving the state at run time */
void SetSkipStateFlag(bool flag);
bool GetSkipStateFlag();
// Realtime effect processing
bool RealtimeIsActive();
bool RealtimeIsSuspended();
void RealtimeAddEffect(Effect *effect);
@@ -135,6 +139,10 @@ private:
wxArrayInt mRealtimeChans;
wxArrayDouble mRealtimeRates;
// Set true if we want to skip pushing state
// after processing at effect run time.
bool mSkipStateFlag;
#if defined(EXPERIMENTAL_EFFECTS_RACK)
EffectRack *mRack;

View File

@@ -39,6 +39,7 @@
#include "../Audacity.h"
#include "../Experimental.h"
#include "NoiseReduction.h"
#include "EffectManager.h"
#include "../ShuttleGui.h"
#include "../Prefs.h"
@@ -1616,6 +1617,9 @@ void EffectNoiseReduction::Dialog::EnableDisableSensitivityControls()
void EffectNoiseReduction::Dialog::OnGetProfile(wxCommandEvent & WXUNUSED(event))
{
// Project has not be changed so skip pushing state
EffectManager::Get().SetSkipStateFlag(true);
if (!TransferDataFromWindow())
return;

View File

@@ -437,6 +437,9 @@ bool NyquistEffect::CheckWhetherSkipEffect()
bool NyquistEffect::Process()
{
bool success = true;
mProjectChanged = false;
EffectManager & em = EffectManager::Get();
em.SetSkipStateFlag(false);
if (mExternal) {
mProgress->Hide();
@@ -622,6 +625,8 @@ bool NyquistEffect::Process()
if (mCurLen > NYQ_MAX_LEN) {
wxMessageBox(_("Selection too long for Nyquist code.\nMaximum allowed selection is 2147483647 samples\n(about 13.5 hours at 44100 Hz sample rate)."),
_("Nyquist Error"), wxOK | wxCENTRE);
if (!mProjectChanged)
em.SetSkipStateFlag(true);
return false;
}
@@ -721,6 +726,9 @@ bool NyquistEffect::Process()
mDebug = false;
if (!mProjectChanged)
em.SetSkipStateFlag(true);
return success;
}
@@ -1091,6 +1099,7 @@ bool NyquistEffect::ProcessOne()
}
if (rval == nyx_labels) {
mProjectChanged = true;
unsigned int numLabels = nyx_get_num_labels();
unsigned int l;
LabelTrack *ltrack = NULL;
@@ -1233,7 +1242,7 @@ bool NyquistEffect::ProcessOne()
delete mOutputTrack[i];
mOutputTrack[i] = NULL;
}
mProjectChanged = true;
return true;
}

View File

@@ -199,6 +199,7 @@ private:
bool mEnablePreview;
bool mDebug;
bool mRedirectOutput;
bool mProjectChanged;
wxString mDebugOutput;
int mVersion;