Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
VSTEffectBase Class Reference

#include <VSTEffectBase.h>

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

Public Member Functions

 VSTEffectBase (const PluginPath &path)
 
 ~VSTEffectBase () override
 
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...
 
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
 
bool DoLoadFactoryPreset (int id)
 
bool InitializePlugin ()
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
EffectSettings MakeSettings () const override
 
std::vector< int > GetEffectIDs ()
 
- Public Member Functions inherited from VSTWrapper
 VSTWrapper (const PluginPath &path)
 
 ~VSTWrapper ()
 
intptr_t callDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) override
 
intptr_t constCallDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) const
 
float callGetParameter (int index) const
 
void callSetChunk (bool isPgm, int len, void *buf)
 
void callSetChunk (bool isPgm, int len, void *buf, VstPatchChunkInfo *info) const
 
int GetString (wxString &outstr, int opcode, int index=0) const
 
wxString GetString (int opcode, int index=0) const
 
void ForEachParameter (ParameterVisitor visitor) const
 
bool FetchSettings (VSTSettings &vst3Settings, bool doFetch=true) const
 
bool StoreSettings (const VSTSettings &vst3settings) const
 
VstPatchChunkInfo GetChunkInfo () const
 
bool IsCompatible (const VstPatchChunkInfo &) const
 
bool LoadXML (const wxFileName &fn)
 
bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override
 
void HandleXMLEndTag (const std::string_view &tag) override
 
void HandleXMLContent (const std::string_view &content) override
 
XMLTagHandlerHandleXMLChild (const std::string_view &tag) override
 
void SetString (int opcode, const wxString &str, int index=0)
 
ComponentInterfaceSymbol GetSymbol () const
 
void callSetParameter (int index, float value) const
 
void SaveXML (const wxFileName &fn) const
 
bool LoadFXB (const wxFileName &fn)
 
bool LoadFXP (const wxFileName &fn)
 
bool LoadFXProgram (unsigned char **bptr, ssize_t &len, int index, bool dryrun)
 
void callSetProgram (int index)
 
void SaveFXB (const wxFileName &fn) const
 
void SaveFXP (const wxFileName &fn) const
 
void SaveFXProgram (wxMemoryBuffer &buf, int index) const
 
bool Load ()
 
void Unload ()
 
void ResetModuleAndHandle ()
 
VstTimeInfoGetTimeInfo ()
 
float GetSampleRate ()
 
int GetProcessLevel ()
 
virtual void SetBufferDelay (int samples)
 
std::unique_ptr< EffectInstance::MessageMakeMessageFS (const VSTSettings &settings) const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 
- Public Member Functions inherited from VSTUIWrapper
virtual void Idle ()
 
virtual void NeedIdle ()
 
virtual void SizeWindow (int w, int h)
 
virtual void Automate (int index, float value)
 
virtual void Flush ()
 
- Public Member Functions inherited from PerTrackEffect
 ~PerTrackEffect () override
 
- 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 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
 

Private Attributes

PluginID mID
 

Additional Inherited Members

- Public Types inherited from VSTWrapper
using ParameterVisitor = std::function< bool(const ParameterInfo &pi) >
 
using ModuleHandle = std::unique_ptr< wxDynamicLibrary >
 
using BundleHandle = CF_ptr< CFBundleRef >
 
- 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...
 
- Static Public Member Functions inherited from VSTWrapper
static VSTSettingsGetSettings (EffectSettings &settings)
 
static const VSTSettingsGetSettings (const EffectSettings &settings)
 
static intptr_t AudioMaster (AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr, float opt)
 
- 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...
 
- Public Attributes inherited from VSTWrapper
AEffectmAEffect = nullptr
 
std::thread::id mMainThreadId
 
std::recursive_mutex mDispatcherLock
 
int mVstVersion
 
wxString mName
 
bool mInSet
 
bool mInChunk
 
wxString mChunk
 
long mXMLVersion
 
VstPatchChunkInfo mXMLInfo
 
intptr_t mCurrentEffectID {}
 
PluginPath mPath
 
ModuleHandle mModule {}
 
wxString mVendor
 
