Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VampEffect Class Referencefinal

#include <VampEffect.h>

Inheritance diagram for VampEffect:
[legend]
Collaboration diagram for VampEffect:
[legend]

Public Member Functions

 VampEffect (std::unique_ptr< Vamp::Plugin > &&plugin, const PluginPath &path, int output, bool hasParameters)
 
virtual ~VampEffect ()
 
PluginPath GetPath () const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
bool Init () override
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 
std::unique_ptr< EffectEditorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 
bool TransferDataFromWindow (EffectSettings &settings) override
 
- Public Member Functions inherited from StatefulEffect
 ~StatefulEffect () override
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () const
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 
- Public Member Functions inherited from StatefulEffectUIServices
 ~StatefulEffectUIServices () override
 
std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
 Allows PopulateOrExchange to return null. More...
 
virtual std::unique_ptr< EffectEditorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)
 Add controls to effect panel; always succeeds. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)
 
virtual bool TransferDataFromWindow (EffectSettings &settings)
 
- Public Member Functions inherited from BasicEffectUIServices
int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
void ShowOptions (const EffectPlugin &plugin) const override
 
bool ValidateUI (const EffectPlugin &context, EffectSettings &) const override
 
bool CloseUI () const override
 
- Public Member Functions inherited from EffectUIServices
virtual ~EffectUIServices ()
 
virtual int ShowHostInterface (EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 

Private Member Functions

void AddFeatures (LabelTrack *track, Vamp::Plugin::FeatureSet &features)
 
void UpdateFromPlugin ()
 
void OnCheckBox (wxCommandEvent &evt)
 
void OnChoice (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnTextCtrl (wxCommandEvent &evt)
 

Private Attributes

wxWeakRef< wxWindow > mUIParent {}
 
std::unique_ptr< Vamp::Plugin > mPlugin
 
PluginPath mPath
 
int mOutput
 
bool mHasParameters
 
Vamp::HostExt::PluginLoader::PluginKey mKey
 
wxString mName
 
double mRate
 
bool mInSlider
 
bool mInText
 
Vamp::Plugin::ParameterList mParameters
 
Floats mValues
 
ArrayOf< wxSlider * > mSliders
 
ArrayOf< wxTextCtrl * > mFields
 
ArrayOf< wxStaticText * > mLabels
 
ArrayOf< wxCheckBox * > mToggles
 
ArrayOf< wxChoice * > mChoices
 
wxChoice * mProgram
 

Additional Inherited Members

- Public Types inherited from StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Types inherited from EffectUIServices
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
- Static Public Member Functions inherited from EffectBase
static std::optional< InstancePointerFindInstance (EffectPlugin &plugin)
 
static InstanceFinder DefaultInstanceFinder (EffectPlugin &plugin)
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Static Public Member Functions inherited from EffectUIServices
static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Protected Member Functions inherited from Effect
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, sampleCount *start, sampleCount *len)
 
- Protected Member Functions inherited from EffectBase
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Detailed Description

Definition at line 38 of file VampEffect.h.

Constructor & Destructor Documentation

◆ VampEffect()

VampEffect::VampEffect ( std::unique_ptr< Vamp::Plugin > &&  plugin,
const PluginPath path,
int  output,
bool  hasParameters 
)

Definition at line 63 of file VampEffect.cpp.

67: mPlugin(std::move(plugin)),
68 mPath(path),
69 mOutput(output),
70 mHasParameters(hasParameters),
71 mRate(0)
72{
73 mKey = mPath.BeforeFirst(wxT('/')).ToUTF8();
74 mName = mPath.AfterFirst(wxT('/'));
75}
wxT("CloseDown"))
double mRate
Definition: VampEffect.h:101
PluginPath mPath
Definition: VampEffect.h:95
int mOutput
Definition: VampEffect.h:96
wxString mName
Definition: VampEffect.h:100
std::unique_ptr< Vamp::Plugin > mPlugin
Definition: VampEffect.h:94
bool mHasParameters
Definition: VampEffect.h:97
Vamp::HostExt::PluginLoader::PluginKey mKey
Definition: VampEffect.h:99

References wxT().

Here is the call graph for this function:

◆ ~VampEffect()

VampEffect::~VampEffect ( )
virtual

Definition at line 77 of file VampEffect.cpp.

78{
79}

Member Function Documentation

◆ AddFeatures()

void VampEffect::AddFeatures ( LabelTrack track,
Vamp::Plugin::FeatureSet &  features 
)
private

Definition at line 689 of file VampEffect.cpp.

