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
 Call once to set up state for whole list of tracks to be processed. More...
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 Actually do the effect here. More...
 
std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
- Public Member Functions inherited from StatefulEffect
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 ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 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
 
- 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
 
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...
 
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...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
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...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool 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, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- 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...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. 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...
 
- 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
 

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

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 Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , Since_3_2 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- 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 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 EnablePreview (bool enable=true)
 
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...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)
 Add controls to effect panel; always succeeds. 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, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Protected Attributes inherited from EffectUIClientInterface
friend EffectUIValidator
 
friend DefaultEffectUIValidator
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

Definition at line 37 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 68 of file VampEffect.cpp.

72: mPlugin(std::move(plugin)),
73 mPath(path),
74 mOutput(output),
75 mHasParameters(hasParameters),
76 mRate(0)
77{
78 mKey = mPath.BeforeLast(wxT('/')).ToUTF8();
79 mName = mPath.AfterLast(wxT('/'));
80}
double mRate
Definition: VampEffect.h:97
PluginPath mPath
Definition: VampEffect.h:91
int mOutput
Definition: VampEffect.h:92
wxString mName
Definition: VampEffect.h:96
std::unique_ptr< Vamp::Plugin > mPlugin
Definition: VampEffect.h:90
bool mHasParameters
Definition: VampEffect.h:93
Vamp::HostExt::PluginLoader::PluginKey mKey
Definition: VampEffect.h:95

◆ ~VampEffect()

VampEffect::~VampEffect ( )
virtual

Definition at line 82 of file VampEffect.cpp.

83{
84}

Member Function Documentation

◆ AddFeatures()

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

Definition at line 699 of file VampEffect.cpp.

701{
702 for (Vamp::Plugin::FeatureList::iterator fli = features[mOutput].begin();
703 fli != features[mOutput].end(); ++fli)
704 {
705 Vamp::RealTime ftime0 = fli->timestamp;
706 double ltime0 = ftime0.sec + (double(ftime0.nsec) / 1000000000.0);
707
708 Vamp::RealTime ftime1 = ftime0;
709 if (fli->hasDuration) ftime1 = ftime0 + fli->duration;
710 double ltime1 = ftime1.sec + (double(ftime1.nsec) / 1000000000.0);
711
712 wxString label = LAT1CTOWX(fli->label.c_str());
713 if (label == wxString())
714 {
715 if (fli->values.empty())
716 {
717 label = wxString::Format(LAT1CTOWX("%.3f"), ltime0);
718 }
719 else
720 {
721 label = wxString::Format(LAT1CTOWX("%.3f"), *fli->values.begin());
722 }
723 }
724
725 ltrack->AddLabel(SelectedRegion(ltime0, ltime1), label);
726 }
727}
#define LAT1CTOWX(X)
Definition: Internat.h:160
TranslatableString label
Definition: TagsEditor.cpp:163
Defines a selected portion of a project.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150

References LabelTrack::AddLabel(), PackedArray::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 effect ALWAYS processes channels independently, this can return 1

Reimplemented from Effect.

Definition at line 140 of file VampEffect.cpp.

141{
142 return mPlugin->getMaxChannelCount();
143}

References mPlugin.

◆ GetDescription()

TranslatableString VampEffect::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 110 of file VampEffect.cpp.

111{
112 return Verbatim(
113 wxString::FromUTF8(mPlugin->getCopyright().c_str()) );
114}
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.

Reimplemented from Effect.

Definition at line 125 of file VampEffect.cpp.

126{
127 return VAMPEFFECTS_FAMILY;
128}
#define VAMPEFFECTS_FAMILY
Definition: VampEffect.h:35

References VAMPEFFECTS_FAMILY.

◆ GetPath()

PluginPath VampEffect::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 90 of file VampEffect.cpp.

91{
92 return mPath;
93}

References mPath.

◆ GetSymbol()

ComponentInterfaceSymbol VampEffect::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 95 of file VampEffect.cpp.

96{
97 return mName;
98}

References mName.

Referenced by Process().

Here is the caller graph for this function:

◆ GetType()

EffectType VampEffect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 120 of file VampEffect.cpp.

121{
122 return EffectTypeAnalyze;
123}
@ EffectTypeAnalyze

References EffectTypeAnalyze.