wxString mDescription
 
int mVersion
 
bool mInteractive { false }
 
unsigned mAudioIns { 0 }
 
unsigned mAudioOuts { 0 }
 
int mMidiIns { 0 }
 
int mMidiOuts { 0 }
 
bool mAutomatable
 
BundleHandle mBundleRef
 
ResourceHandle mResource
 
VstTimeInfo mTimeInfo
 
int mBufferDelay { 0 }
 
int mProcessLevel { 1 }
 
bool mGui { false }
 
- 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 PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
std::shared_ptr< EffectOutputTracksMakeOutputTracks ()
 
void DestroyOutputTracks () const
 
- 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 PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Detailed Description

Definition at line 26 of file VSTEffectBase.h.

Constructor & Destructor Documentation

◆ VSTEffectBase()

VSTEffectBase::VSTEffectBase ( const PluginPath path)

Definition at line 30 of file VSTEffectBase.cpp.

31: VSTWrapper(path)
32{
33 memset(&mTimeInfo, 0, sizeof(mTimeInfo));
34 mTimeInfo.samplePos = 0.0;
35 mTimeInfo.sampleRate = 44100.0; // this is a bogus value, but it's only for the display
36 mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
37 mTimeInfo.tempo = 120.0;
41}
const int kVstNanosValid
Definition: aeffectx.h:148
const int kVstTempoValid
Definition: aeffectx.h:150
double tempo
Definition: aeffectx.h:317
double sampleRate
Definition: aeffectx.h:311
double nanoSeconds
Definition: aeffectx.h:313
int timeSigDenominator
Definition: aeffectx.h:327
double samplePos
Definition: aeffectx.h:309
int timeSigNumerator
Definition: aeffectx.h:325
VstTimeInfo mTimeInfo
Definition: VSTWrapper.h:264
VSTWrapper(const PluginPath &path)
Definition: VSTWrapper.h:117

◆ ~VSTEffectBase()

VSTEffectBase::~VSTEffectBase ( )
overridedefault

Member Function Documentation

◆ CanExportPresets()

bool VSTEffectBase::CanExportPresets ( ) const
overridevirtual

Whether the effect supports export of presets to files, and importing too.

Reimplemented from Effect.

Definition at line 267 of file VSTEffectBase.cpp.

268{
269 return true;
270}

◆ DoLoadFactoryPreset()

bool VSTEffectBase::DoLoadFactoryPreset ( int  id)

Definition at line 260 of file VSTEffectBase.cpp.

261{
262 callSetProgram(id);
263
264 return true;
265}
void callSetProgram(int index)
Definition: VSTWrapper.cpp:712

References VSTWrapper::callSetProgram().

Referenced by LoadFactoryPreset().

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

◆ GetDescription()

TranslatableString VSTEffectBase::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 79 of file VSTEffectBase.cpp.

80{
81 // VST does have a product string opcode and some effects return a short
82 // description, but most do not or they just return the name again. So,
83 // try to provide some sort of useful information.
84 return XO("Audio In: %d, Audio Out: %d").Format( mAudioIns, mAudioOuts );
85}
XO("Cut/Copy/Paste")
unsigned mAudioOuts
Definition: VSTWrapper.h:221
unsigned mAudioIns
Definition: VSTWrapper.h:220

References VSTWrapper::mAudioIns, VSTWrapper::mAudioOuts, and XO().

Here is the call graph for this function:

◆ GetEffectIDs()

std::vector< int > VSTEffectBase::GetEffectIDs ( )

Definition at line 277 of file VSTEffectBase.cpp.

278{
279 std::vector<int> effectIDs;
280
281 // Are we a shell?
283 {
284 char name[64];
285 int effectID;
286
287 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
288 while (effectID)
289 {
290 effectIDs.push_back(effectID);
291 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
292 }
293 }
294
295 return effectIDs;
296}
const TranslatableString name
Definition: Distortion.cpp:76
VstPlugCategory
Definition: aeffectx.h:364
@ kPlugCategShell
Definition: aeffectx.h:375
const int effShellGetNextPlugin
Definition: aeffectx.h:134
const int effGetPlugCategory
Definition: aeffectx.h:119
int mVstVersion
Definition: VSTWrapper.h:165
intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) override
Definition: VSTWrapper.cpp:682