691{
692 for (Vamp::Plugin::FeatureList::iterator fli = features[mOutput].begin();
693 fli != features[mOutput].end(); ++fli)
694 {
695 Vamp::RealTime ftime0 = fli->timestamp;
696 double ltime0 = ftime0.sec + (double(ftime0.nsec) / 1000000000.0);
697
698 Vamp::RealTime ftime1 = ftime0;
699 if (fli->hasDuration) ftime1 = ftime0 + fli->duration;
700 double ltime1 = ftime1.sec + (double(ftime1.nsec) / 1000000000.0);
701
702 wxString label = LAT1CTOWX(fli->label.c_str());
703 if (label == wxString())
704 {
705 if (fli->values.empty())
706 {
707 label = wxString::Format(LAT1CTOWX("%.3f"), ltime0);
708 }
709 else
710 {
711 label = wxString::Format(LAT1CTOWX("%.3f"), *fli->values.begin());
712 }
713 }
714
715 ltrack->AddLabel(SelectedRegion(ltime0, ltime1), label);
716 }
717}
#define LAT1CTOWX(X)
Definition: Internat.h:158
TranslatableString label
Definition: TagsEditor.cpp:165
Defines a selected portion of a project.
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References LabelTrack::AddLabel(), details::begin(), label, LAT1CTOWX, and mOutput.

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAudioInCount()

unsigned VampEffect::GetAudioInCount ( ) const
overridevirtual

How many input buffers to allocate at once.

If the instance processes channels independently, this can return 1 The result is not necessarily well defined before RealtimeInitialize Default implementation returns 0

Reimplemented from StatefulEffectBase.

Definition at line 135 of file VampEffect.cpp.

136{
137 return mPlugin->getMaxChannelCount();
138}

References mPlugin.

◆ GetDescription()

TranslatableString VampEffect::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 105 of file VampEffect.cpp.

106{
107 return Verbatim(
108 wxString::FromUTF8(mPlugin->getCopyright().c_str()) );
109}
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.

References mPlugin, and Verbatim().

Here is the call graph for this function:

◆ GetFamily()

EffectFamilySymbol VampEffect::GetFamily ( ) const
overridevirtual

Report identifier and user-visible name of the effect protocol.

Implements EffectDefinitionInterface.

Definition at line 120 of file VampEffect.cpp.

121{
122 return VAMPEFFECTS_FAMILY;
123}
#define VAMPEFFECTS_FAMILY
Definition: VampEffect.h:36

References VAMPEFFECTS_FAMILY.

◆ GetPath()

PluginPath VampEffect::GetPath ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 85 of file VampEffect.cpp.

86{
87 return mPath;
88}

References mPath.

◆ GetSymbol()

ComponentInterfaceSymbol VampEffect::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 90 of file VampEffect.cpp.

91{
92 return mName;
93}

References mName.

Referenced by Process().

Here is the caller graph for this function:

◆ GetType()

EffectType VampEffect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 115 of file VampEffect.cpp.

116{
117 return EffectTypeAnalyze;
118}
@ EffectTypeAnalyze

References EffectTypeAnalyze.

◆ GetVendor()

VendorSymbol VampEffect::GetVendor ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 95 of file VampEffect.cpp.

96{
97 return { wxString::FromUTF8(mPlugin->getMaker().c_str()) };
98}

References mPlugin.

◆ GetVersion()

wxString VampEffect::GetVersion ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 100 of file VampEffect.cpp.

101{
102 return wxString::Format(wxT("%d"), mPlugin->getPluginVersion());
103}

References mPlugin, and wxT().

Here is the call graph for this function:

◆ Init()

bool VampEffect::Init ( )
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 293 of file VampEffect.cpp.