◆ GetVendor()

VendorSymbol VampEffect::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 100 of file VampEffect.cpp.

101{
102 return { wxString::FromUTF8(mPlugin->getMaker().c_str()) };
103}

References mPlugin.

◆ GetVersion()

wxString VampEffect::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 105 of file VampEffect.cpp.

106{
107 return wxString::Format(wxT("%d"), mPlugin->getPluginVersion());
108}

References mPlugin.

◆ Init()

bool VampEffect::Init ( )
overridevirtual

Call once to set up state for whole list of tracks to be processed.

Returns
success Default implementation does nothing, returns true Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 298 of file VampEffect.cpp.

299{
300 mRate = 0.0;
301
302 // PRL: this loop checked that channels of a track have the same rate,
303 // but there was no check that all tracks have one rate, and only the first
304 // is remembered in mRate. Is that correct?
305
306 for (auto leader : inputTracks()->Leaders<const WaveTrack>()) {
307 auto channelGroup = TrackList::Channels( leader );
308 auto rate = (*channelGroup.first++) -> GetRate();
309 for(auto channel : channelGroup) {
310 if (rate != channel->GetRate())
311 // PRL: Track rate might not match individual clip rates.
312 // So is this check not adequate?
313 {
314 // TODO: more-than-two-channels-message
316 XO(
317"Sorry, Vamp Plug-ins cannot be run on stereo tracks where the individual channels of the track do not match.") );
318 return false;
319 }
320 }
321 if (mRate == 0.0)
322 mRate = rate;
323 }
324
325 if (mRate <= 0.0)
326 {
328 }
329
330 // The plugin must be reloaded to allow changing parameters
331
332 Vamp::HostExt::PluginLoader *loader = Vamp::HostExt::PluginLoader::getInstance();
333 mPlugin.reset(loader->loadPlugin(mKey, mRate, Vamp::HostExt::PluginLoader::ADAPT_ALL));
334 if (!mPlugin)
335 {
336 Effect::MessageBox( XO("Sorry, failed to load Vamp Plug-in.") );
337 return false;
338 }
339
340 return true;
341}
#define XO(s)
Definition: Internat.h:31
const TrackList * inputTracks() const
Definition: EffectBase.h:102
double mProjectRate
Definition: EffectBase.h:99
int MessageBox(const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
Definition: Effect.cpp:871
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1539

References TrackList::Channels(), anonymous_namespace{TimeTrack.cpp}::GetRate(), EffectBase::inputTracks(), Effect::MessageBox(), 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.

Reimplemented from Effect.

Definition at line 135 of file VampEffect.cpp.

136{
137 return false;
138}

◆ IsInteractive()

bool VampEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 130 of file VampEffect.cpp.

131{
132 return mHasParameters;
133}

References mHasParameters.

◆ LoadSettings()

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

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 192 of file VampEffect.cpp.

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

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 772 of file VampEffect.cpp.

773{
774 int p = event.GetId() - ID_Toggles;
775
776 mPlugin->setParameter(mParameters[p].identifier, mToggles[p]->GetValue());
777}
@ ID_Toggles
Definition: VampEffect.cpp:52
ArrayOf< wxCheckBox * > mToggles
Definition: VampEffect.h:109

References ID_Toggles, mParameters, mPlugin, and mToggles.

◆ OnChoice()

void VampEffect::OnChoice ( wxCommandEvent &  evt)
private

Definition at line 779 of file VampEffect.cpp.

780{
781 int p = evt.GetId();
782
783 // special value for programs
784 if (p == ID_Program)
785 {
786 Vamp::Plugin::ProgramList programs = mPlugin->getPrograms();
787 mPlugin->selectProgram(programs[evt.GetInt()]);
789 return;
790 }
791
792 mPlugin->setParameter(mParameters[p - ID_Choices].identifier, evt.GetInt());
793}
@ ID_Choices
Definition: VampEffect.cpp:50
@ ID_Program
Definition: VampEffect.cpp:48
void UpdateFromPlugin()
Definition: VampEffect.cpp:729

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 795 of file VampEffect.cpp.

796{
797 int p = evt.GetId() - ID_Sliders;
798
799 float lower = mParameters[p].minValue;
800 float upper = mParameters[p].maxValue;
801 float range = upper - lower;
802 float val = (evt.GetInt() / 1000.0) * range;
803
804 if (mParameters[p].isQuantized)
805 {
806 float qs = mParameters[p].quantizeStep;
807
808 if (qs != 0.0)
809 {
810 val = (int)(val / qs + 0.5) * qs;
811 }
812 }
813
814 val += lower;
815
816 mValues[p] = val;
817 mFields[p]->GetValidator()->TransferToWindow();
818
819 mPlugin->setParameter(mParameters[p].identifier, val);
820}
@ ID_Sliders
Definition: VampEffect.cpp:49
Floats mValues
Definition: VampEffect.h:104
ArrayOf< wxTextCtrl * > mFields
Definition: VampEffect.h:107

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

◆ OnTextCtrl()

void VampEffect::OnTextCtrl ( wxCommandEvent &  evt)
private

Definition at line 822 of file VampEffect.cpp.

823{
824 int p = evt.GetId() - ID_Texts;
825
826 mFields[p]->GetValidator()->TransferFromWindow();
827
828 float lower = mParameters[p].minValue;
829 float upper = mParameters[p].maxValue;
830 float range = upper - lower;
831 float val = mValues[p];
832
833 if (mParameters[p].isQuantized)
834 {
835 float qs = mParameters[p].quantizeStep;
836
837 if (qs != 0.0)
838 {
839 val = (int)((val - lower) / qs + 0.5) * qs + lower;
840 }
841 }
842
843 mPlugin->setParameter(mParameters[p].identifier, val);
844
845 mSliders[p]->SetValue((int)(((val - lower) / range) * 1000.0 + 0.5));
846}
@ ID_Texts
Definition: VampEffect.cpp:51
ArrayOf< wxSlider * > mSliders
Definition: VampEffect.h:106

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

◆ PopulateOrExchange()

std::unique_ptr< EffectUIValidator > VampEffect::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access 
)
overridevirtual