References VSTWrapper::callDispatcher(), effGetPlugCategory, effShellGetNextPlugin, kPlugCategShell, VSTWrapper::mVstVersion, and name.

Referenced by VSTEffectsModule::DiscoverPluginsAtPath().

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

◆ GetFactoryPresets()

RegistryPaths VSTEffectBase::GetFactoryPresets ( ) const
overridevirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 230 of file VSTEffectBase.cpp.

231{
232 RegistryPaths progs;
233
234 // Some plugins, like Guitar Rig 5, only report 128 programs while they have hundreds. While
235 // I was able to come up with a hack in the Guitar Rig case to gather all of the program names
236 // it would not let me set a program outside of the first 128.
237 if (mVstVersion >= 2)
238 {
239 for (int i = 0; i < mAEffect->numPrograms; i++)
240 {
241 progs.push_back(GetString(effGetProgramNameIndexed, i));
242 }
243 }
244
245 return progs;
246}
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
const int effGetProgramNameIndexed
Definition: aeffectx.h:117
int numPrograms
Definition: aeffectx.h:272
int GetString(wxString &outstr, int opcode, int index=0) const
Definition: VSTWrapper.cpp:651
AEffect * mAEffect
Definition: VSTWrapper.h:124

References effGetProgramNameIndexed, VSTWrapper::GetString(), VSTWrapper::mAEffect, VSTWrapper::mVstVersion, and AEffect::numPrograms.

Here is the call graph for this function:

◆ GetFamily()

EffectFamilySymbol VSTEffectBase::GetFamily ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 112 of file VSTEffectBase.cpp.

113{
114 return VSTPLUGINTYPE;
115}
#define VSTPLUGINTYPE
Definition: VSTEffectBase.h:22

References VSTPLUGINTYPE.

◆ GetPath()

PluginPath VSTEffectBase::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 45 of file VSTEffectBase.cpp.

46{
47 return mPath;
48}
PluginPath mPath
Definition: VSTWrapper.h:203

References VSTWrapper::mPath.

◆ GetSymbol()

ComponentInterfaceSymbol VSTEffectBase::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 50 of file VSTEffectBase.cpp.

51{
52 return VSTWrapper::GetSymbol();
53}
ComponentInterfaceSymbol GetSymbol() const

References VSTWrapper::GetSymbol().

Here is the call graph for this function:

◆ GetType()

EffectType VSTEffectBase::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 91 of file VSTEffectBase.cpp.

92{
93 if (mAudioIns == 0 && mAudioOuts == 0)
94 {
95 return EffectTypeTool;
96 }
97
98 if (mAudioIns == 0)
99 {
100 return EffectTypeGenerate;
101 }
102
103 if (mAudioOuts == 0)
104 {
105 return EffectTypeAnalyze;
106 }
107
108 return EffectTypeProcess;
109}
@ EffectTypeAnalyze
@ EffectTypeGenerate
@ EffectTypeTool
@ EffectTypeProcess

References EffectTypeAnalyze, EffectTypeGenerate, EffectTypeProcess, EffectTypeTool, VSTWrapper::mAudioIns, and VSTWrapper::mAudioOuts.

Referenced by VSTEffect::PopulateUI().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol VSTEffectBase::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 55 of file VSTEffectBase.cpp.

56{
57 return { mVendor };
58}
wxString mVendor
Definition: VSTWrapper.h:216

References VSTWrapper::mVendor.

◆ GetVersion()

wxString VSTEffectBase::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 60 of file VSTEffectBase.cpp.

61{
62 wxString version;
63
64 bool skipping = true;
65 for (int i = 0, s = 0; i < 4; i++, s += 8)
66 {
67 int dig = (mVersion >> s) & 0xff;
68 if (dig != 0 || !skipping)
69 {
70 version += !skipping ? wxT(".") : wxT("");
71 version += wxString::Format(wxT("%d"), dig);
72 skipping = false;
73 }
74 }
75
76 return version;
77}
wxT("CloseDown"))
int mVersion
Definition: VSTWrapper.h:218