294{
295 mRate = 0.0;
296
297 // PRL: There is no check that all tracks have one rate, and only the first
298 // is remembered in mRate. Is that correct?
299
300 if (inputTracks()->empty())
302 else
303 mRate = (*inputTracks()->Any<const WaveTrack>().begin())->GetRate();
304
305 // The plugin must be reloaded to allow changing parameters
306
307 Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance();
308 mPlugin.reset(loader->loadPlugin(mKey, mRate, Vamp::HostExt::PluginLoader::ADAPT_ALL));
309 if (!mPlugin)
310 {
312 XO("Sorry, failed to load Vamp Plug-in."));
313 return false;
314 }
315
316 return true;
317}
XO("Cut/Copy/Paste")
const TrackList * inputTracks() const
Definition: EffectBase.h:91
double mProjectRate
Definition: EffectBase.h:110
static int DoMessageBox(const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
double GetRate(const Track &track)
Definition: TimeTrack.cpp:182

References TrackList::Any(), details::begin(), EffectUIServices::DoMessageBox(), anonymous_namespace{TimeTrack.cpp}::GetRate(), EffectBase::inputTracks(), mKey, mPlugin, EffectBase::mProjectRate, mRate, and XO().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsDefault()

bool VampEffect::IsDefault ( ) const
overridevirtual

Whether the effect sorts "above the line" in the menus.

Implements EffectDefinitionInterface.

Definition at line 130 of file VampEffect.cpp.

131{
132 return false;
133}

◆ IsInteractive()

bool VampEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Implements EffectDefinitionInterface.

Definition at line 125 of file VampEffect.cpp.

126{
127 return mHasParameters;
128}

References mHasParameters.

◆ LoadSettings()

bool VampEffect::LoadSettings ( const CommandParameters parms,
EffectSettings settings 
) const
overridevirtual

Restore settings from keys and values.

Returns
true on success

Implements EffectSettingsManager.

Definition at line 187 of file VampEffect.cpp.

189{
190 // First pass verifies values
191 for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
192 {
193 wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
194 float lower = mParameters[p].minValue;
195 float upper = mParameters[p].maxValue;
196 bool good = false;
197
198 if (mParameters[p].isQuantized &&
199 mParameters[p].quantizeStep == 1.0 &&
200 lower == 0.0 &&
201 upper == 1.0)
202 {
203 bool val;
204
205 good = parms.Read(key, &val);
206 }
207 else if (mParameters[p].isQuantized &&
208 mParameters[p].quantizeStep == 1.0 &&
209 !mParameters[p].valueNames.empty())
210 {
211 std::vector<EnumValueSymbol> choices;
212 int val;
213
214 for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
215 {
216 wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
217 choices.push_back(choice);
218 }
219
220 good = parms.ReadEnum(key, &val, choices.data(), choices.size()) && val != wxNOT_FOUND;
221 }
222 else
223 {
224 double val;
225
226 good = parms.Read(key, &val) && val >= lower && val <= upper;
227 }
228
229 if (!good)
230 {
231 return false;
232 }
233 }
234
235 // Second pass sets the variables
236 for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
237 {
238 wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
239 float lower = mParameters[p].minValue;
240 float upper = mParameters[p].maxValue;
241
242 if (mParameters[p].isQuantized &&
243 mParameters[p].quantizeStep == 1.0 &&
244 lower == 0.0 &&
245 upper == 1.0)
246 {
247 bool val;
248
249 parms.Read(key, &val);
250
251 mPlugin->setParameter(mParameters[p].identifier, val ? upper : lower);
252 }
253 else if (mParameters[p].isQuantized &&
254 mParameters[p].quantizeStep == 1.0 &&
255 !mParameters[p].valueNames.empty())
256 {
257 std::vector<EnumValueSymbol> choices;
258 int val = 0;
259
260 for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
261 {
262 wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
263 choices.push_back(choice);
264 }
265
266 parms.ReadEnum(key, &val, choices.data(), choices.size());
267
268 mPlugin->setParameter(mParameters[p].identifier, (float) val);
269 }
270 else
271 {
272 double val;
273
274 parms.Read(key, &val);
275
276 if (mParameters[p].isQuantized)
277 {
278 float qs = mParameters[p].quantizeStep;
279
280 if (qs != 0.0)
281 {
282 val = (int)((val - lower) / qs + 0.5) * qs + lower;
283 }
284 }
285
286 mPlugin->setParameter(mParameters[p].identifier, val);
287 }
288 }
289
290 return true;
291}
static const AudacityProject::AttachedObjects::RegisteredFactory key
bool ReadEnum(const wxString &key, int *pi, const EnumValueSymbol choices[], size_t nChoices, const ObsoleteMap obsoletes[]=nullptr, size_t nObsoletes=0) const
Vamp::Plugin::ParameterList mParameters
Definition: VampEffect.h:106

References key, mParameters, mPlugin, and CommandParameters::ReadEnum().

Here is the call graph for this function:

◆ OnCheckBox()

void VampEffect::OnCheckBox ( wxCommandEvent &  evt)
private

Definition at line 762 of file VampEffect.cpp.

763{
764 int p = event.GetId() - ID_Toggles;
765
766 mPlugin->setParameter(mParameters[p].identifier, mToggles[p]->GetValue());
767}
@ ID_Toggles
Definition: VampEffect.cpp:47
ArrayOf< wxCheckBox * > mToggles
Definition: VampEffect.h:113

References ID_Toggles, mParameters, mPlugin, and mToggles.

◆ OnChoice()

void VampEffect::OnChoice ( wxCommandEvent &  evt)
private

Definition at line 769 of file VampEffect.cpp.

770{
771 int p = evt.GetId();
772
773 // special value for programs
774 if (p == ID_Program)
775 {
776 Vamp::Plugin::ProgramList programs = mPlugin->getPrograms();
777 mPlugin->selectProgram(programs[evt.GetInt()]);
779 return;
780 }
781
782 mPlugin->setParameter(mParameters[p - ID_Choices].identifier, evt.GetInt());
783}
@ ID_Choices
Definition: VampEffect.cpp:45
@ ID_Program
Definition: VampEffect.cpp:43
void UpdateFromPlugin()
Definition: VampEffect.cpp:719

References ID_Choices, ID_Program, mParameters, mPlugin, and UpdateFromPlugin().

Here is the call graph for this function:

◆ OnSlider()

void VampEffect::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 785 of file VampEffect.cpp.

786{
787 int p = evt.GetId() - ID_Sliders;
788
789 float lower = mParameters[p].minValue;
790 float upper = mParameters[p].maxValue;
791 float range = upper - lower;
792 float val = (evt.GetInt() / 1000.0) * range;
793
794 if (mParameters[p].isQuantized)
795 {
796 float qs = mParameters[p].quantizeStep;
797
798 if (qs != 0.0)
799 {
800 val = (int)(val / qs + 0.5) * qs;
801 }
802 }
803
804 val += lower;
805
806 mValues[p] = val;
807 mFields[p]->GetValidator()->TransferToWindow();
808
809 mPlugin->setParameter(mParameters[p].identifier, val);
810}
@ ID_Sliders
Definition: VampEffect.cpp:44
Floats mValues
Definition: VampEffect.h:108
ArrayOf< wxTextCtrl * > mFields
Definition: VampEffect.h:111

References ID_Sliders, mFields, mParameters, mPlugin, and mValues.

◆ OnTextCtrl()

void VampEffect::OnTextCtrl ( wxCommandEvent &  evt)
private

Definition at line 812 of file VampEffect.cpp.

813{
814 int p = evt.GetId() - ID_Texts;
815
816 mFields[p]->GetValidator()->TransferFromWindow();
817
818 float lower = mParameters[p].minValue;
819 float upper = mParameters[p].maxValue;
820 float range = upper - lower;
821 float val = mValues[p];
822
823 if (mParameters[p].isQuantized)
824 {
825 float qs = mParameters[p].quantizeStep;
826
827 if (qs != 0.0)
828 {
829 val = (int)((val - lower) / qs + 0.5) * qs + lower;
830 }
831 }
832
833 mPlugin->setParameter(mParameters[p].identifier, val);
834
835 mSliders[p]->SetValue((int)(((val - lower) / range) * 1000.0 + 0.5));
836}
@ ID_Texts
Definition: VampEffect.cpp:46
ArrayOf< wxSlider * > mSliders
Definition: VampEffect.h:110

References ID_Texts, mFields, mParameters, mPlugin, mSliders, and mValues.

◆ PopulateOrExchange()

std::unique_ptr< EffectEditor > VampEffect::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
)
overridevirtual

