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 <wx/weakref.h>
21#include "../StatefulEffect.h"
22#include "MemoryX.h"
23
24class wxStaticText;
25class wxSlider;
26class wxChoice;
27class wxCheckBox;
28class wxTextCtrl;
29class LabelTrack;
30
32
33#define VAMPEFFECTS_VERSION wxT("1.0.0.0")
34/* i18n-hint: Vamp is the proper name of a software protocol for sound analysis.
35 It is not an abbreviation for anything. See http://vamp-plugins.org */
36#define VAMPEFFECTS_FAMILY XO("Vamp")
37
38class VampEffect final : public StatefulEffect
39{
40public:
41 VampEffect(std::unique_ptr<Vamp::Plugin> &&plugin,
42 const PluginPath & path,
43 int output,
44 bool hasParameters);
45 virtual ~VampEffect();
46
47 // ComponentInterface implementation
48
49 PluginPath GetPath() const override;
50 ComponentInterfaceSymbol GetSymbol() const override;
51 VendorSymbol GetVendor() const override;
52 wxString GetVersion() const override;
53 TranslatableString GetDescription() const override;
54
55 // EffectDefinitionInterface implementation
56
57 EffectType GetType() const override;
58 EffectFamilySymbol GetFamily() const override;
59 bool IsInteractive() const override;
60 bool IsDefault() const override;
61
62 bool SaveSettings(
63 const EffectSettings &settings, CommandParameters & parms) const override;
64 bool LoadSettings(
65 const CommandParameters & parms, EffectSettings &settings) const override;
66
67 unsigned GetAudioInCount() const override;
68
69 // Effect implementation
70
71 bool Init() override;
72 bool Process(EffectInstance &instance, EffectSettings &settings) override;
73 std::unique_ptr<EffectEditor> PopulateOrExchange(
74 ShuttleGui & S, EffectInstance &instance,
75 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
76 bool TransferDataToWindow(const EffectSettings &settings) override;
78
79private:
80 // VampEffect implementation
81
82 void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet & features);
83
84 void UpdateFromPlugin();
85
86 void OnCheckBox(wxCommandEvent & evt);
87 void OnChoice(wxCommandEvent & evt);
88 void OnSlider(wxCommandEvent & evt);
89 void OnTextCtrl(wxCommandEvent & evt);
90
91private:
92 wxWeakRef<wxWindow> mUIParent{};
93
94 std::unique_ptr<Vamp::Plugin> mPlugin;
98
99 Vamp::HostExt::PluginLoader::PluginKey mKey;
100 wxString mName;
101 double mRate;
102
105
106 Vamp::Plugin::ParameterList mParameters;
107
109
115 wxChoice *mProgram;
116
117 DECLARE_EVENT_TABLE()
118};
119
120#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: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,...
Performs effect computation.
Hold values to send to effect output meters.
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
ArrayOf< wxCheckBox * > mToggles
Definition: VampEffect.h:113
void OnCheckBox(wxCommandEvent &evt)
Definition: VampEffect.cpp:762
Floats mValues
Definition: VampEffect.h:108
bool IsDefault() const override
Whether the effect sorts "above the line" in the menus.
Definition: VampEffect.cpp:130
PluginPath GetPath() const override
Definition: VampEffect.cpp:85
bool TransferDataToWindow(const EffectSettings &settings) override
Definition: VampEffect.cpp:665
bool mInSlider
Definition: VampEffect.h:103
ComponentInterfaceSymbol GetSymbol() const override
Definition: VampEffect.cpp:90
bool TransferDataFromWindow(EffectSettings &settings) override
Definition: VampEffect.cpp:677
EffectFamilySymbol GetFamily() const override
Report identifier and user-visible name of the effect protocol.
Definition: VampEffect.cpp:120
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
Definition: VampEffect.cpp:125
void OnTextCtrl(wxCommandEvent &evt)
Definition: VampEffect.cpp:812
double mRate
Definition: VampEffect.h:101
ArrayOf< wxSlider * > mSliders
Definition: VampEffect.h:110
void UpdateFromPlugin()
Definition: VampEffect.cpp:719
VampEffect(std::unique_ptr< Vamp::Plugin > &&plugin, const PluginPath &path, int output, bool hasParameters)
Definition: VampEffect.cpp:63
PluginPath mPath
Definition: VampEffect.h:95
EffectType GetType() const override
Type determines how it behaves.
Definition: VampEffect.cpp:115
VendorSymbol GetVendor() const override
Definition: VampEffect.cpp:95
Vamp::Plugin::ParameterList mParameters
Definition: VampEffect.h:106
ArrayOf< wxChoice * > mChoices
Definition: VampEffect.h:114
ArrayOf< wxStaticText * > mLabels
Definition: VampEffect.h:112
int mOutput
Definition: VampEffect.h:96
wxChoice * mProgram
Definition: VampEffect.h:115
wxString mName
Definition: VampEffect.h:100
std::unique_ptr< Vamp::Plugin > mPlugin
Definition: VampEffect.h:94
TranslatableString GetDescription() const override
Definition: VampEffect.cpp:105
bool Process(EffectInstance &instance, EffectSettings &settings) override
Definition: VampEffect.cpp:319
ArrayOf< wxTextCtrl * > mFields
Definition: VampEffect.h:111
bool mHasParameters
Definition: VampEffect.h:97
virtual ~VampEffect()
Definition: VampEffect.cpp:77
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
Definition: VampEffect.cpp:501
bool Init() override
Definition: VampEffect.cpp:293
wxWeakRef< wxWindow > mUIParent
Definition: VampEffect.h:92
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: VampEffect.cpp:140
bool mInText
Definition: VampEffect.h:104
void OnSlider(wxCommandEvent &evt)
Definition: VampEffect.cpp:785
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: VampEffect.cpp:187
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: VampEffect.cpp:135
Vamp::HostExt::PluginLoader::PluginKey mKey
Definition: VampEffect.h:99
wxString GetVersion() const override
Definition: VampEffect.cpp:100
void OnChoice(wxCommandEvent &evt)
Definition: VampEffect.cpp:769
void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet &features)
Definition: VampEffect.cpp:689
Externalized state of a plug-in.