Add controls to effect panel; always succeeds.

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

Reimplemented from Effect.

Definition at line 529 of file VampEffect.cpp.

531{
532 Vamp::Plugin::ProgramList programs = mPlugin->getPrograms();
533
534 mParameters = mPlugin->getParameterDescriptors();
535
536 auto count = mParameters.size();
537
538 mToggles.reinit( count );
539 mSliders.reinit( count );
540 mFields.reinit( count );
541 mLabels.reinit( count );
542 mChoices.reinit( count );
543 mValues.reinit( count );
544
545 wxScrolledWindow *scroller = S.Style(wxVSCROLL | wxTAB_TRAVERSAL)
546 .StartScroller(2);
547 {
548 S.StartStatic(XO("Plugin Settings"));
549 {
550 S.StartMultiColumn(5, wxEXPAND);
551 {
552 S.SetStretchyCol(3);
553
554 if (!programs.empty())
555 {
556 S.AddPrompt(XXO("Program"));
557
558 S.Id(ID_Program);
559 mProgram = S.Name(XO("Program"))
560 .MinSize( { -1, -1 } )
561 .Position(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL)
562 .AddChoice( {},
563 [&]{
564 TranslatableStrings choices;
565 for (const auto &program : programs)
566 choices.push_back(
567 Verbatim(wxString::FromUTF8(program.c_str())));
568 return choices;
569 }(),
570 Verbatim( wxString::FromUTF8(mPlugin->getCurrentProgram().c_str()) )
571 );
572
573 S.AddSpace(1, 1);
574 S.AddSpace(1, 1);
575 S.AddSpace(1, 1);
576 }
577
578 for (size_t p = 0; p < count; p++)
579 {
580 wxString tip = wxString::FromUTF8(mParameters[p].description.c_str());
581 wxString unit = wxString::FromUTF8(mParameters[p].unit.c_str());
582
583 float value = mPlugin->getParameter(mParameters[p].identifier);
584
585 mToggles[p] = NULL;
586 mChoices[p] = NULL;
587 mSliders[p] = NULL;
588 mFields[p] = NULL;
589 mValues[p] = 0.0;
590
591 wxString labelText = wxString::FromUTF8(mParameters[p].name.c_str());
592 if (!unit.empty())
593 {
594 labelText += wxT(" (") + unit + wxT(")");
595 }
596 /* i18n-hint: An item name introducing a value, which is not part of the string but
597 appears in a following text box window; translate with appropriate punctuation */
598 S.AddPrompt(XXO("%s:").Format( labelText ));
599
600 if (mParameters[p].isQuantized &&
601 mParameters[p].quantizeStep == 1.0 &&
602 mParameters[p].minValue == 0.0 &&
603 mParameters[p].maxValue == 1.0)
604 {
605 S.Id(ID_Toggles + p);
606 mToggles[p] = S.ToolTip( Verbatim( tip ) )
607 .Name( Verbatim( labelText ) )
608 .Position(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL)
609 .AddCheckBox( {},
610 value > 0.5 );
611
612 S.AddSpace(1, 1);
613 S.AddSpace(1, 1);
614 S.AddSpace(1, 1);
615
616 }
617 else if (mParameters[p].isQuantized &&
618 mParameters[p].quantizeStep == 1.0 &&
619 !mParameters[p].valueNames.empty())
620 {
621 TranslatableStrings choices;
622 int selected = -1;
623
624 for (size_t i = 0, cnt = mParameters[p].valueNames.size(); i < cnt; i++)
625 {
626 wxString choice = wxString::FromUTF8(mParameters[p].valueNames[i].c_str());
627 if (size_t(value - mParameters[p].minValue + 0.5) == i)
628 {
629 selected = i;
630 }
631 choices.push_back( Verbatim( choice ) );
632 }
633
634 S.Id(ID_Choices + p);
635 mChoices[p] = S.ToolTip( Verbatim( tip ) )
636 .Name( Verbatim( labelText ) )
637 .Position(wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL)
638 .MinSize( { -1, -1 } )
639 .AddChoice( {}, choices, selected );
640
641 S.AddSpace(1, 1);
642 S.AddSpace(1, 1);
643 S.AddSpace(1, 1);
644 }
645 else
646 {
647 mValues[p] = value;
648
649 float range = mParameters[p].maxValue - mParameters[p].minValue;
650
651 S.Id(ID_Texts + p);
652 mFields[p] = S.ToolTip( Verbatim( tip ) )
653 .Name( Verbatim( labelText ) )
654 .Position(wxALIGN_CENTER_VERTICAL | wxALL)
655 .Validator<FloatingPointValidator<float>>(
656 6, &mValues[p],
657 (range < 10
658 ? NumValidatorStyle::THREE_TRAILING_ZEROES
659 : range < 100
660 ? NumValidatorStyle::TWO_TRAILING_ZEROES
661 : NumValidatorStyle::ONE_TRAILING_ZERO),
662 mParameters[p].minValue, mParameters[p].maxValue)
663 .AddTextBox( {}, wxT(""), 12);
664
665 wxString str = Internat::ToDisplayString(mParameters[p].minValue);
666 S.AddPrompt( Verbatim( str ) );
667
668 S.Id(ID_Sliders + p);
669 mSliders[p] = S.ToolTip( Verbatim( tip ) )
670 .Name( Verbatim( labelText ) )
671 .Style(wxSL_HORIZONTAL)
672 .MinSize( { 150, -1 } )
673 .AddSlider( {}, 0, 1000, 0);
674
676 S.AddUnits( Verbatim( str ) );
677 }
678 }
679 }
680 S.EndMultiColumn();
681 }
682 S.EndStatic();
683 }
684 S.EndScroller();
685
686 scroller->SetScrollRate(0, 20);
687
688 return nullptr;
689}
#define str(a)
const TranslatableString name
Definition: Distortion.cpp:82
#define XXO(s)
Definition: Internat.h:44
#define S(N)
Definition: ToChars.cpp:64
std::vector< TranslatableString > TranslatableStrings
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
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:162
ArrayOf< wxChoice * > mChoices
Definition: VampEffect.h:110
ArrayOf< wxStaticText * > mLabels
Definition: VampEffect.h:108
wxChoice * mProgram
Definition: VampEffect.h:111

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