Add controls to effect panel; always succeeds.

Returns
if not null, then return it from PopulateUI instead of a DefaultEffectEditor; default implementation returns null

Reimplemented from StatefulEffectUIServices.

Definition at line 501 of file VampEffect.cpp.

504{
505 mUIParent = S.GetParent();
506 Vamp::Plugin::ProgramList programs = mPlugin->getPrograms();
507
508 mParameters = mPlugin->getParameterDescriptors();
509
510 auto count = mParameters.size();
511
512 mToggles.reinit( count );
513 mSliders.reinit( count );
514 mFields.reinit( count );
515 mLabels.reinit( count );
516 mChoices.reinit( count );
517 mValues.reinit( count );
518
519 wxScrolledWindow *scroller = S.Style(wxVSCROLL | wxTAB_TRAVERSAL)
520 .StartScroller(2);
521 {
522 S.StartStatic(XO("Plugin Settings"));
523 {
524 S.StartMultiColumn(5, wxEXPAND);
525 {
526 S.SetStretchyCol(3);
527
528 if (!programs.empty())
529 {
530 S.AddPrompt(XXO("Program"));
531
532 S.Id(ID_Program);
533 mProgram = S.Name(XO("Program"))
534 .MinSize( { -1, -1 } )
535 .Position(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL)
536 .AddChoice( {},
537 [&]{
538 TranslatableStrings choices;
539 for (const auto &program : programs)
540 choices.push_back(
541 Verbatim(wxString::FromUTF8(program.c_str())));
542 return choices;
543 }(),
544 Verbatim( wxString::FromUTF8(mPlugin->getCurrentProgram().c_str()) )
545 );
546
547 S.AddSpace(1, 1);
548 S.AddSpace(1, 1);
549 S.AddSpace(1, 1);
550 }
551
552 for (size_t p = 0; p < count; p++)
553 {
554 wxString tip = wxString::FromUTF8(mParameters[p].description.c_str());
555 wxString unit = wxString::FromUTF8(mParameters[p].unit.c_str());
556
557 float value = mPlugin->getParameter(mParameters[p].identifier);
558
559 mToggles[p] = NULL;
560 mChoices[p] = NULL;
561 mSliders[p] = NULL;
562 mFields[p] = NULL;
563 mValues[p] = 0.0;
564
565 wxString labelText = wxString::FromUTF8(mParameters[p].name.c_str());
566 if (!unit.empty())
567 {
568 labelText += wxT(" (") + unit + wxT(")");
569 }
570 /* i18n-hint: An item name introducing a value, which is not part of the string but
571 appears in a following text box window; translate with appropriate punctuation */
572 S.AddPrompt(XXO("%s:").Format( labelText ));
573
574 if (mParameters[p].isQuantized &&
575 mParameters[p].quantizeStep == 1.0 &&
576 mParameters[p].minValue == 0.0 &&
577 mParameters[p].maxValue == 1.0)
578 {
579 S.Id(ID_Toggles + p);
580 mToggles[p] = S.ToolTip( Verbatim( tip ) )
581 .Name( Verbatim( labelText ) )
582 .Position(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL)
583 .AddCheckBox( {},
584 value > 0.5 );
585
586 S.AddSpace(1, 1);
587 S.AddSpace(1, 1);
588 S.AddSpace(1, 1);
589
590 }
591 else if (mParameters[p].isQuantized &&
592 mParameters[p].quantizeStep == 1.0 &&
593 !mParameters[p].valueNames.empty())
594 {
595 TranslatableStrings choices;
596 int selected = -1;
597
598 for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++)
599 {
600 wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
601 if (size_t(value - mParameters[p].minValue + 0.5) == i)
602 {
603 selected = i;
604 }
605 choices.push_back( Verbatim( choice ) );
606 }
607
608 S.Id(ID_Choices + p);
609 mChoices[p] = S.ToolTip( Verbatim( tip ) )
610 .Name( Verbatim( labelText ) )
611 .Position(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL)
612 .MinSize( { -1, -1 } )
613 .AddChoice( {}, choices, selected );
614
615 S.AddSpace(1, 1);
616 S.AddSpace(1, 1);
617 S.AddSpace(1, 1);
618 }
619 else
620 {
621 mValues[p] = value;
622
623 float range = mParameters[p].maxValue - mParameters[p].minValue;
624
625 S.Id(ID_Texts + p);
626 mFields[p] = S.ToolTip( Verbatim( tip ) )
627 .Name( Verbatim( labelText ) )
628 .Position(wxALIGN_CENTER_VERTICAL | wxALL)
629 .Validator<FloatingPointValidator<float>>(
630 6, &mValues[p],
631 (range < 10
632 ? NumValidatorStyle::THREE_TRAILING_ZEROES
633 : range < 100
634 ? NumValidatorStyle::TWO_TRAILING_ZEROES
635 : NumValidatorStyle::ONE_TRAILING_ZERO),
636 mParameters[p].minValue, mParameters[p].maxValue)
637 .AddTextBox( {}, wxT(""), 12);
638
639 wxString str = Internat::ToDisplayString(mParameters[p].minValue);
640 S.AddPrompt( Verbatim( str ) );
641
642 S.Id(ID_Sliders + p);
643 mSliders[p] = S.ToolTip( Verbatim( tip ) )
644 .Name( Verbatim( labelText ) )
645 .Style(wxSL_HORIZONTAL)
646 .MinSize( { 150, -1 } )
647 .AddSlider( {}, 0, 1000, 0);
648
650 S.AddUnits( Verbatim( str ) );
651 }
652 }
653 }
654 S.EndMultiColumn();
655 }
656 S.EndStatic();
657 }
658 S.EndScroller();
659
660 scroller->SetScrollRate(0, 20);
661
662 return nullptr;
663}
#define str(a)
const TranslatableString name
Definition: Distortion.cpp:76
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64
std::vector< TranslatableString > TranslatableStrings
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:58
Abstract base class used in importing a file.
static wxString ToDisplayString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, uses the user's locale's decimal separator.
Definition: Internat.cpp:137
ArrayOf< wxChoice * > mChoices
Definition: VampEffect.h:114
ArrayOf< wxStaticText * > mLabels
Definition: VampEffect.h:112
wxChoice * mProgram
Definition: VampEffect.h:115
wxWeakRef< wxWindow > mUIParent
Definition: VampEffect.h:92