References VSTWrapper::mVersion, and wxT().

Here is the call graph for this function:

◆ HasOptions()

bool VSTEffectBase::HasOptions ( ) const
overridevirtual

Whether there are preferences applying to the effect's family, for which a UI may be needed to change them

Reimplemented from Effect.

Definition at line 272 of file VSTEffectBase.cpp.

273{
274 return true;
275}

◆ InitializePlugin()

bool VSTEffectBase::InitializePlugin ( )

Definition at line 141 of file VSTEffectBase.cpp.

142{
143 if (!mAEffect)
144 {
145 Load();
146 }
147
148 if (!mAEffect)
149 {
150 return false;
151 }
152
153 return true;
154}
bool Load()
Definition: VSTWrapper.cpp:307

References VSTWrapper::Load(), and VSTWrapper::mAEffect.

Referenced by VSTEffectsModule::DiscoverPluginsAtPath().

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

◆ IsDefault()

bool VSTEffectBase::IsDefault ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 122 of file VSTEffectBase.cpp.

123{
124 return false;
125}

◆ IsInteractive()

bool VSTEffectBase::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 117 of file VSTEffectBase.cpp.

118{
119 return mInteractive;
120}
bool mInteractive
Definition: VSTWrapper.h:219

References VSTWrapper::mInteractive.

◆ LoadFactoryPreset()

OptionalMessage VSTEffectBase::LoadFactoryPreset ( int  id,
EffectSettings settings 
) const
overridevirtual

Change settings to the preset whose name is GetFactoryPresets()[id]

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 249 of file VSTEffectBase.cpp.

