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 "../StatefulEffectUIServices.h"
23#include "MemoryX.h"
24
25class wxStaticText;
26class wxSlider;
27class wxChoice;
28class wxCheckBox;
29class wxTextCtrl;
30class LabelTrack;
31
33
34#define VAMPEFFECTS_VERSION wxT("1.0.0.0")
35/* i18n-hint: Vamp is the proper name of a software protocol for sound analysis.
36 It is not an abbreviation for anything. See http://vamp-plugins.org */
37#define VAMPEFFECTS_FAMILY XO("Vamp")
38
40{
41public:
42 VampEffect(std::unique_ptr<Vamp::Plugin> &&plugin,
43 const PluginPath & path,
44 int output,
45 bool hasParameters);
46 virtual ~VampEffect();
47
48 // ComponentInterface implementation
49
50 PluginPath GetPath() const override;
51 ComponentInterfaceSymbol GetSymbol() const override;
52 VendorSymbol GetVendor() const override;
53 wxString GetVersion() const override;
54 TranslatableString GetDescription() const override;
55
56 // EffectDefinitionInterface implementation
57
58 EffectType GetType() const override;
59 EffectFamilySymbol GetFamily() const override;
60 bool IsInteractive() const override;
61 bool IsDefault() const override;
62
63 bool SaveSettings(
64 const EffectSettings &settings, CommandParameters & parms) const override;
65 bool LoadSettings(
66 const CommandParameters & parms, EffectSettings &settings) const override;
67
68 unsigned GetAudioInCount() const override;
69
70 // Effect implementation
71
72 bool Init() override;
73 bool Process(EffectInstance &instance, EffectSettings &settings) override;
74 std::unique_ptr<EffectEditor> PopulateOrExchange(
75 ShuttleGui & S, EffectInstance &instance,
76 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
77 bool TransferDataToWindow(const EffectSettings &settings) override;
79
80private:
81 // VampEffect implementation
82
83 void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet & features);
84
85 void UpdateFromPlugin();
86
87 void OnCheckBox(wxCommandEvent & evt);
88 void OnChoice(wxCommandEvent & evt);
89 void OnSlider(wxCommandEvent & evt);
90 void OnTextCtrl(wxCommandEvent & evt);
91
92private:
93 wxWeakRef<wxWindow> mUIParent{};
94
95 std::unique_ptr<Vamp::Plugin> mPlugin;
99
100 Vamp::HostExt::PluginLoader::PluginKey mKey;
101 wxString mName;
102 double mRate;
103
106
107 Vamp::Plugin::ParameterList mParameters;
108
110
116 wxChoice *mProgram;
117
118 DECLARE_EVENT_TABLE()
119};
120
121#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:51
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:98
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:114
void OnCheckBox(wxCommandEvent &evt)
Definition: VampEffect.cpp:762
Floats mValues
Definition: VampEffect.h:109
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:104
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:102
ArrayOf< wxSlider * > mSliders
Definition: VampEffect.h:111
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:96
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:107
ArrayOf< wxChoice * > mChoices
Definition: VampEffect.h:115
ArrayOf< wxStaticText * > mLabels
Definition: VampEffect.h:113
int mOutput
Definition: VampEffect.h:97
wxChoice * mProgram
Definition: VampEffect.h:116
wxString mName
Definition: VampEffect.h:101
std::unique_ptr< Vamp::Plugin > mPlugin
Definition: VampEffect.h:95
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:112
bool mHasParameters
Definition: VampEffect.h:98
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:93
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: VampEffect.cpp:140
bool mInText
Definition: VampEffect.h:105
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:100
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.