Here is the call graph for this function:

◆ Process()

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

Actually do the effect here.

Returns
success

!! todo: retain parameters previously set

Implements StatefulEffectBase.

Definition at line 343 of file VampEffect.cpp.

344{
345 if (!mPlugin)
346 {
347 return false;
348 }
349
350 int count = 0;
351
352 bool multiple = false;
353 unsigned prevTrackChannels = 0;
354
355 if (GetNumWaveGroups() > 1)
356 {
357 // if there is another track beyond this one and any linked one,
358 // then we're processing more than one track. That means we
359 // should use the originating track name in each NEW label
360 // track's name, to make clear which is which
361 multiple = true;
362 }
363
364 std::vector<std::shared_ptr<Effect::AddedAnalysisTrack>> addedTracks;
365
366 for (auto leader : inputTracks()->Leaders<const WaveTrack>())
367 {
368 auto channelGroup = TrackList::Channels(leader);
369 auto left = *channelGroup.first++;
370
371 unsigned channels = 1;
372
373 // channelGroup now contains all but the first channel
374 const WaveTrack *right =
375 channelGroup.size() ? *channelGroup.first++ : nullptr;
376 if (right)
377 channels = 2;
378
379 sampleCount start = 0;
380 sampleCount len = 0;
381 GetBounds(*left, right, &start, &len);
382
383 // TODO: more-than-two-channels
384
385 size_t step = mPlugin->getPreferredStepSize();
386 size_t block = mPlugin->getPreferredBlockSize();
387
388 bool initialiseRequired = true;
389
390 if (block == 0)
391 {
392 if (step != 0)
393 {
394 block = step;
395 }
396 else
397 {
398 block = 1024;
399 }
400 }
401
402 if (step == 0)
403 {
404 step = block;
405 }
406
407 if (prevTrackChannels > 0)
408 {
409 // Plugin has already been initialised, so if the number of
410 // channels remains the same, we only need to do a reset.
411 // Otherwise we need to re-construct the whole plugin,
412 // because a Vamp plugin can't be re-initialised.
413 if (prevTrackChannels == channels)
414 {
415 mPlugin->reset();
416 initialiseRequired = false;
417 }
418 else
419 {
421 Init();
422 }
423 }
424
425 if (initialiseRequired)
426 {
427 if (!mPlugin->initialise(channels, step, block))
428 {
430 XO("Sorry, Vamp Plug-in failed to initialize.") );
431 return false;
432 }
433 }
434
435 const auto effectName = GetSymbol().Translation();
436 addedTracks.push_back(AddAnalysisTrack(
437 multiple
438 ? wxString::Format( _("%s: %s"), left->GetName(), effectName )
439 : effectName
440 ));
441 LabelTrack *ltrack = addedTracks.back()->get();
442
443 FloatBuffers data{ channels, block };
444
445 auto originalLen = len;
446
447 auto pos = start;
448
449 while (len != 0)
450 {
451 const auto request = limitSampleBufferSize( block, len );
452
453 if (left)
454 {
455 left->GetFloats(data[0].get(), pos, request);
456 }
457
458 if (right)
459 {
460 right->GetFloats(data[1].get(), pos, request);
461 }
462
463 if (request < block)
464 {
465 for (unsigned int c = 0; c < channels; ++c)
466 {
467 for (decltype(block) i = request; i < block; ++i)
468 {
469 data[c][i] = 0.f;
470 }
471 }
472 }
473
474 // UNSAFE_SAMPLE_COUNT_TRUNCATION
475 // Truncation in case of very long tracks!
476 Vamp::RealTime timestamp = Vamp::RealTime::frame2RealTime(
477 long( pos.as_long_long() ),
478 (int)(mRate + 0.5)
479 );
480
481 Vamp::Plugin::FeatureSet features = mPlugin->process(
482 reinterpret_cast< float** >( data.get() ), timestamp);
483 AddFeatures(ltrack, features);
484
485 if (len > (int)step)
486 {
487 len -= step;
488 }
489 else
490 {
491 len = 0;
492 }
493
494 pos += step;
495
496 if (channels > 1)
497 {
498 if (TrackGroupProgress(count,
499 (pos - start).as_double() /
500 originalLen.as_double() ))
501 {
502 return false;
503 }
504 }
505 else
506 {
507 if (TrackProgress(count,
508 (pos - start).as_double() /
509 originalLen.as_double() ))
510 {
511 return false;
512 }
513 }
514 }
515
516 Vamp::Plugin::FeatureSet features = mPlugin->getRemainingFeatures();
517 AddFeatures(ltrack, features);
518
519 prevTrackChannels = channels;
520 }
521
522 // All completed without cancellation, so commit the addition of tracks now
523 for (auto &addedTrack : addedTracks)
524 addedTrack->Commit();
525
526 return true;
527}
#define _(s)
Definition: Internat.h:75
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:23
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:251
const wxString Translation() const
bool TrackGroupProgress(int whichGroup, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:702
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Definition: Effect.cpp:693
void GetBounds(const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
Definition: Effect.cpp:711
std::shared_ptr< AddedAnalysisTrack > AddAnalysisTrack(const wxString &name=wxString())
Definition: Effect.cpp:804
int GetNumWaveGroups() const
Definition: Effect.h:188
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
bool GetFloats(float *buffer, sampleCount start, size_t len, fillFormat fill=fillZero, bool mayThrow=true, sampleCount *pNumWithinClips=nullptr) const
Retrieve samples from a track in floating-point format, regardless of the storage format.
Definition: SampleTrack.h:67
ComponentInterfaceSymbol GetSymbol() const override
Definition: VampEffect.cpp:95
bool Init() override
Call once to set up state for whole list of tracks to be processed.
Definition: VampEffect.cpp:298
void AddFeatures(LabelTrack *track, Vamp::Plugin::FeatureSet &features)
Definition: VampEffect.cpp:699
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18

References _, Effect::AddAnalysisTrack(), AddFeatures(), TrackList::Channels(), Effect::GetBounds(), SampleTrack::GetFloats(), Effect::GetNumWaveGroups(), GetSymbol(), Init(), EffectBase::inputTracks(), limitSampleBufferSize(), Effect::MessageBox(), mPlugin, mRate, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), 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

Reimplemented from Effect.

Definition at line 145 of file VampEffect.cpp.

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

◆ TransferDataToWindow()

bool VampEffect::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings.

Reimplemented from Effect.

Definition at line 691 of file VampEffect.cpp.

692{
694 return true;
695}

References UpdateFromPlugin().

Here is the call graph for this function:

◆ UpdateFromPlugin()

void VampEffect::UpdateFromPlugin ( )
private

Definition at line 729 of file VampEffect.cpp.

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

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 110 of file VampEffect.h.

Referenced by PopulateOrExchange(), and UpdateFromPlugin().

◆ mFields

ArrayOf<wxTextCtrl *> VampEffect::mFields
private

Definition at line 107 of file VampEffect.h.

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

◆ mHasParameters

bool VampEffect::mHasParameters
private

Definition at line 93 of file VampEffect.h.

Referenced by IsInteractive().

◆ mInSlider

bool VampEffect::mInSlider
private

Definition at line 99 of file VampEffect.h.

◆ mInText

bool VampEffect::mInText
private

Definition at line 100 of file VampEffect.h.

◆ mKey

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

Definition at line 95 of file VampEffect.h.

Referenced by Init().

◆ mLabels

ArrayOf<wxStaticText *> VampEffect::mLabels
private

Definition at line 108 of file VampEffect.h.

Referenced by PopulateOrExchange().

◆ mName

wxString VampEffect::mName
private

Definition at line 96 of file VampEffect.h.

Referenced by GetSymbol().

◆ mOutput

int VampEffect::mOutput
private

Definition at line 92 of file VampEffect.h.

Referenced by AddFeatures().

◆ mParameters

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

◆ mPath

PluginPath VampEffect::mPath
private

Definition at line 91 of file VampEffect.h.

Referenced by GetPath().

◆ mPlugin

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

◆ mProgram

wxChoice* VampEffect::mProgram
private

Definition at line 111 of file VampEffect.h.

Referenced by PopulateOrExchange().

◆ mRate

double VampEffect::mRate
private

Definition at line 97 of file VampEffect.h.

Referenced by Init(), and Process().

◆ mSliders

ArrayOf<wxSlider *> VampEffect::mSliders
private

Definition at line 106 of file VampEffect.h.

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

◆ mToggles

ArrayOf<wxCheckBox *> VampEffect::mToggles
private

Definition at line 109 of file VampEffect.h.

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

◆ mValues

Floats VampEffect::mValues
private

Definition at line 104 of file VampEffect.h.

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


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