References ID_Choices, ID_Program, ID_Sliders, ID_Texts, ID_Toggles, mChoices, mFields, mLabels, mParameters, mPlugin, mProgram, mSliders, mToggles, mUIParent, mValues, name, ArrayOf< X >::reinit(), S, str, Internat::ToDisplayString(), Verbatim(), wxT(), XO(), and XXO().

Here is the call graph for this function:

◆ Process()

bool VampEffect::Process ( EffectInstance instance,
EffectSettings settings 
)
overridevirtual

!! todo: retain parameters previously set

Implements StatefulEffectBase.

Definition at line 319 of file VampEffect.cpp.

320{
321 if (!mPlugin)
322 {
323 return false;
324 }
325
326 int count = 0;
327
328 bool multiple = false;
329 unsigned prevTrackChannels = 0;
330
331 if (GetNumWaveGroups() > 1)
332 {
333 // if there is another track beyond this one and any linked one,
334 // then we're processing more than one track. That means we
335 // should use the originating track name in each NEW label
336 // track's name, to make clear which is which
337 multiple = true;
338 }
339
340 std::vector<std::shared_ptr<AddedAnalysisTrack>> addedTracks;
341
342 for (auto pTrack : inputTracks()->Any<const WaveTrack>())
343 {
344 auto channelGroup = pTrack->Channels();
345 auto left = *channelGroup.first++;
346
347 unsigned channels = 1;
348
349 // channelGroup now contains all but the first channel
350 const auto right =
351 channelGroup.size() ? *channelGroup.first++ : nullptr;
352 if (right)
353 channels = 2;
354
355 sampleCount start = 0;
356 sampleCount len = 0;
357 GetBounds(*pTrack, &start, &len);
358
359 // TODO: more-than-two-channels
360
361 size_t step = mPlugin->getPreferredStepSize();
362 size_t block = mPlugin->getPreferredBlockSize();
363
364 bool initialiseRequired = true;
365
366 if (block == 0)
367 {
368 if (step != 0)
369 {
370 block = step;
371 }
372 else
373 {
374 block = 1024;
375 }
376 }
377
378 if (step == 0)
379 {
380 step = block;
381 }
382
383 if (prevTrackChannels > 0)
384 {
385 // Plugin has already been initialised, so if the number of
386 // channels remains the same, we only need to do a reset.
387 // Otherwise we need to re-construct the whole plugin,
388 // because a Vamp plugin can't be re-initialised.
389 if (prevTrackChannels == channels)
390 {
391 mPlugin->reset();
392 initialiseRequired = false;
393 }
394 else
395 {
397 Init();
398 }
399 }
400
401 if (initialiseRequired)
402 {
403 if (!mPlugin->initialise(channels, step, block))
404 {
406 XO("Sorry, Vamp Plug-in failed to initialize."));
407 return false;
408 }
409 }
410
411 const auto effectName = GetSymbol().Translation();
412 addedTracks.push_back(AddAnalysisTrack(*this,
413 multiple
414 ? wxString::Format( _("%s: %s"), pTrack->GetName(), effectName )
415 : effectName
416 ));
417 LabelTrack *ltrack = addedTracks.back()->get();
418
419 FloatBuffers data{ channels, block };
420
421 auto originalLen = len;
422
423 auto pos = start;
424
425 while (len != 0)
426 {
427 const auto request = limitSampleBufferSize( block, len );
428
429 if (left)
430 left->GetFloats(data[0].get(), pos, request);
431
432 if (right)
433 right->GetFloats(data[1].get(), pos, request);
434
435 if (request < block)
436 {
437 for (unsigned int c = 0; c < channels; ++c)
438 {
439 for (decltype(block) i = request; i < block; ++i)
440 {
441 data[c][i] = 0.f;
442 }
443 }
444 }
445
446 // UNSAFE_SAMPLE_COUNT_TRUNCATION
447 // Truncation in case of very long tracks!
448 Vamp::RealTime timestamp = Vamp::RealTime::frame2RealTime(
449 long( pos.as_long_long() ),
450 (int)(mRate + 0.5)
451 );
452
453 Vamp::Plugin::FeatureSet features = mPlugin->process(
454 reinterpret_cast< float** >( data.get() ), timestamp);
455 AddFeatures(ltrack, features);
456
457 if (len > (int)step)
458 {
459 len -= step;
460 }
461 else
462 {
463 len = 0;
464 }
465
466 pos += step;
467
468 if (channels > 1)
469 {
470 if (TrackGroupProgress(count,
471 (pos - start).as_double() /
472 originalLen.as_double() ))
473 {
474 return false;
475 }
476 }
477 else
478 {
479 if (TrackProgress(count,
480 (pos - start).as_double() /
481 originalLen.as_double() ))
482 {
483 return false;
484 }
485 }
486 }
487
488 Vamp::Plugin::FeatureSet features = mPlugin->getRemainingFeatures();
489 AddFeatures(ltrack, features);
490
491 prevTrackChannels = channels;
492 }
493
494 // All completed without cancellation, so commit the addition of tracks now
495 for (auto &addedTrack : addedTracks)
496 addedTrack->Commit();
497
498 return true;
499}
std::shared_ptr< AddedAnalysisTrack > AddAnalysisTrack(Effect &effect, const wxString &name)
#define _(s)
Definition: Internat.h:73
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:22
const wxString Translation() const
bool TrackGroupProgress(int whichGroup, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:353
void GetBounds(const WaveTrack &track, sampleCount *start, sampleCount *len)
Definition: Effect.cpp:363
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:343
int GetNumWaveGroups() const
Definition: Effect.h:140
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
ComponentInterfaceSymbol GetSymbol() const override
Definition: VampEffect.cpp:90
bool Init() override
Definition: VampEffect.cpp:293
void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet &features)
Definition: VampEffect.cpp:689
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19

