From 0aad028c9bea6912739b431ce14c87cfb3bba96e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 7 Feb 2018 14:24:31 -0500 Subject: [PATCH] Simplify calls to Effect::Delegate --- src/effects/ChangePitch.cpp | 3 +-- src/effects/ChangeTempo.cpp | 3 +-- src/effects/Effect.cpp | 6 +++--- src/effects/Effect.h | 4 ++-- src/effects/nyquist/Nyquist.cpp | 7 +------ 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/effects/ChangePitch.cpp b/src/effects/ChangePitch.cpp index 167edfcd3..f9025cb1e 100644 --- a/src/effects/ChangePitch.cpp +++ b/src/effects/ChangePitch.cpp @@ -187,12 +187,11 @@ bool EffectChangePitch::Process() if (mUseSBSMS) { double pitchRatio = 1.0 + m_dPercentChange / 100.0; - SelectedRegion region(mT0, mT1); EffectSBSMS proxy; proxy.mProxyEffectName = XO("High Quality Pitch Change"); proxy.setParameters(1.0, pitchRatio); - return Delegate(proxy, mUIParent, ®ion, false); + return Delegate(proxy, mUIParent, false); } else #endif diff --git a/src/effects/ChangeTempo.cpp b/src/effects/ChangeTempo.cpp index 03698ed16..dd0408727 100644 --- a/src/effects/ChangeTempo.cpp +++ b/src/effects/ChangeTempo.cpp @@ -176,11 +176,10 @@ bool EffectChangeTempo::Process() if (mUseSBSMS) { double tempoRatio = 1.0 + m_PercentChange / 100.0; - SelectedRegion region(mT0, mT1); EffectSBSMS proxy; proxy.mProxyEffectName = XO("High Quality Tempo Change"); proxy.setParameters(tempoRatio, 1.0); - success = Delegate(proxy, mUIParent, ®ion, false); + success = Delegate(proxy, mUIParent, false); } else #endif diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index e1eaee939..f76e246b2 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -1159,6 +1159,7 @@ bool Effect::DoEffect(wxWindow *parent, mOutputTracks.reset(); + mpSelectedRegion = selectedRegion; mFactory = factory; mProjectRate = projectRate; mTracks = list; @@ -1246,11 +1247,10 @@ bool Effect::DoEffect(wxWindow *parent, return returnVal; } -bool Effect::Delegate( Effect &delegate, - wxWindow *parent, SelectedRegion *selectedRegion, bool shouldPrompt) +bool Effect::Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt) { return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory, - selectedRegion, shouldPrompt ); + mpSelectedRegion, shouldPrompt ); } // All legacy effects should have this overridden diff --git a/src/effects/Effect.h b/src/effects/Effect.h index 8a90614ec..ef52f29d3 100644 --- a/src/effects/Effect.h +++ b/src/effects/Effect.h @@ -248,8 +248,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt = true); - bool Delegate( Effect &delegate, - wxWindow *parent, SelectedRegion *selectedRegion, bool shouldPrompt); + bool Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt); // Realtime Effect Processing /* not virtual */ bool RealtimeAddProcessor(int group, unsigned chans, float rate); @@ -453,6 +452,7 @@ protected: double mProjectRate; // Sample rate of the project - NEW tracks should // be created with this rate... double mSampleRate; + SelectedRegion *mpSelectedRegion{}; TrackFactory *mFactory; TrackList *inputTracks() const { return mTracks; } std::shared_ptr mOutputTracks; // used only if CopyInputTracks() is called. diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 7e5559211..56898086d 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -821,12 +821,7 @@ bool NyquistEffect::ShowInterface(wxWindow *parent, bool forceModal) effect.SetCommand(mInputCmd); effect.mDebug = (mUIResultID == eDebugID); - SelectedRegion region(mT0, mT1); -#ifdef EXPERIMENTAL_SPECTRAL_EDITING - region.setF0(mF0); - region.setF1(mF1); -#endif - return Delegate(effect, parent, ®ion, true); + return Delegate(effect, parent, true); } void NyquistEffect::PopulateOrExchange(ShuttleGui & S)