Audacity 3.2.0
EffectInterface.cpp
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file EffectInterface.cpp
6
7**********************************************************************/
8#include "EffectInterface.h"
9#include <wx/tokenzr.h>
10
12{
13 static wxString key("LastUsedDuration");
14 return key;
15}
16
18
20
22
24
26{
27 return mSettings;
28}
29
31 std::unique_ptr<Message>)
32{
33 mSettings = std::move(settings);
34}
35
36void SimpleEffectSettingsAccess::Set(std::unique_ptr<Message>)
37{
38}
39
41{
42}
43
45 const EffectSettingsAccess &other) const
46{
47 if (auto pOther =
48 dynamic_cast<const SimpleEffectSettingsAccess*>(&other))
49 return &this->mSettings == &pOther->mSettings;
50 return false;
51}
52
54{
55 // Get rid of leading and trailing white space
56 auto name = ident.GET();
57 name.Trim(true).Trim(false);
58
59 if (name.empty())
60 return {};
61
62 wxStringTokenizer st(name, wxT(" "));
63 wxString id;
64
65 // CamelCase the name
66 while (st.HasMoreTokens()) {
67 wxString tok = st.GetNextToken();
68 id += tok.Left(1).MakeUpper() + tok.Mid(1).MakeLower();
69 }
70
71 return id;
72}
73
75
77{
78 return GetType();
79}
80
82{
83 return false;
84}
85
87{
88 return {};
89}
90
92{
93 return {};
94}
95
97{
98 return false;
99}
100
102
105{
106 return false;
107}
108
110 ConstSettingsVisitor &, const EffectSettings &) const
111{
112 return false;
113}
114
116{
117 return {};
118}
119
121 -> std::unique_ptr<EffectOutputs>
122{
123 return nullptr;
124}
125
127 const EffectSettings &, EffectSettings &) const
128{
129 return true;
130}
131
133
135{
136 return false;
137}
138
140 EffectSettings &, EffectOutputs *, unsigned, float)
141{
142 return true;
143}
144
146{
147 return true;
148}
149
151{
152 return true;
153}
154
155auto EffectInstance::MakeMessage() const -> std::unique_ptr<Message>
156{
157 return nullptr;
158}
159
160bool EffectInstance::UsesMessages() const noexcept
161{
162 return false;
163}
164
166{
167 return true;
168}
169
171 const float *const *, float *const *, size_t)
172{
173 return 0;
174}
175
177{
178 return true;
179}
180
182{
183 return true;
184}
185
187{
188 return 0;
189}
190
192 -> SampleCount
193{
194 return 0;
195}
196
198{
199 return true;
200}
201
203
205{
206 return mBlockSize;
207}
208
210{
211 return (mBlockSize = maxBlockSize);
212}
213
215
217{
218 static RegistryPath id{ "CurrentSettings" };
219 return id;
220}
221
223{
224 static RegistryPath id{ "FactoryDefaults" };
225 return id;
226}
227
229{
230 RegistryPath group = wxT("UserPresets");
231 if (!name.empty())
232 group += wxCONFIG_PATH_SEPARATOR + name;
233 return group;
234}
wxT("CloseDown"))
const TranslatableString name
Definition: Distortion.cpp:76
RegistryPath UserPresetsGroup(const RegistryPath &name)
Compute part of a registry path, given a name which may be empty.
const RegistryPath & FactoryDefaultsGroup()
Component of a configuration key path, for default state of MakeSettings()
const RegistryPath & CurrentSettingsGroup()
Component of a configuration key path, for last-used destructive settings.
EffectType
wxString RegistryPath
Definition: Identifier.h:218
static CommandHandlerObject & ident(AudacityProject &project)
static const AudacityProject::AttachedObjects::RegisteredFactory key
wxString FilePath
Definition: Project.h:21
static Settings & settings()
Definition: TrackInfo.cpp:69
int id
virtual EffectType GetType() const =0
Type determines how it behaves.
virtual bool IsHiddenFromMenus() const
Default is false.
virtual bool EnablesDebug() const
Whether the effect dialog should have a Debug button; default, always false.
virtual FilePath HelpPage() const
Fully qualified local help file name, default is empty.
virtual EffectType GetClassification() const
Determines which menu it appears in; default same as GetType().
virtual ManualPageID ManualPage() const
Name of a page in the Audacity alpha manual, default is empty.
static Identifier GetSquashedName(const Identifier &ident)
A utility that strips spaces and CamelCases a name.
virtual ~EffectDefinitionInterface()
virtual ~EffectInstanceFactory()
virtual size_t GetTailSize() const
virtual bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
virtual bool RealtimeSuspend()
virtual bool RealtimeResume()
virtual bool RealtimeInitialize(EffectSettings &settings, double sampleRate)
virtual bool RealtimeProcessEnd(EffectSettings &settings) noexcept
settings can be updated to let a dialog change appearance at idle
virtual bool NeedsDither() const
virtual bool RealtimeFinalize(EffectSettings &settings) noexcept
virtual SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const
virtual std::unique_ptr< Message > MakeMessage() const
Called on the main thread, in which the result may be cloned.
virtual bool UsesMessages() const noexcept
uint64_t SampleCount
virtual bool RealtimeProcessStart(MessagePackage &package)
settings are possibly changed, since last call, by an asynchronous dialog
virtual ~EffectInstance()
virtual size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
size_t SetBlockSize(size_t maxBlockSize) override
~EffectInstanceWithBlockSize() override
size_t GetBlockSize() const override
Hold values to send to effect output meters.
virtual ~EffectOutputs()
Type of messages to send from main thread to processing.
virtual ~EffectSettingsAccess()
static const RegistryPath & DurationKey()
virtual bool VisitSettings(SettingsVisitor &visitor, EffectSettings &settings)
virtual ~EffectSettingsManager()
virtual bool CopySettingsContents(const EffectSettings &src, EffectSettings &dst) const
Update one settings object from another.
virtual std::unique_ptr< EffectOutputs > MakeOutputs() const
Produce an object to hold values to send to effect output meters.
virtual EffectSettings MakeSettings() const
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
Visitor of effect or command parameters. This is a base class with lots of virtual functions that do ...
Implementation of EffectSettings for cases where there is only one thread.
void Flush() override
Make the last Set changes "persistent" in underlying storage.
bool IsSameAs(const EffectSettingsAccess &other) const override
const EffectSettings & Get() override
~SimpleEffectSettingsAccess() override
void Set(EffectSettings &&settings, std::unique_ptr< Message > pMessage) override
STL namespace.
Externalized state of a plug-in.