1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Simplify calls to Effect::Delegate

This commit is contained in:
Paul Licameli 2018-02-07 14:24:31 -05:00
parent a3be011bf6
commit 0aad028c9b
5 changed files with 8 additions and 15 deletions

View File

@ -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, &region, false);
return Delegate(proxy, mUIParent, false);
}
else
#endif

View File

@ -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, &region, false);
success = Delegate(proxy, mUIParent, false);
}
else
#endif

View File

@ -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

View File

@ -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<TrackList> mOutputTracks; // used only if CopyInputTracks() is called.

View File

@ -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, &region, true);
return Delegate(effect, parent, true);
}
void NyquistEffect::PopulateOrExchange(ShuttleGui & S)