References _, AddAnalysisTrack(), AddFeatures(), EffectUIServices::DoMessageBox(), Effect::GetBounds(), Effect::GetNumWaveGroups(), GetSymbol(), Init(), EffectBase::inputTracks(), limitSampleBufferSize(), mPlugin, mRate, Effect::TrackGroupProgress(), Effect::TrackProgress(), ComponentInterfaceSymbol::Translation(), and XO().

Here is the call graph for this function:

◆ SaveSettings()

bool VampEffect::SaveSettings ( const EffectSettings settings,
CommandParameters parms 
) const
overridevirtual

Store settings as keys and values.

The override may assume parms is initially empty

Returns
true on success

Implements EffectSettingsManager.

Definition at line 140 of file VampEffect.cpp.

142{
143 for (size_t p = 0, paramCount = mParameters.size(); p < paramCount; p++)
144 {
145 wxString key = wxString::FromUTF8(mParameters[p].identifier.c_str());
146 float value = mPlugin->getParameter(mParameters[p].identifier);
147 float lower = mParameters[p].minValue;
148 float upper = mParameters[p].maxValue;
149
150 if (mParameters[p].isQuantized &&
151 mParameters[p].quantizeStep == 1.0 &&
152 lower == 0.0 &&
153 upper == 1.0)
154 {
155 bool val = value > 0.5;
156
157 parms.Write(key, val);
158 }
159 else if (mParameters[p].isQuantized &&
160 mParameters[p].quantizeStep == 1.0 &&
161 !mParameters[p].valueNames.empty())
162 {
163 std::vector<EnumValueSymbol> choices;
164 int val = 0;
165
166 for (size_t i = 0, choiceCount = mParameters[p].valueNames.size(); i < choiceCount; i++)
167 {
168 wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
169 if (size_t(value - mParameters[p].minValue + 0.5) == i)
170 {
171 val = i;
172 }
173 choices.push_back(choice);
174 }
175
176 parms.WriteEnum(key, val, choices.data(), choices.size());
177 }
178 else
179 {
180 parms.Write(key, value);
181 }
182 }
183
184 return true;
185}
bool WriteEnum(const wxString &key, int value, const EnumValueSymbol choices[], size_t nChoices)

