Audacity 3.2.0
LV2EffectBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 LV2EffectBase.h
6
7 Paul Licameli split from LV2Effectg
8
9 Audacity(R) is copyright (c) 1999-2013 Audacity Team.
10 License: GPL v2 or later. See License.txt.
11
12*********************************************************************/
13#ifndef __AUDACITY_LV2_EFFECT_BASE__
14#define __AUDACITY_LV2_EFFECT_BASE__
15
16#if USE_LV2
17
18#include "LV2FeaturesList.h"
19#include "LV2Ports.h"
20
21#include "SampleFormat.h"
22#include "PerTrackEffect.h"
23
24#define LV2EFFECTS_VERSION wxT("1.0.0.0")
25/* i18n-hint: abbreviates
26 "Linux Audio Developer's Simple Plugin API (LADSPA) version 2" */
27#define LV2EFFECTS_FAMILY XO("LV2")
28
29class LV2_API LV2EffectBase : public PerTrackEffect
30{
31public:
32 LV2EffectBase(const LilvPlugin &plug);
33 ~LV2EffectBase() override;
34
35 // ComponentInterface implementation
36
37 PluginPath GetPath() const override;
38 ComponentInterfaceSymbol GetSymbol() const override;
39 VendorSymbol GetVendor() const override;
40 wxString GetVersion() const override;
41 TranslatableString GetDescription() const override;
42
43 // EffectDefinitionInterface implementation
44
45 EffectType GetType() const override;
46 EffectFamilySymbol GetFamily() const override;
47 bool IsInteractive() const override;
48 bool IsDefault() const override;
49 RealtimeSince RealtimeSupport() const override;
50 bool SupportsAutomation() const override;
51
52 bool SaveSettings(
53 const EffectSettings &settings, CommandParameters & parms) const override;
54 bool LoadSettings(
55 const CommandParameters & parms, EffectSettings &settings) const override;
56
58 const RegistryPath & name, EffectSettings &settings) const override;
59 bool SaveUserPreset(
60 const RegistryPath & name, const EffectSettings &settings) const override;
61
62 RegistryPaths GetFactoryPresets() const override;
64 const override;
65
66 bool InitializePlugin();
67
68 std::shared_ptr<EffectInstance> MakeInstance() const override;
69
70 bool CanExportPresets() const override;
71
72 bool HasOptions() const override;
73
74 // LV2Effect implementation
75
76 EffectSettings MakeSettings() const override;
78 const EffectSettings &src, EffectSettings &dst) const override;
79
80 std::unique_ptr<EffectOutputs> MakeOutputs() const override;
81
82 OptionalMessage LoadParameters(
83 const RegistryPath & group, EffectSettings &settings) const;
84 bool SaveParameters(
85 const RegistryPath & group, const EffectSettings &settings) const;
86
87 const LilvPlugin &mPlug;
88 const LV2FeaturesList mFeatures{ mPlug };
89
90 const LV2Ports mPorts{ mPlug };
91
92 bool mWantsOptionsInterface{ false };
93 bool mWantsStateInterface{ false };
94
95 size_t mFramePos{};
96
99
100 double mLength{};
101
102 // Mutable cache fields computed once on demand
103 mutable bool mFactoryPresetsLoaded{ false };
105 mutable wxArrayString mFactoryPresetUris;
106};
107
108#endif
109#endif
const TranslatableString name
Definition: Distortion.cpp:76
EffectType
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
wxString RegistryPath
Definition: Identifier.h:218
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
static Settings & settings()
Definition: TrackInfo.cpp:69
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
virtual EffectType GetType() const =0
Type determines how it behaves.
RealtimeSince
In which versions of Audacity was an effect realtime capable?
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: Effect.cpp:115
RealtimeSince RealtimeSupport() const override
Since which version of Audacity has the effect supported realtime?
Definition: Effect.cpp:86
bool SaveUserPreset(const RegistryPath &name, const EffectSettings &settings) const override
Save settings in the configuration file as a user-named preset.
Definition: Effect.cpp:143
bool SupportsAutomation() const override
Whether the effect has any automatable controls.
Definition: Effect.cpp:91
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: Effect.cpp:122
TranslatableString GetDescription() const override
Definition: Effect.cpp:64
OptionalMessage LoadFactoryPreset(int id, EffectSettings &settings) const override
Definition: Effect.cpp:160
bool HasOptions() const override
Definition: Effect.cpp:175
wxString GetVersion() const override
Definition: Effect.cpp:59
PluginPath GetPath() const override
Definition: Effect.cpp:44
VendorSymbol GetVendor() const override
Definition: Effect.cpp:54
OptionalMessage LoadUserPreset(const RegistryPath &name, EffectSettings &settings) const override
Definition: Effect.cpp:130
bool CanExportPresets() const override
Whether the effect supports export of presets to files, and importing too.
Definition: Effect.cpp:170
ComponentInterfaceSymbol GetSymbol() const override
Definition: Effect.cpp:49
EffectFamilySymbol GetFamily() const override
Report identifier and user-visible name of the effect protocol.
Definition: Effect.cpp:69
bool IsDefault() const override
Whether the effect sorts "above the line" in the menus.
Definition: Effect.cpp:81
RegistryPaths GetFactoryPresets() const override
Report names of factory presets.
Definition: Effect.cpp:155
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
Definition: Effect.cpp:76
virtual std::shared_ptr< EffectInstance > MakeInstance() const =0
Make an object maintaining short-term state of an Effect.
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
FloatBuffers mCVOutBuffers
Definition: LV2EffectBase.h:98
RegistryPaths mFactoryPresetNames
FloatBuffers mCVInBuffers
Definition: LV2EffectBase.h:97
~LV2EffectBase() override
wxArrayString mFactoryPresetUris
const LilvPlugin & mPlug
Definition: LV2EffectBase.h:87
Base class for many of the effects in Audacity.
Holds a msgid for the translation catalog; may also bind format arguments.
Externalized state of a plug-in.