Audacity 3.2.0
PluginDescriptor.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 PluginDescriptor.cpp
6
7 Split from PluginManager.cpp
8
9**********************************************************************/
10
11
13//
14// Plugindescriptor
15//
17
18#include "PluginDescriptor.h"
19
20#include "EffectInterface.h"
21#include "ModuleManager.h"
22#include "XMLWriter.h"
23
24namespace
25{
26 constexpr auto AttrID = "id";
27 constexpr auto AttrPath = "path";
28 constexpr auto AttrName = "name";
29 constexpr auto AttrVendor = "vendor";
30 constexpr auto AttrVersion = "version";
31 constexpr auto AttrEffectFamily = "effect_family";
32 constexpr auto AttrProviderID = "provider";
33
34 constexpr auto AttrType = "type";
35 constexpr auto AttrEnabled = "enabled";
36 constexpr auto AttrValid = "valid";
37
38 constexpr auto AttrEffectType = "effect_type";
39 constexpr auto AttrEffectDefault = "effect_default";
40 constexpr auto AttrEffectRealtime = "effect_realtime";
41 constexpr auto AttrEffectAutomatable = "effect_automatable";
42 constexpr auto AttrEffectInteractive = "effect_interactive";
43}
44
46{
47 return mPluginType;
48}
49
51{
52 return mID;
53}
54
56{
57 return mProviderID;
58}
59
61{
62 return mPath;
63}
64
66{
67 return mSymbol;
68}
69
71{
72 return mVersion;
73}
74
75const wxString& PluginDescriptor::GetVendor() const
76{
77 return mVendor;
78}
79
81{
82 return mEnabled;
83}
84
86{
87 return mValid;
88}
89
91{
92 mPluginType = type;
93}
94
96{
97 mID = ID;
98}
99
101{
102 mProviderID = providerID;
103}
104
106{
107 mPath = path;
108}
109
111{
112 mSymbol = symbol;
113}
114
115void PluginDescriptor::SetVersion(const wxString & version)
116{
117 mVersion = version;
118}
119
120void PluginDescriptor::SetVendor(const wxString & vendor)
121{
122 mVendor = vendor;
123}
124
126{
127 mEnabled = enable;
128}
129
131{
132 mValid = valid;
133}
134
135// Effects
136
138{
139 return mEffectFamily;
140}
141
143{
144 return mEffectType;
145}
146
148{
149 return mEffectInteractive;
150}
151
153{
154 return mEffectDefault;
155}
156
158{
159 return mEffectLegacy;
160}
161
163{
164 return mEffectRealtime;
165}
166
168{
169 return mEffectAutomatable;
170}
171
172void PluginDescriptor::SetEffectFamily(const wxString & family)
173{
174 mEffectFamily = family;
175}
176
178{
179 mEffectType = type;
180}
181
183{
184 mEffectInteractive = interactive;
185}
186
188{
189 mEffectDefault = dflt;
190}
191
193{
194 mEffectLegacy = legacy;
195}
196
198{
199 mEffectRealtime = realtime;
200}
201
203{
204 mEffectAutomatable = automatable;
205}
206
207// Importer
208
210{
211 return mImporterIdentifier;
212}
213
214void PluginDescriptor::SetImporterIdentifier(const wxString & identifier)
215{
216 mImporterIdentifier = identifier;
217}
218
220 const
221{
222 return mImporterExtensions;
223}
224
226{
227 writer.StartTag(XMLNodeName);
228 writer.WriteAttr(AttrID, GetID());
229 writer.WriteAttr(AttrType, static_cast<int>(GetPluginType()));
231 writer.WriteAttr(AttrValid, IsValid());
233 writer.WriteAttr(AttrPath, GetPath());
235 writer.WriteAttr(AttrVendor, GetVendor());
238 {
245 }
246 writer.EndTag(XMLNodeName);
247}
248
249bool PluginDescriptor::HandleXMLTag(const std::string_view& tag, const AttributesList& attrs)
250{
251 if(tag == XMLNodeName)
252 {
253 for(auto& p : attrs)
254 {
255 auto key = wxString(p.first.data(), p.first.length());
256 auto& attr = p.second;
257 if(key == AttrType)
258 SetPluginType(static_cast<PluginType>(attr.Get<int>()));
259 else if(key == AttrEffectType)
260 SetEffectType(static_cast<EffectType>(attr.Get<int>()));
261 else if(key == AttrEffectDefault)
262 SetEffectDefault(attr.Get<bool>());
263 else if(key == AttrEffectRealtime)
264 SetEffectRealtime(attr.Get<bool>());
265 else if(key == AttrEffectAutomatable)
266 SetEffectAutomatable(attr.Get<bool>());
267 else if(key == AttrEffectInteractive)
268 SetEffectInteractive(attr.Get<bool>());
269 else if(key == AttrEnabled)
270 SetEnabled(attr.Get<bool>());
271 else if(key == AttrValid)
272 SetValid(attr.Get<bool>());
273 else if(key == AttrID)
274 SetID(attr.ToWString());
275 else if(key == AttrPath)
276 SetPath(attr.ToWString());
277 else if(key == AttrName)
278 SetSymbol(attr.ToWString());
279 else if(key == AttrVendor)
280 SetVendor(attr.ToWString());
281 else if(key == AttrVersion)
282 SetVersion(attr.ToWString());
283 else if(key == AttrEffectFamily)
284 SetEffectFamily(attr.ToWString());
285 else if(key == AttrProviderID)
286 SetProviderID(attr.ToWString());
287 }
288 return true;
289 }
290 return false;
291}
292
294{
295 return nullptr;
296}
297
298void PluginDescriptor::HandleXMLEndTag(const std::string_view& basic_string_view)
299{
300
301}
302
304{
305 mImporterExtensions = std::move( extensions );
306}
@ Internal
Indicates internal failure from Audacity.
static const AudacityProject::AttachedObjects::RegisteredFactory key
EffectType
wxString PluginID
Definition: EffectManager.h:30
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
PluginType
@ PluginTypeEffect
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
bool IsEffectLegacy() const
void SetEnabled(bool enable)
EffectType mEffectType
void SetEffectLegacy(bool legacy)
void SetImporterExtensions(FileExtensions extensions)
const ComponentInterfaceSymbol & GetSymbol() const
bool IsEffectRealtime() const
const FileExtensions & GetImporterExtensions() const
bool IsEffectAutomatable() const
PluginType GetPluginType() const
void SetVendor(const wxString &vendor)
void SetImporterIdentifier(const wxString &identifier)
wxString GetEffectFamily() const
void SetPath(const PluginPath &path)
bool IsEffectDefault() const
void WriteXML(XMLWriter &writer) const
void SetValid(bool valid)
PluginType mPluginType
static constexpr auto XMLNodeName
bool IsEffectInteractive() const
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
const wxString & GetID() const
wxString mImporterIdentifier
bool IsEnabled() const
const wxString & GetImporterIdentifier() const
bool IsValid() const
void SetEffectRealtime(bool realtime)
const wxString & GetVendor() const
void SetSymbol(const ComponentInterfaceSymbol &symbol)
void SetProviderID(const PluginID &providerID)
const PluginPath & GetPath() const
void SetID(const PluginID &ID)
void SetEffectType(EffectType type)
void SetEffectFamily(const wxString &family)
EffectType GetEffectType() const
void HandleXMLEndTag(const std::string_view &) override
void SetPluginType(PluginType type)
const wxString & GetProviderID() const
FileExtensions mImporterExtensions
void SetEffectAutomatable(bool automatable)
const wxString & GetUntranslatedVersion() const
ComponentInterfaceSymbol mSymbol
void SetEffectDefault(bool dflt)
void SetEffectInteractive(bool interactive)
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
void SetVersion(const wxString &version)
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:26
virtual void StartTag(const wxString &name)
Definition: XMLWriter.cpp:80
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:37
virtual void EndTag(const wxString &name)
Definition: XMLWriter.cpp:103
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.