References key, mParameters, mPlugin, and CommandParameters::WriteEnum().

Here is the call graph for this function:

◆ TransferDataFromWindow()

bool VampEffect::TransferDataFromWindow ( EffectSettings settings)
overridevirtual

Update the given settings from controls; default does nothing, returns true

Reimplemented from StatefulEffectUIServices.

Definition at line 677 of file VampEffect.cpp.

678{
679 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
680 {
681 return false;
682 }
683
684 return true;
685}

References mUIParent.

◆ TransferDataToWindow()

bool VampEffect::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings; default does nothing, returns true

Reimplemented from StatefulEffectUIServices.

Definition at line 665 of file VampEffect.cpp.

666{
667 if (!mUIParent->TransferDataToWindow())
668 {
669 return false;
670 }
671
673
674 return true;
675}

References mUIParent, and UpdateFromPlugin().

Here is the call graph for this function:

◆ UpdateFromPlugin()

void VampEffect::UpdateFromPlugin ( )
private

Definition at line 719 of file VampEffect.cpp.

720{
721 for (size_t p = 0, cnt = mParameters.size(); p < cnt; p++)
722 {
723 float value = mPlugin->getParameter(mParameters[p].identifier);
724
725 if (mParameters[p].isQuantized &&
726 mParameters[p].quantizeStep == 1.0 &&
727 mParameters[p].minValue == 0.0 &&
728 mParameters[p].maxValue == 1.0)
729 {
730 mToggles[p]->SetValue(value > 0.5);
731 }
732 else if (mParameters[p].isQuantized &&
733 mParameters[p].quantizeStep == 1.0 &&
734 !mParameters[p].valueNames.empty())
735 {
736 mChoices[p]->SetSelection(size_t(value - mParameters[p].minValue + 0.5));
737 }
738 else
739 {
740 mValues[p] = value;
741 mFields[p]->GetValidator()->TransferToWindow();
742
743 float lower = mParameters[p].minValue;
744 float upper = mParameters[p].maxValue;
745 float range = upper - lower;
746
747 if (mParameters[p].isQuantized)
748 {
749 float qs = mParameters[p].quantizeStep;
750
751 if (qs != 0.0)
752 {
753 value = (int)((value - lower) / qs + 0.5) * qs + lower;
754 }
755 }
756
757 mSliders[p]->SetValue((int)(((value - lower) / range) * 1000.0 + 0.5));
758 }
759 }
760}

