Audacity 3.2.0
VampEffect.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 VampEffect.h
6
7 Chris Cannam
8
9 Vamp is an audio analysis and feature extraction plugin API.
10 http://www.vamp-plugins.org/
11
12**********************************************************************/
13
14
15
16#if defined(USE_VAMP)
17
18#include <vamp-hostsdk/PluginLoader.h>
19
20#include "../Effect.h"
21#include "MemoryX.h"
22
23class wxStaticText;
24class wxSlider;
25class wxChoice;
26class wxCheckBox;
27class wxTextCtrl;
28class LabelTrack;
29
31
32#define VAMPEFFECTS_VERSION wxT("1.0.0.0")
33/* i18n-hint: Vamp is the proper name of a software protocol for sound analysis.
34 It is not an abbreviation for anything. See http://vamp-plugins.org */
35#define VAMPEFFECTS_FAMILY XO("Vamp")
36
37class VampEffect final : public StatefulEffect
38{
39public:
40 VampEffect(std::unique_ptr<Vamp::Plugin> &&plugin,
41 const PluginPath & path,
42 int output,
43 bool hasParameters);
44 virtual ~VampEffect();
45
46 // ComponentInterface implementation
47
48 PluginPath GetPath() const override;
49 ComponentInterfaceSymbol GetSymbol() const override;
50 VendorSymbol GetVendor() const override;
51 wxString GetVersion() const override;
52 TranslatableString GetDescription() const override;
53
54 // EffectDefinitionInterface implementation
55
56 EffectType GetType() const override;
57 EffectFamilySymbol GetFamily() const override;
58 bool IsInteractive() const override;
59 bool IsDefault() const override;
60
61 bool SaveSettings(
62 const EffectSettings &settings, CommandParameters & parms) const override;
63 bool LoadSettings(
64 const CommandParameters & parms, EffectSettings &settings) const override;
65
66 unsigned GetAudioInCount() const override;
67
68 // Effect implementation
69
70 bool Init() override;
71 bool Process(EffectInstance &instance, EffectSettings &settings) override;
72 std::unique_ptr<EffectUIValidator> PopulateOrExchange(
73 ShuttleGui & S, EffectInstance &instance,
74 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
75 bool TransferDataToWindow(const EffectSettings &settings) override;
77
78private:
79 // VampEffect implementation
80
81 void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet & features);
82
83 void UpdateFromPlugin();
84
85 void OnCheckBox(wxCommandEvent & evt);
86 void OnChoice(wxCommandEvent & evt);
87 void OnSlider(wxCommandEvent & evt);
88 void OnTextCtrl(wxCommandEvent & evt);
89
90private:
91 wxWeakRef<wxWindow> mUIParent{};
92
93 std::unique_ptr<Vamp::Plugin> mPlugin;
97
98 Vamp::HostExt::PluginLoader::PluginKey mKey;
99 wxString mName;
100 double mRate;
101
104
105 Vamp::Plugin::ParameterList mParameters;
106
108
114 wxChoice *mProgram;
115
116 DECLARE_EVENT_TABLE()
117};
118
119#endif
EffectType
wxString PluginPath
type alias for identifying a Plugin supplied by a module, each module defining its own interpretation...
Definition: Identifier.h:214
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:87
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Performs effect computation.
Hold values to send to effect output meters.
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:87
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
Holds a msgid for the translation catalog; may also bind format arguments.
std::unique_ptr< EffectUIValidator > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
Definition: VampEffect.cpp:525
ArrayOf< wxCheckBox * > mToggles
Definition: VampEffect.h:112
void OnCheckBox(wxCommandEvent &evt)
Definition: VampEffect.cpp:786
Floats mValues
Definition: VampEffect.h:107
bool IsDefault() const override
Whether the effect sorts "above the line" in the menus.
Definition: VampEffect.cpp:131
PluginPath GetPath() const override
Definition: VampEffect.cpp:86
bool TransferDataToWindow(const EffectSettings &settings) override
Update controls for the settings.
Definition: VampEffect.cpp:689
bool mInSlider
Definition: VampEffect.h:102
ComponentInterfaceSymbol GetSymbol() const override
Definition: VampEffect.cpp:91
bool TransferDataFromWindow(EffectSettings &settings) override
Update the given settings from controls.
Definition: VampEffect.cpp:701
EffectFamilySymbol GetFamily() const override
Report identifier and user-visible name of the effect protocol.
Definition: VampEffect.cpp:121
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
Definition: VampEffect.cpp:126
void OnTextCtrl(wxCommandEvent &evt)
Definition: VampEffect.cpp:836
double mRate
Definition: VampEffect.h:100
ArrayOf< wxSlider * > mSliders
Definition: VampEffect.h:109
void UpdateFromPlugin()
Definition: VampEffect.cpp:743
VampEffect(std::unique_ptr< Vamp::Plugin > &&plugin, const PluginPath &path, int output, bool hasParameters)
Definition: VampEffect.cpp:64
PluginPath mPath
Definition: VampEffect.h:94
EffectType GetType() const override
Type determines how it behaves.
Definition: VampEffect.cpp:116
VendorSymbol GetVendor() const override
Definition: VampEffect.cpp:96
Vamp::Plugin::ParameterList mParameters
Definition: VampEffect.h:105
ArrayOf< wxChoice * > mChoices
Definition: VampEffect.h:113
ArrayOf< wxStaticText * > mLabels
Definition: VampEffect.h:111
int mOutput
Definition: VampEffect.h:95
wxChoice * mProgram
Definition: VampEffect.h:114
wxString mName
Definition: VampEffect.h:99
std::unique_ptr< Vamp::Plugin > mPlugin
Definition: VampEffect.h:93
TranslatableString GetDescription() const override
Definition: VampEffect.cpp:106
bool Process(EffectInstance &instance, EffectSettings &settings) override
Definition: VampEffect.cpp:339
ArrayOf< wxTextCtrl * > mFields
Definition: VampEffect.h:110
bool mHasParameters
Definition: VampEffect.h:96
virtual ~VampEffect()
Definition: VampEffect.cpp:78
bool Init() override
Definition: VampEffect.cpp:294
wxWeakRef< wxWindow > mUIParent
Definition: VampEffect.h:91
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: VampEffect.cpp:141
bool mInText
Definition: VampEffect.h:103
void OnSlider(wxCommandEvent &evt)
Definition: VampEffect.cpp:809
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: VampEffect.cpp:188
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: VampEffect.cpp:136
Vamp::HostExt::PluginLoader::PluginKey mKey
Definition: VampEffect.h:98
wxString GetVersion() const override
Definition: VampEffect.cpp:101
void OnChoice(wxCommandEvent &evt)
Definition: VampEffect.cpp:793
void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet &features)
Definition: VampEffect.cpp:713
Externalized state of a plug-in.