250{
251 // To do: externalize state so const_cast isn't needed
252 bool loadOK = const_cast<VSTEffectBase*>(this)->DoLoadFactoryPreset(id) &&
254 if (!loadOK)
255 return {};
256 return MakeMessageFS(
258}
static Settings & settings()
Definition: TrackInfo.cpp:69
bool DoLoadFactoryPreset(int id)
bool FetchSettings(VSTSettings &vst3Settings, bool doFetch=true) const
static VSTSettings & GetSettings(EffectSettings &settings)
Definition: VSTWrapper.h:103
std::unique_ptr< EffectInstance::Message > MakeMessageFS(const VSTSettings &settings) const

References DoLoadFactoryPreset(), VSTWrapper::FetchSettings(), VSTWrapper::GetSettings(), VSTWrapper::MakeMessageFS(), and settings().

Here is the call graph for this function:

◆ LoadSettings()

bool VSTEffectBase::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 VSTEffectBase.cpp.

193{
194 VSTSettings& vstSettings = GetSettings(settings);
195
196 long index{};
197 wxString key;
198 double value = 0.0;
199 if (parms.GetFirstEntry(key, index))
200 {
201 do
202 {
203 if (parms.Read(key, &value)) {
204 auto &map = vstSettings.mParamsMap;
205 auto iter = map.find(key);
206 if (iter != map.end()) {
207 if (iter->second)
208 // Should be guaranteed by MakeSettings
209 iter->second = value;
210 else {
211 assert(false);
212 }
213 }
214 else
215 // Unknown parameter name in the file
216 return false;
217 }
218 } while (parms.GetNextEntry(key, index));
219 }
220
221 // Loads key-value pairs only from a config file -- no chunk
222 vstSettings.mChunk.resize(0);
223 vstSettings.mVersion = VSTWrapper::mVersion;
226
227 return true;
228}
static const AudacityProject::AttachedObjects::RegisteredFactory key
int numParams
Definition: aeffectx.h:274
int32_t uniqueID
Definition: aeffectx.h:295
std::vector< char > mChunk
Definition: VSTWrapper.h:85
std::unordered_map< wxString, std::optional< double > > mParamsMap
Definition: VSTWrapper.h:88
int32_t mVersion
Definition: VSTWrapper.h:76
int32_t mNumParams
Definition: VSTWrapper.h:77
int32_t mUniqueID
Definition: VSTWrapper.h:75

References VSTWrapper::GetSettings(), key, VSTWrapper::mAEffect, VSTSettings::mChunk, VSTSettings::mNumParams, VSTSettings::mParamsMap, VSTSettings::mUniqueID, VSTSettings::mVersion, VSTWrapper::mVersion, AEffect::numParams, settings(), and AEffect::uniqueID.

Referenced by LoadUserPreset().

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

◆ LoadUserPreset()

OptionalMessage VSTEffectBase::LoadUserPreset ( const RegistryPath name,
EffectSettings settings 
) const
overridevirtual

Change settings to a user-named preset

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 298 of file VSTEffectBase.cpp.

300{
301 wxString value;
302
303 auto info = GetChunkInfo();
304
305 GetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"),
306 info.pluginUniqueID, info.pluginUniqueID);
307 GetConfig(*this, PluginSettings::Private, group, wxT("Version"),
308 info.pluginVersion, info.pluginVersion);
309 GetConfig(*this, PluginSettings::Private, group, wxT("Elements"),
310 info.numElements, info.numElements);
311
312 if ( ! IsCompatible(info) )
313 {
314 return {};
315 }
316
317 if (GetConfig(*this,
318 PluginSettings::Private, group, wxT("Chunk"), value, wxEmptyString))
319 {
320 ArrayOf<char> buf{ value.length() / 4 * 3 };
321
322 int len = Base64::Decode(value, buf.get());
323 if (len)
324 {
325 callSetChunk(true, len, buf.get(), &info);
327 return {};
328 }
329
330 return MakeMessageFS(
332 }
333
334 wxString parms;
335 if (!GetConfig(*this,
336 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
337 {
338 return {};
339 }
340
342 if (!eap.SetParameters(parms))
343 {
344 return {};
345 }
346
347 const bool loadOK = LoadSettings(eap, settings) &&
349 if (!loadOK)
350 return {};
351
352 return MakeMessageFS(
354}
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool SetParameters(const wxString &parms)
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
STRINGS_API int Decode(const wxString &in, void *out)
Definition: Base64.cpp:67
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
bool IsCompatible(const VstPatchChunkInfo &) const
Definition: VSTWrapper.cpp:609
VstPatchChunkInfo GetChunkInfo() const
Definition: VSTWrapper.cpp:603
void callSetChunk(bool isPgm, int len, void *buf)
Definition: VSTWrapper.cpp:721

References VSTWrapper::callSetChunk(), Base64::Decode(), VSTWrapper::FetchSettings(), VSTWrapper::GetChunkInfo(), PluginSettings::GetConfig(), VSTWrapper::GetSettings(), VSTWrapper::IsCompatible(), LoadSettings(), VSTWrapper::MakeMessageFS(), PluginSettings::Private, CommandParameters::SetParameters(), settings(), and wxT().

Here is the call graph for this function:

◆ MakeInstance()

std::shared_ptr< EffectInstance > VSTEffectBase::MakeInstance ( ) const
overridevirtual

Make an object maintaining short-term state of an Effect.

One effect may have multiple instances extant simultaneously. Instances have state, may be implemented in foreign code, and are temporary, whereas EffectSettings represents persistent effect state that can be saved and reloaded from files.

Parameters
settingsmay be assumed to have a lifetime enclosing the instance's
Postcondition
true (no promises that the result isn't null)

Implements EffectInstanceFactory.

Definition at line 156 of file VSTEffectBase.cpp.

157{
158 int userBlockSize;
159 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
160 wxT("BufferSize"), userBlockSize, 8192);
161 size_t userBlockSizeC = std::max( 1, userBlockSize );
162 bool useLatency;
163 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
164 wxT("UseLatency"), useLatency, true);
165
166
167 return std::make_shared<VSTInstance>(
168 *this, mPath, userBlockSizeC, userBlockSizeC, useLatency);
169}

References PluginSettings::GetConfig(), VSTWrapper::mPath, PluginSettings::Shared, and wxT().

Here is the call graph for this function:

◆ MakeSettings()

EffectSettings VSTEffectBase::MakeSettings ( ) const
overridevirtual

Produce an object holding new, independent settings

Default implementation returns an empty any

Reimplemented from EffectSettingsManager.

Definition at line 398 of file VSTEffectBase.cpp.

399{
402 return EffectSettings::Make<VSTSettings>(std::move(settings));
403}

References VSTWrapper::FetchSettings(), and settings().

Here is the call graph for this function:

◆ RealtimeSupport()

auto VSTEffectBase::RealtimeSupport ( ) const
overridevirtual

Since which version of Audacity has the effect supported realtime?

Reimplemented from Effect.

Definition at line 127 of file VSTEffectBase.cpp.

128{
130
131 /* return GetType() == EffectTypeProcess
132 ? RealtimeSince::Always
133 : RealtimeSince::Never; */
134}

References EffectDefinitionInterface::Always.

◆ SaveSettings()

bool VSTEffectBase::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 171 of file VSTEffectBase.cpp.

172{
173 const VSTSettings& vstSettings = GetSettings(settings);
174
175 for (const auto& item : vstSettings.mParamsMap)
176 {
177 if (item.second)
178 {
179 const auto& name = item.first;
180 const auto& value = *(item.second);
181
182 if (!parms.Write(name, value))
183 {
184 return false;
185 }
186 }
187 }
188
189 return true;
190}

References VSTWrapper::GetSettings(), VSTSettings::mParamsMap, name, and settings().

Referenced by SaveUserPreset().

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

◆ SaveUserPreset()

bool VSTEffectBase::SaveUserPreset ( const RegistryPath name,
const EffectSettings settings 
) const
overridevirtual

Save settings in the configuration file as a user-named preset.

Reimplemented from Effect.

Definition at line 356 of file VSTEffectBase.cpp.

358{
359 const auto& vstSettings = GetSettings(settings);
360
361 if ( ! StoreSettings(vstSettings) )
362 return false;
363
364 SetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"), vstSettings.mUniqueID );
365 SetConfig(*this, PluginSettings::Private, group, wxT("Version"), vstSettings.mVersion );
366 SetConfig(*this, PluginSettings::Private, group, wxT("Elements"), vstSettings.mNumParams);
367
369 {
370 void *chunk = NULL;
371 int clen = (int) constCallDispatcher(effGetChunk, 1, 0, &chunk, 0.0);
372 if (clen <= 0)
373 {
374 return false;
375 }
376
377 SetConfig(*this, PluginSettings::Private, group, wxT("Chunk"),
378 Base64::Encode(chunk, clen));
379 return true;
380 }
381
383 if (!SaveSettings(settings, eap))
384 {
385 return false;
386 }
387
388 wxString parms;
389 if (!eap.GetParameters(parms))
390 {
391 return false;
392 }
393
395 group, wxT("Parameters"), parms);
396}
const int effGetChunk
Definition: aeffectx.h:111
const int effFlagsProgramChunks
Definition: aeffectx.h:88
int flags
Definition: aeffectx.h:280
bool GetParameters(wxString &parms)
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
STRINGS_API wxString Encode(const void *in, int len)
Definition: Base64.cpp:27
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)
bool StoreSettings(const VSTSettings &vst3settings) const
intptr_t constCallDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) const
Definition: VSTWrapper.cpp:691

References VSTWrapper::constCallDispatcher(), effFlagsProgramChunks, effGetChunk, Base64::Encode(), AEffect::flags, CommandParameters::GetParameters(), VSTWrapper::GetSettings(), VSTWrapper::mAEffect, PluginSettings::Private, SaveSettings(), PluginSettings::SetConfig(), settings(), VSTWrapper::StoreSettings(), and wxT().

Here is the call graph for this function:

◆ SupportsAutomation()

bool VSTEffectBase::SupportsAutomation ( ) const
overridevirtual

Whether the effect has any automatable controls.

Reimplemented from Effect.

Definition at line 136 of file VSTEffectBase.cpp.

137{
138 return mAutomatable;
139}
bool mAutomatable
Definition: VSTWrapper.h:224

References VSTWrapper::mAutomatable.

Member Data Documentation

◆ mID

PluginID VSTEffectBase::mID
private

Definition at line 80 of file VSTEffectBase.h.


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