References mChoices, mFields, mParameters, mPlugin, mSliders, mToggles, and mValues.

Referenced by OnChoice(), and TransferDataToWindow().

Here is the caller graph for this function:

Member Data Documentation

◆ mChoices

ArrayOf<wxChoice *> VampEffect::mChoices
private

Definition at line 114 of file VampEffect.h.

Referenced by PopulateOrExchange(), and UpdateFromPlugin().

◆ mFields

ArrayOf<wxTextCtrl *> VampEffect::mFields
private

Definition at line 111 of file VampEffect.h.

Referenced by OnSlider(), OnTextCtrl(), PopulateOrExchange(), and UpdateFromPlugin().

◆ mHasParameters

bool VampEffect::mHasParameters
private

Definition at line 97 of file VampEffect.h.

Referenced by IsInteractive().

◆ mInSlider

bool VampEffect::mInSlider
private

Definition at line 103 of file VampEffect.h.

◆ mInText

bool VampEffect::mInText
private

Definition at line 104 of file VampEffect.h.

◆ mKey

Vamp::HostExt::PluginLoader::PluginKey VampEffect::mKey
private

Definition at line 99 of file VampEffect.h.

Referenced by Init().

◆ mLabels

ArrayOf<wxStaticText *> VampEffect::mLabels
private

Definition at line 112 of file VampEffect.h.

Referenced by PopulateOrExchange().

◆ mName

wxString VampEffect::mName
private

Definition at line 100 of file VampEffect.h.

Referenced by GetSymbol().

◆ mOutput

int VampEffect::mOutput
private

Definition at line 96 of file VampEffect.h.

Referenced by AddFeatures().

◆ mParameters

Vamp::Plugin::ParameterList VampEffect::mParameters
private

◆ mPath

PluginPath VampEffect::mPath
private

Definition at line 95 of file VampEffect.h.

Referenced by GetPath().

◆ mPlugin

std::unique_ptr<Vamp::Plugin> VampEffect::mPlugin
private

◆ mProgram

wxChoice* VampEffect::mProgram
private

Definition at line 115 of file VampEffect.h.

Referenced by PopulateOrExchange().

◆ mRate

double VampEffect::mRate
private

Definition at line 101 of file VampEffect.h.

Referenced by Init(), and Process().

◆ mSliders

ArrayOf<wxSlider *> VampEffect::mSliders
private

Definition at line 110 of file VampEffect.h.

Referenced by OnTextCtrl(), PopulateOrExchange(), and UpdateFromPlugin().

◆ mToggles

ArrayOf<wxCheckBox *> VampEffect::mToggles
private

Definition at line 113 of file VampEffect.h.

Referenced by OnCheckBox(), PopulateOrExchange(), and UpdateFromPlugin().

◆ mUIParent

wxWeakRef<wxWindow> VampEffect::mUIParent {}
private

Definition at line 92 of file VampEffect.h.

Referenced by PopulateOrExchange(), TransferDataFromWindow(), and TransferDataToWindow().

◆ mValues

Floats VampEffect::mValues
private

Definition at line 108 of file VampEffect.h.

Referenced by OnSlider(), OnTextCtrl(), PopulateOrExchange(), and UpdateFromPlugin().


The documentation for this class was generated from the following files: