64 wxASSERT(selectedRegion.
duration() >= 0.0);
82 bool isSelection =
false;
92 auto oldDuration = duration;
94 auto cleanup =
finally( [&] {
100 settings.extra.SetDuration(oldDuration);
115 newTrack->SetSelected(
true);
118 mT0 = selectedRegion.
t0();
119 mT1 = selectedRegion.
t1();
127 duration = quantMT1 - quantMT0;
133 auto newFormat = isSelection
137 settings.extra.SetDuration(duration);
138 settings.extra.SetDurationFormat( newFormat );
145 pAccess->ModifySettings(
updater);
147#ifdef EXPERIMENTAL_SPECTRAL_EDITING
148 mF0 = selectedRegion.
f0();
149 mF1 = selectedRegion.
f1();
159 std::shared_ptr<EffectInstance> pInstance;
164 else if (
auto result = finder(
settings))
170 auto pInstanceEx = std::dynamic_pointer_cast<EffectInstanceEx>(pInstance);
175 pInstanceEx = std::dynamic_pointer_cast<EffectInstanceEx>(
MakeInstance());
177 if (!pInstanceEx || !pInstanceEx->Init())
185 bool returnVal =
true;
187 if (skipFlag ==
false)
199 returnVal = pInstanceEx->Process(
settings);
202 if (returnVal && (
mT1 >=
mT0 ))
247 size_t cnt =
mOMap.size();
250 for (; iterOut != iterEnd; ++i) {
251 ListOfTracks::value_type o = *iterOut;
254 while (i < cnt &&
mOMap[i] != o.get()) {
255 const auto t =
mIMap[i];
268 const auto t =
mIMap[i];
284 const auto t =
mIMap[i];
322 -> std::optional<InstancePointer>
324 auto result = plugin.MakeInstance();
325 if (
auto pInstanceEx = std::dynamic_pointer_cast<EffectInstanceEx>(result)
326 ; pInstanceEx && pInstanceEx->Init())
327 return { pInstanceEx };
333 return [&plugin](
auto&) {
return FindInstance(plugin); };
Toolkit-neutral facade for basic user interface services.
const TranslatableString name
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
#define QUANTIZED_TIME(time, rate)
#define NYQUIST_PROMPT_ID
static Settings & settings()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
virtual PluginPath GetPath() const =0
TranslatableString GetName() const
std::shared_ptr< TrackList > mOutputTracks
WaveTrackFactory * mFactory
std::vector< Track * > mOMap
void SetPreviewFullSelectionFlag(bool previewDurationFlag)
void SetLinearEffectFlag(bool linearEffectFlag)
const TrackList * inputTracks() const
virtual std::any BeginPreview(const EffectSettings &settings)
Called when Preview() starts, to allow temporary effect state changes.
virtual bool CheckWhetherSkipEffect(const EffectSettings &settings) const =0
After Init(), tell whether Process() should be skipped.
BasicUI::ProgressDialog * mProgress
bool DoEffect(EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
bool mPreviewFullSelection
std::vector< Track * > mIMap
static std::optional< InstancePointer > FindInstance(EffectPlugin &plugin)
wxArrayString mPresetNames
double GetDefaultDuration()
static InstanceFinder DefaultInstanceFinder(EffectPlugin &plugin)
void SetTracks(TrackList *pTracks)
void ReplaceProcessedTracks(const bool bGoodResult)
const AudacityProject * FindProject() const
virtual EffectType GetType() const =0
Type determines how it behaves.
virtual bool IsInteractive() const =0
Whether the effect needs a dialog for entry of settings.
virtual std::shared_ptr< EffectInstance > MakeInstance() const =0
Make an object maintaining short-term state of an Effect.
Factory of instances of an effect.
std::function< std::optional< InstancePointer >(EffectSettings &settings) > InstanceFinder
std::shared_ptr< EffectSettingsAccess > EffectSettingsAccessPtr
virtual const EffectSettingsManager & GetDefinition() const =0
bool setTimes(double t0, double t1)
static const int UndefinedFrequency
bool ReadWithDefault(T *pVar, const T &defaultValue) const
overload of ReadWithDefault returning a boolean that is true if the value was previously defined */
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
auto SelectedLeaders() -> TrackIterRange< TrackType >
ListOfTracks::value_type Replace(Track *t, const ListOfTracks::value_type &with)
wxString MakeUniqueTrackName(const wxString &baseTrackName) const
Returns string that contains baseTrackName, but is guaranteed to be unique among other tracks in that...
TrackKind * Add(const std::shared_ptr< TrackKind > &t)
TrackNodePointer Remove(Track *t)
Remove the Track and return an iterator to what followed it.
auto Selected() -> TrackIterRange< TrackType >
AudacityProject * GetOwner()
RAII for a database transaction, possibly nested.
bool Commit()
Commit the transaction.
Used to create or clone a WaveTrack, with appropriate context from the project that will own the trac...
std::shared_ptr< WaveTrack > Create()
Creates an unnamed empty WaveTrack with default sample format and default rate.
A Track that contains audio waveform data.
static wxString GetDefaultAudioTrackNamePreference()
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
PROJECT_RATE_API IntSetting DefaultSampleRate
static RegisteredToolbarFactory factory
Externalized state of a plug-in.
"finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions...