Audacity 3.2.0
Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
VSTEffect Class Referencefinal

#include <VSTEffect.h>

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

Public Member Functions

 VSTEffect (const PluginPath &path)
 
virtual ~VSTEffect ()
 
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...
 
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 DoLoadFactoryPreset (int id)
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
bool InitializePlugin ()
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
std::shared_ptr< EffectInstanceDoMakeInstance ()
 
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
 
void OnTimer ()
 
EffectSettings MakeSettings () const override
 
void Automate (int index, float value) override
 
VSTEffectSettingsGetSettings (EffectSettings &) const
 This function will be rewritten when the effect is really stateless. More...
 
const VSTEffectSettingsGetSettings (const EffectSettings &) const
 This function will be rewritten when the effect is really stateless. More...
 
- Public Member Functions inherited from VSTEffectWrapper
 VSTEffectWrapper (const PluginPath &path)
 
 ~VSTEffectWrapper ()
 
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
 
 wxCRIT_SECT_DECLARE_MEMBER (mDispatcherLock)
 
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 (VSTEffectSettings &vst3Settings) const
 
bool StoreSettings (const VSTEffectSettings &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 ()
 
virtual void Unload ()=0
 
void ResetModuleAndHandle ()
 
VstTimeInfoGetTimeInfo ()
 
float GetSampleRate ()
 
int GetProcessLevel ()
 
virtual void NeedIdle ()
 
virtual void UpdateDisplay ()
 
virtual void SizeWindow (int w, int h)
 
virtual void Automate (int index, float value)
 
void SetBufferDelay (int samples)
 
- 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 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
 
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...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, EffectUIValidator *pValidator, bool forceModal) override
 
EffectUIClientInterfaceGetEffectUIClientInterface () override
 Returns the EffectUIClientInterface instance for this effect. More...
 
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, EffectUIValidator *pValidator, 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
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=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 EffectUIClientInterfaceGetEffectUIClientInterface ()=0
 Returns the EffectUIClientInterface instance for this effect. 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...
 
- 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, SettingsCopyDirection copyDirection) 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
 

Public Attributes

VSTEffectSettings mSettings
 
std::mutex mSettingsMutex
 
- Public Attributes inherited from VSTEffectWrapper
AEffectmAEffect = nullptr
 
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 mUseLatency { true }
 

Protected Member Functions

void NeedIdle () override
 This is what GetSettings will be when the effect becomes really stateless. More...
 
void UpdateDisplay () override
 
void SizeWindow (int w, int h) override
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
- 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
 

Private Member Functions

void Unload () override
 
std::vector< int > GetEffectIDs ()
 
bool LoadParameters (const RegistryPath &group, EffectSettings &settings) const
 
bool SaveParameters (const RegistryPath &group, const EffectSettings &settings) const
 
void OnSlider (wxCommandEvent &evt)
 
void OnSizeWindow (wxCommandEvent &evt)
 
void OnUpdateDisplay (wxCommandEvent &evt)
 
void RemoveHandler ()
 
void OnProgram (wxCommandEvent &evt)
 
void OnProgramText (wxCommandEvent &evt)
 
void OnLoad (wxCommandEvent &evt)
 
void OnSave (wxCommandEvent &evt)
 
void OnSettings (wxCommandEvent &evt)
 
void BuildPlain (EffectSettingsAccess &access)
 
void BuildFancy (EffectInstance &instance)
 
wxSizer * BuildProgramBar ()
 
void RefreshParameters (int skip=-1) const
 
void NeedEditIdle (bool state)
 

Private Attributes

VSTEffectValidatormValidator {}
 
PluginID mID
 
bool mWantsEditIdle {false}
 
bool mWantsIdle { false }
 
int mTimerGuard {0}
 
std::unique_ptr< VSTEffectTimermTimer
 
wxWeakRef< wxDialog > mDialog
 
wxWindow * mParent
 
wxSizerItem * mContainer {}
 
bool mGui {false}
 
VSTControlmControl
 
NumericTextCtrlmDuration
 
ArrayOf< wxStaticText * > mNames
 
ArrayOf< wxSlider * > mSliders
 
ArrayOf< wxStaticText * > mDisplays
 
ArrayOf< wxStaticText * > mLabels
 
bool mInitialFetchDone { false }
 

Friends

class VSTEffectsModule
 

Additional Inherited Members

- Public Types inherited from VSTEffectWrapper
using ParameterVisitor = std::function< bool(const ParameterInfo &pi) >
 
using ModuleHandle = std::unique_ptr< wxDynamicLibrary >
 
using BundleHandle = CF_ptr< CFBundleRef >
 
- 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 VSTEffectWrapper
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 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 Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- 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 }
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

VSTEffect is an Audacity effect that forwards actual audio processing via a VSTEffectLink

Definition at line 309 of file VSTEffect.h.

Constructor & Destructor Documentation

◆ VSTEffect()

VSTEffect::VSTEffect ( const PluginPath path)

Definition at line 789 of file VSTEffect.cpp.

790: VSTEffectWrapper(path)
791{
792 mTimer = std::make_unique<VSTEffectTimer>(this);
793
794 memset(&mTimeInfo, 0, sizeof(mTimeInfo));
795 mTimeInfo.samplePos = 0.0;
796 mTimeInfo.sampleRate = 44100.0; // this is a bogus value, but it's only for the display
797 mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
798 mTimeInfo.tempo = 120.0;
802}
const int kVstNanosValid
Definition: aeffectx.h:148
const int kVstTempoValid
Definition: aeffectx.h:150
std::unique_ptr< VSTEffectTimer > mTimer
Definition: VSTEffect.h:461
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: VSTEffect.h:254
VSTEffectWrapper(const PluginPath &path)
Definition: VSTEffect.h:105

References VstTimeInfo::flags, kVstNanosValid, kVstTempoValid, VSTEffectWrapper::mTimeInfo, mTimer, VstTimeInfo::nanoSeconds, VstTimeInfo::samplePos, VstTimeInfo::sampleRate, VstTimeInfo::tempo, VstTimeInfo::timeSigDenominator, and VstTimeInfo::timeSigNumerator.

◆ ~VSTEffect()

VSTEffect::~VSTEffect ( )
virtual

Definition at line 804 of file VSTEffect.cpp.

805{
806 Unload();
807}
void Unload() override
Definition: VSTEffect.cpp:1774

References Unload().

Here is the call graph for this function:

Member Function Documentation

◆ Automate()

void VSTEffect::Automate ( int  index,
float  value 
)
overridevirtual

Reimplemented from VSTEffectWrapper.

Definition at line 3592 of file VSTEffect.cpp.

3593{
3594 callSetParameter(index, value);
3595
3596 // Because we come here when a control on the effect's GUI is moved,
3597 // we must update the temporary Effect-owned settings - users might
3598 // want to hear what happens when they move a knob.
3599 //
3600 {
3601 // we need a mutex because FetchSettings writes mSettings in the main
3602 // thread, but the storing of the settings passed to ::RealtimeProcess
3603 // happens in the worker thread
3604 auto guard = std::lock_guard{ mSettingsMutex };
3606 }
3607}
VSTEffectSettings mSettings
Definition: VSTEffect.h:384
std::mutex mSettingsMutex
Definition: VSTEffect.h:385
void callSetParameter(int index, float value) const
Definition: VSTEffect.cpp:2146
bool FetchSettings(VSTEffectSettings &vst3Settings) const
Definition: VSTEffect.cpp:3440

References VSTEffectWrapper::callSetParameter(), VSTEffectWrapper::FetchSettings(), mSettings, and mSettingsMutex.

Here is the call graph for this function:

◆ BuildFancy()

void VSTEffect::BuildFancy ( EffectInstance instance)
private

Definition at line 2225 of file VSTEffect.cpp.

2226{
2227 auto& vstEffInstance = dynamic_cast<VSTEffectInstance&>(instance);
2228
2229 // Turn the power on...some effects need this when the editor is open
2230 vstEffInstance.PowerOn();
2231
2232 auto control = Destroy_ptr<VSTControl>{ safenew VSTControl };
2233 if (!control)
2234 {
2235 return;
2236 }
2237
2238 if (!control->Create(mParent, this))
2239 {
2240 return;
2241 }
2242
2243 {
2244 auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
2245
2246 mainSizer->Add((mControl = control.release()), 0, wxALIGN_CENTER);
2247
2248 mParent->SetMinSize(wxDefaultSize);
2249 mParent->SetSizer(mainSizer.release());
2250 }
2251
2252 NeedEditIdle(true);
2253
2254 mDialog->Bind(wxEVT_SIZE, OnSize);
2255
2256#ifdef __WXMAC__
2257#ifdef __WX_EVTLOOP_BUSY_WAITING__
2258 wxEventLoop::SetBusyWaiting(true);
2259#endif
2260#endif
2261
2262 return;
2263}
#define safenew
Definition: MemoryX.h:10
std::unique_ptr< T, Destroyer< T > > Destroy_ptr
a convenience for using Destroyer
Definition: MemoryX.h:162
static void OnSize(wxSizeEvent &evt)
Definition: VSTEffect.cpp:2207
void NeedEditIdle(bool state)
Definition: VSTEffect.cpp:1987
wxWindow * mParent
Definition: VSTEffect.h:466
wxWeakRef< wxDialog > mDialog
Definition: VSTEffect.h:465
VSTControl * mControl
Definition: VSTEffect.h:470

References mControl, mDialog, mParent, NeedEditIdle(), OnSize(), VSTEffectInstance::PowerOn(), and safenew.

Referenced by PopulateUI().

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

◆ BuildPlain()

void VSTEffect::BuildPlain ( EffectSettingsAccess access)
private

Definition at line 2265 of file VSTEffect.cpp.

2266{
2267 wxASSERT(mParent); // To justify safenew
2268 wxScrolledWindow *const scroller = safenew wxScrolledWindow(mParent,
2269 wxID_ANY,
2270 wxDefaultPosition,
2271 wxDefaultSize,
2272 wxVSCROLL | wxTAB_TRAVERSAL);
2273
2274 {
2275 auto mainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
2276
2277 // Try to give the window a sensible default/minimum size
2278 scroller->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
2279 mParent->GetSize().GetHeight() / 2));
2280 scroller->SetScrollRate(0, 20);
2281
2282 // This fools NVDA into not saying "Panel" when the dialog gets focus
2283 scroller->SetName(wxT("\a"));
2284 scroller->SetLabel(wxT("\a"));
2285
2286 mainSizer->Add(scroller, 1, wxEXPAND | wxALL, 5);
2287 mParent->SetSizer(mainSizer.release());
2288 }
2289
2290 mNames.reinit(static_cast<size_t>(mAEffect->numParams));
2291 mSliders.reinit(static_cast<size_t>(mAEffect->numParams));
2292 mDisplays.reinit(static_cast<size_t>(mAEffect->numParams));
2293 mLabels.reinit(static_cast<size_t>(mAEffect->numParams));
2294
2295 {
2296 auto paramSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, scroller, _("Effect Settings"));
2297
2298 {
2299 auto gridSizer = std::make_unique<wxFlexGridSizer>(4, 0, 0);
2300 gridSizer->AddGrowableCol(1);
2301
2302 // Add the duration control for generators
2303 if (GetType() == EffectTypeGenerate)
2304 {
2305 wxControl *item = safenew wxStaticText(scroller, 0, _("Duration:"));
2306 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
2307 auto &extra = access.Get().extra;
2309 NumericTextCtrl(scroller, ID_Duration,
2311 extra.GetDurationFormat(),
2312 extra.GetDuration(),
2315 .AutoPos(true));
2316 mDuration->SetName( XO("Duration") );
2317 gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
2318 gridSizer->Add(1, 1, 0);
2319 gridSizer->Add(1, 1, 0);
2320 }
2321
2322 // Find the longest parameter name.
2323 int namew = 0;
2324 int w;
2325 int h;
2326 for (int i = 0; i < mAEffect->numParams; i++)
2327 {
2328 wxString text = GetString(effGetParamName, i);
2329
2330 if (text.Right(1) != wxT(':'))
2331 {
2332 text += wxT(':');
2333 }
2334
2335 scroller->GetTextExtent(text, &w, &h);
2336 if (w > namew)
2337 {
2338 namew = w;
2339 }
2340 }
2341
2342 scroller->GetTextExtent(wxT("HHHHHHHH"), &w, &h);
2343
2344 for (int i = 0; i < mAEffect->numParams; i++)
2345 {
2346 mNames[i] = safenew wxStaticText(scroller,
2347 wxID_ANY,
2348 wxEmptyString,
2349 wxDefaultPosition,
2350 wxSize(namew, -1),
2351 wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
2352 gridSizer->Add(mNames[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
2353
2354 mSliders[i] = safenew wxSliderWrapper(scroller,
2355 ID_Sliders + i,
2356 0,
2357 0,
2358 1000,
2359 wxDefaultPosition,
2360 wxSize(200, -1));
2361 gridSizer->Add(mSliders[i], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5);
2362#if wxUSE_ACCESSIBILITY
2363 // so that name can be set on a standard control
2364 mSliders[i]->SetAccessible(safenew WindowAccessible(mSliders[i]));
2365#endif
2366
2367 mDisplays[i] = safenew wxStaticText(scroller,
2368 wxID_ANY,
2369 wxEmptyString,
2370 wxDefaultPosition,
2371 wxSize(w, -1),
2372 wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
2373 gridSizer->Add(mDisplays[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
2374
2375 mLabels[i] = safenew wxStaticText(scroller,
2376 wxID_ANY,
2377 wxEmptyString,
2378 wxDefaultPosition,
2379 wxSize(w, -1),
2380 wxALIGN_LEFT | wxST_NO_AUTORESIZE);
2381 gridSizer->Add(mLabels[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, 5);
2382 }
2383
2384 paramSizer->Add(gridSizer.release(), 1, wxEXPAND | wxALL, 5);
2385 }
2386 scroller->SetSizer(paramSizer.release());
2387 }
2388
2390
2391 mSliders[0]->SetFocus();
2392}
wxT("CloseDown"))
@ EffectTypeGenerate
#define XO(s)
Definition: Internat.h:31
#define _(s)
Definition: Internat.h:75
@ ID_Duration
Definition: VSTEffect.cpp:590
@ ID_Sliders
Definition: VSTEffect.cpp:591
const int effGetParamName
Definition: aeffectx.h:101
int numParams
Definition: aeffectx.h:274
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
double mProjectRate
Definition: EffectBase.h:99
virtual const EffectSettings & Get()=0
void SetName(const TranslatableString &name)
EffectType GetType() const override
Type determines how it behaves.
Definition: VSTEffect.cpp:859
ArrayOf< wxSlider * > mSliders
Definition: VSTEffect.h:474
ArrayOf< wxStaticText * > mLabels
Definition: VSTEffect.h:476
void RefreshParameters(int skip=-1) const
Definition: VSTEffect.cpp:2394
ArrayOf< wxStaticText * > mDisplays
Definition: VSTEffect.h:475
NumericTextCtrl * mDuration
Definition: VSTEffect.h:472
ArrayOf< wxStaticText * > mNames
Definition: VSTEffect.h:473
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
EffectSettingsExtra extra
Options & AutoPos(bool enable)
int GetString(wxString &outstr, int opcode, int index=0) const
Definition: VSTEffect.cpp:2084
AEffect * mAEffect
Definition: VSTEffect.h:114

References _, NumericTextCtrl::Options::AutoPos(), EffectTypeGenerate, effGetParamName, EffectSettings::extra, EffectSettingsAccess::Get(), VSTEffectWrapper::GetString(), GetType(), ID_Duration, ID_Sliders, VSTEffectWrapper::mAEffect, mDisplays, mDuration, mLabels, mNames, mParent, EffectBase::mProjectRate, mSliders, AEffect::numParams, RefreshParameters(), ArrayOf< X >::reinit(), safenew, NumericTextCtrl::SetName(), NumericConverter::TIME, wxT(), and XO.

Referenced by PopulateUI().

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

◆ BuildProgramBar()

wxSizer * VSTEffect::BuildProgramBar ( )
private

◆ CanExportPresets()

bool VSTEffect::CanExportPresets ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1361 of file VSTEffect.cpp.

1362{
1363 return true;
1364}

◆ CloseUI()

bool VSTEffect::CloseUI ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1334 of file VSTEffect.cpp.

1335{
1336#ifdef __WXMAC__
1337#ifdef __WX_EVTLOOP_BUSY_WAITING__
1338 wxEventLoop::SetBusyWaiting(false);
1339#endif
1340 mControl->Close();
1341#endif
1342
1344
1345 NeedEditIdle(false);
1346
1347 RemoveHandler();
1348
1349 mNames.reset();
1350 mSliders.reset();
1351 mDisplays.reset();
1352 mLabels.reset();
1353
1354 mParent = NULL;
1355 mDialog = NULL;
1356 mValidator = nullptr;
1357
1358 return true;
1359}
void Close()
VSTEffectValidator * mValidator
Definition: VSTEffect.h:417
void RemoveHandler()
Definition: VSTEffect.cpp:2203
VSTEffectInstance & GetInstance()
Definition: VSTEffect.cpp:3569

References VSTControl::Close(), VSTEffectValidator::GetInstance(), mControl, mDialog, mDisplays, mLabels, mNames, mParent, mSliders, mValidator, NeedEditIdle(), VSTEffectInstance::PowerOff(), and RemoveHandler().

Referenced by Unload().

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

◆ DoLoadFactoryPreset()

bool VSTEffect::DoLoadFactoryPreset ( int  id)

Definition at line 1272 of file VSTEffect.cpp.

1273{
1274 callSetProgram(id);
1275
1276 return true;
1277}
void callSetProgram(int index)
Definition: VSTEffect.cpp:2155

References VSTEffectWrapper::callSetProgram().

Referenced by LoadFactoryPreset().

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

◆ DoMakeInstance()

std::shared_ptr< EffectInstance > VSTEffect::DoMakeInstance ( )

Definition at line 929 of file VSTEffect.cpp.

930{
931 int userBlockSize;
932 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
933 wxT("BufferSize"), userBlockSize, 8192);
934 size_t userBlockSizeC = std::max( 1, userBlockSize );
935 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
936 wxT("UseLatency"), mUseLatency, true);
937
938
939 return std::make_shared<VSTEffectInstance>(*this, mPath, userBlockSizeC, userBlockSizeC, mUseLatency);
940}
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
PluginPath mPath
Definition: VSTEffect.h:192

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

Referenced by MakeInstance().

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

◆ ExportPresets()

void VSTEffect::ExportPresets ( const EffectSettings settings) const
overridevirtual

Reimplemented from Effect.

Definition at line 1367 of file VSTEffect.cpp.

1368{
1369 wxString path;
1370
1371 // Ask the user for the real name
1372 //
1373 // Passing a valid parent will cause some effects dialogs to malfunction
1374 // upon returning from the SelectFile().
1375 path = SelectFile(FileNames::Operation::Presets,
1376 XO("Save VST Preset As:"),
1377 wxEmptyString,
1378 wxT("preset"),
1379 wxT("xml"),
1380 {
1381 { XO("Standard VST bank file"), { wxT("fxb") }, true },
1382 { XO("Standard VST program file"), { wxT("fxp") }, true },
1383 { XO("Audacity VST preset file"), { wxT("xml") }, true },
1384 },
1385 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
1386 NULL);
1387
1388 // User canceled...
1389 if (path.empty())
1390 {
1391 return;
1392 }
1393
1395 return;
1396
1397 wxFileName fn(path);
1398 wxString ext = fn.GetExt();
1399 if (ext.CmpNoCase(wxT("fxb")) == 0)
1400 {
1401 SaveFXB(fn);
1402 }
1403 else if (ext.CmpNoCase(wxT("fxp")) == 0)
1404 {
1405 SaveFXP(fn);
1406 }
1407 else if (ext.CmpNoCase(wxT("xml")) == 0)
1408 {
1409 // may throw
1410 SaveXML(fn);
1411 }
1412 else
1413 {
1414 // This shouldn't happen, but complain anyway
1416 XO("Unrecognized file extension."),
1417 XO("Error Saving VST Presets"),
1418 wxOK | wxCENTRE,
1419 mParent);
1420
1421 return;
1422 }
1423}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
static Settings & settings()
Definition: TrackInfo.cpp:87
static const auto fn
VSTEffectSettings & GetSettings(EffectSettings &) const
This function will be rewritten when the effect is really stateless.
Definition: VSTEffect.h:389
bool StoreSettings(const VSTEffectSettings &vst3settings) const
Definition: VSTEffect.cpp:3474
void SaveFXP(const wxFileName &fn) const
Definition: VSTEffect.cpp:2989
void SaveXML(const wxFileName &fn) const
Definition: VSTEffect.cpp:3086
void SaveFXB(const wxFileName &fn) const
Definition: VSTEffect.cpp:2901

References AudacityMessageBox(), fn, GetSettings(), mParent, VSTEffectWrapper::SaveFXB(), VSTEffectWrapper::SaveFXP(), VSTEffectWrapper::SaveXML(), SelectFile(), settings(), VSTEffectWrapper::StoreSettings(), wxT(), and XO.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString VSTEffect::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 847 of file VSTEffect.cpp.

848{
849 // VST does have a product string opcode and some effects return a short
850 // description, but most do not or they just return the name again. So,
851 // try to provide some sort of useful information.
852 return XO("Audio In: %d, Audio Out: %d").Format( mAudioIns, mAudioOuts );
853}
unsigned mAudioOuts
Definition: VSTEffect.h:211
unsigned mAudioIns
Definition: VSTEffect.h:210

References VSTEffectWrapper::mAudioIns, VSTEffectWrapper::mAudioOuts, and XO.

◆ GetEffectIDs()

std::vector< int > VSTEffect::GetEffectIDs ( )
private

Definition at line 1823 of file VSTEffect.cpp.

1824{
1825 std::vector<int> effectIDs;
1826
1827 // Are we a shell?
1829 {
1830 char name[64];
1831 int effectID;
1832
1833 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
1834 while (effectID)
1835 {
1836 effectIDs.push_back(effectID);
1837 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
1838 }
1839 }
1840
1841 return effectIDs;
1842}
const TranslatableString name
Definition: Distortion.cpp:82
VstPlugCategory
Definition: aeffectx.h:364
@ kPlugCategShell
Definition: aeffectx.h:375
const int effShellGetNextPlugin
Definition: aeffectx.h:134
const int effGetPlugCategory
Definition: aeffectx.h:119
intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) override
Definition: VSTEffect.cpp:2115

References VSTEffectWrapper::callDispatcher(), effGetPlugCategory, effShellGetNextPlugin, kPlugCategShell, VSTEffectWrapper::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 VSTEffect::GetFactoryPresets ( ) const
overridevirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 1243 of file VSTEffect.cpp.

1244{
1245 RegistryPaths progs;
1246
1247 // Some plugins, like Guitar Rig 5, only report 128 programs while they have hundreds. While
1248 // I was able to come up with a hack in the Guitar Rig case to gather all of the program names
1249 // it would not let me set a program outside of the first 128.
1250 if (mVstVersion >= 2)
1251 {
1252 for (int i = 0; i < mAEffect->numPrograms; i++)
1253 {
1254 progs.push_back(GetString(effGetProgramNameIndexed, i));
1255 }
1256 }
1257
1258 return progs;
1259}
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
const int effGetProgramNameIndexed
Definition: aeffectx.h:117
int numPrograms
Definition: aeffectx.h:272

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

Here is the call graph for this function:

◆ GetFamily()

EffectFamilySymbol VSTEffect::GetFamily ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 880 of file VSTEffect.cpp.

881{
882 return VSTPLUGINTYPE;
883}
#define VSTPLUGINTYPE
Definition: VSTEffect.h:39

References VSTPLUGINTYPE.

◆ GetPath()

PluginPath VSTEffect::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 813 of file VSTEffect.cpp.

814{
815 return mPath;
816}

References VSTEffectWrapper::mPath.

◆ GetSettings() [1/2]

const VSTEffectSettings & VSTEffect::GetSettings ( const EffectSettings ) const
inline

This function will be rewritten when the effect is really stateless.

Definition at line 395 of file VSTEffect.h.

396 {
397 return mSettings;
398 }

References mSettings.

◆ GetSettings() [2/2]

VSTEffectSettings & VSTEffect::GetSettings ( EffectSettings ) const
inline

This function will be rewritten when the effect is really stateless.

Definition at line 389 of file VSTEffect.h.

390 {
391 return const_cast<VSTEffect*>(this)->mSettings;
392 }

References mSettings.

Referenced by ExportPresets(), VSTEffectInstance::GetSettings(), ImportPresets(), LoadFactoryPreset(), LoadParameters(), LoadSettings(), MakeSettings(), SaveParameters(), SaveSettings(), TransferDataToWindow(), and ValidateUI().

Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol VSTEffect::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 818 of file VSTEffect.cpp.

819{
821}
ComponentInterfaceSymbol GetSymbol() const
Definition: VSTEffect.cpp:3538

References VSTEffectWrapper::GetSymbol().

Here is the call graph for this function:

◆ GetType()

EffectType VSTEffect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 859 of file VSTEffect.cpp.

860{
861 if (mAudioIns == 0 && mAudioOuts == 0)
862 {
863 return EffectTypeTool;
864 }
865
866 if (mAudioIns == 0)
867 {
868 return EffectTypeGenerate;
869 }
870
871 if (mAudioOuts == 0)
872 {
873 return EffectTypeAnalyze;
874 }
875
876 return EffectTypeProcess;
877}
@ EffectTypeAnalyze
@ EffectTypeTool
@ EffectTypeProcess

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

Referenced by BuildPlain(), and ValidateUI().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol VSTEffect::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 823 of file VSTEffect.cpp.

824{
825 return { mVendor };
826}
wxString mVendor
Definition: VSTEffect.h:206

References VSTEffectWrapper::mVendor.

◆ GetVersion()

wxString VSTEffect::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 828 of file VSTEffect.cpp.

829{
830 wxString version;
831
832 bool skipping = true;
833 for (int i = 0, s = 0; i < 4; i++, s += 8)
834 {
835 int dig = (mVersion >> s) & 0xff;
836 if (dig != 0 || !skipping)
837 {
838 version += !skipping ? wxT(".") : wxT("");
839 version += wxString::Format(wxT("%d"), dig);
840 skipping = false;
841 }
842 }
843
844 return version;
845}

References VSTEffectWrapper::mVersion, and wxT().

Here is the call graph for this function:

◆ HasOptions()

bool VSTEffect::HasOptions ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1497 of file VSTEffect.cpp.

1498{
1499 return true;
1500}

◆ ImportPresets()

void VSTEffect::ImportPresets ( EffectSettings settings)
overridevirtual

Reimplemented from Effect.

Definition at line 1430 of file VSTEffect.cpp.

1431{
1432 wxString path;
1433
1434 // Ask the user for the real name
1435 path = SelectFile(FileNames::Operation::Presets,
1436 XO("Load VST Preset:"),
1437 wxEmptyString,
1438 wxT("preset"),
1439 wxT("xml"),
1440 { {
1441 XO("VST preset files"),
1442 { wxT("fxb"), wxT("fxp"), wxT("xml") },
1443 true
1444 } },
1445 wxFD_OPEN | wxRESIZE_BORDER,
1446 mParent);
1447
1448 // User canceled...
1449 if (path.empty())
1450 {
1451 return;
1452 }
1453
1454 wxFileName fn(path);
1455 wxString ext = fn.GetExt();
1456 bool success = false;
1457 if (ext.CmpNoCase(wxT("fxb")) == 0)
1458 {
1459 success = LoadFXB(fn);
1460 }
1461 else if (ext.CmpNoCase(wxT("fxp")) == 0)
1462 {
1463 success = LoadFXP(fn);
1464 }
1465 else if (ext.CmpNoCase(wxT("xml")) == 0)
1466 {
1467 success = LoadXML(fn);
1468 }
1469 else
1470 {
1471 // This shouldn't happen, but complain anyway
1473 XO("Unrecognized file extension."),
1474 XO("Error Loading VST Presets"),
1475 wxOK | wxCENTRE,
1476 mParent);
1477
1478 return;
1479 }
1480
1481 if (!success)
1482 {
1484 XO("Unable to load presets file."),
1485 XO("Error Loading VST Presets"),
1486 wxOK | wxCENTRE,
1487 mParent);
1488
1489 return;
1490 }
1491
1493
1494 return;
1495}
bool LoadFXB(const wxFileName &fn)
Definition: VSTEffect.cpp:2490
bool LoadXML(const wxFileName &fn)
Definition: VSTEffect.cpp:2869
bool LoadFXP(const wxFileName &fn)
Definition: VSTEffect.cpp:2663

References AudacityMessageBox(), VSTEffectWrapper::FetchSettings(), fn, GetSettings(), VSTEffectWrapper::LoadFXB(), VSTEffectWrapper::LoadFXP(), VSTEffectWrapper::LoadXML(), mParent, SelectFile(), settings(), wxT(), and XO.

Here is the call graph for this function:

◆ InitializePlugin()

bool VSTEffect::InitializePlugin ( )

Definition at line 909 of file VSTEffect.cpp.

910{
911 if (!mAEffect)
912 {
913 Load();
914 }
915
916 if (!mAEffect)
917 {
918 return false;
919 }
920
921 return true;
922}

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

Referenced by VSTEffectsModule::DiscoverPluginsAtPath().

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

◆ IsDefault()

bool VSTEffect::IsDefault ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 890 of file VSTEffect.cpp.

891{
892 return false;
893}

◆ IsGraphicalUI()

bool VSTEffect::IsGraphicalUI ( )
overridevirtual
Returns
false

Reimplemented from Effect.

Definition at line 1319 of file VSTEffect.cpp.

1320{
1321 return mGui;
1322}
bool mGui
Definition: VSTEffect.h:468

References mGui.

◆ IsInteractive()

bool VSTEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 885 of file VSTEffect.cpp.

886{
887 return mInteractive;
888}

References VSTEffectWrapper::mInteractive.

◆ LoadFactoryPreset()

bool VSTEffect::LoadFactoryPreset ( int  id,
EffectSettings settings 
) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 1261 of file VSTEffect.cpp.

1262{
1263 // To do: externalize state so const_cast isn't needed
1264 bool loadOK = const_cast<VSTEffect*>(this)->DoLoadFactoryPreset(id);
1265
1266 if (loadOK)
1268
1269 return loadOK;
1270}
bool DoLoadFactoryPreset(int id)
Definition: VSTEffect.cpp:1272

References DoLoadFactoryPreset(), VSTEffectWrapper::FetchSettings(), GetSettings(), and settings().

Here is the call graph for this function:

◆ LoadParameters()

bool VSTEffect::LoadParameters ( const RegistryPath group,
EffectSettings settings 
) const
private

Definition at line 1858 of file VSTEffect.cpp.

1860{
1861 wxString value;
1862
1863 auto info = GetChunkInfo();
1864
1865 GetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"),
1866 info.pluginUniqueID, info.pluginUniqueID);
1867 GetConfig(*this, PluginSettings::Private, group, wxT("Version"),
1868 info.pluginVersion, info.pluginVersion);
1869 GetConfig(*this, PluginSettings::Private, group, wxT("Elements"),
1870 info.numElements, info.numElements);
1871
1872 if ( ! IsCompatible(info) )
1873 {
1874 return false;
1875 }
1876
1877 if (GetConfig(*this,
1878 PluginSettings::Private, group, wxT("Chunk"), value, wxEmptyString))
1879 {
1880 ArrayOf<char> buf{ value.length() / 4 * 3 };
1881
1882 int len = Base64::Decode(value, buf.get());
1883 if (len)
1884 {
1885 callSetChunk(true, len, buf.get(), &info);
1887 }
1888
1889 return true;
1890 }
1891
1892 wxString parms;
1893 if (!GetConfig(*this,
1894 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
1895 {
1896 return false;
1897 }
1898
1900 if (!eap.SetParameters(parms))
1901 {
1902 return false;
1903 }
1904
1905 const bool loadOK = LoadSettings(eap, settings);
1906
1907 if (loadOK)
1909
1910 return loadOK;
1911}
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.
Definition: VSTEffect.cpp:1196
STRINGS_API int Decode(const wxString &in, void *out)
Definition: Base64.cpp:67
VstPatchChunkInfo GetChunkInfo() const
Definition: VSTEffect.cpp:1845
bool IsCompatible(const VstPatchChunkInfo &) const
Definition: VSTEffect.cpp:1851
void callSetChunk(bool isPgm, int len, void *buf)
Definition: VSTEffect.cpp:2165

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

Referenced by LoadUserPreset().

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

◆ LoadSettings()

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

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 1196 of file VSTEffect.cpp.

1197{
1198 VSTEffectSettings& vstSettings = GetSettings(settings);
1199 vstSettings.mParamsMap.clear();
1200
1201 long index{};
1202 wxString key;
1203 float value = 0.0f;
1204 if (parms.GetFirstEntry(key, index))
1205 {
1206 do
1207 {
1208 if (parms.Read(key, value))
1209 vstSettings.mParamsMap[key] = value;
1210 else
1211 return false;
1212
1213 } while (parms.GetNextEntry(key, index));
1214 }
1215
1216 vstSettings.mChunk = std::nullopt;
1220
1221 return true;
1222}
static const AudacityProject::AttachedObjects::RegisteredFactory key
int32_t uniqueID
Definition: aeffectx.h:295
int32_t mVersion
Definition: VSTEffect.h:87
int32_t mUniqueID
Definition: VSTEffect.h:86
std::unordered_map< wxString, double > mParamsMap
Definition: VSTEffect.h:99
std::optional< wxString > mChunk
Definition: VSTEffect.h:96
int32_t mNumParams
Definition: VSTEffect.h:88

References GetSettings(), key, VSTEffectWrapper::mAEffect, VSTEffectSettings::mChunk, VSTEffectSettings::mNumParams, VSTEffectSettings::mParamsMap, VSTEffectSettings::mUniqueID, VSTEffectSettings::mVersion, VSTEffectWrapper::mVstVersion, AEffect::numParams, settings(), and AEffect::uniqueID.

Referenced by LoadParameters().

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

◆ LoadUserPreset()

bool VSTEffect::LoadUserPreset ( const RegistryPath name,
EffectSettings settings 
) const
overridevirtual

Change settings to a user-named preset.

Reimplemented from Effect.

Definition at line 1225 of file VSTEffect.cpp.

1227{
1229 {
1230 return false;
1231 }
1232
1233 return true;
1234}
bool LoadParameters(const RegistryPath &group, EffectSettings &settings) const
Definition: VSTEffect.cpp:1858

References LoadParameters(), name, and settings().

Here is the call graph for this function:

◆ MakeInstance()

std::shared_ptr< EffectInstance > VSTEffect::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 924 of file VSTEffect.cpp.

925{
926 return const_cast<VSTEffect*>(this)->DoMakeInstance();
927}
std::shared_ptr< EffectInstance > DoMakeInstance()
Definition: VSTEffect.cpp:929

References DoMakeInstance().

Here is the call graph for this function:

◆ MakeSettings()

EffectSettings VSTEffect::MakeSettings ( ) const
overridevirtual

Produce an object holding new, independent settings

Default implementation returns an empty any

Reimplemented from EffectSettingsManager.

Definition at line 3543 of file VSTEffect.cpp.

3544{
3545 auto result = PerTrackEffect::MakeSettings();
3546 // Cause initial population of the map stored in the stateful effect
3547 if (!mInitialFetchDone) {
3548 FetchSettings(GetSettings(result));
3549 mInitialFetchDone = true;
3550 }
3551 return result;
3552}
virtual EffectSettings MakeSettings() const
bool mInitialFetchDone
Definition: VSTEffect.h:483

References VSTEffectWrapper::FetchSettings(), GetSettings(), EffectSettingsManager::MakeSettings(), and mInitialFetchDone.

Here is the call graph for this function:

◆ NeedEditIdle()

void VSTEffect::NeedEditIdle ( bool  state)
private

Definition at line 1987 of file VSTEffect.cpp.

1988{
1989 mWantsEditIdle = state;
1990 mTimer->Start(100);
1991}
bool mWantsEditIdle
Definition: VSTEffect.h:457

References mTimer, and mWantsEditIdle.

Referenced by BuildFancy(), and CloseUI().

Here is the caller graph for this function:

◆ NeedIdle()

void VSTEffect::NeedIdle ( )
overrideprotectedvirtual

This is what GetSettings will be when the effect becomes really stateless.

Reimplemented from VSTEffectWrapper.

Definition at line 1981 of file VSTEffect.cpp.

1982{
1983 mWantsIdle = true;
1984 mTimer->Start(100);
1985}
bool mWantsIdle
Definition: VSTEffect.h:458

References mTimer, and mWantsIdle.

◆ OnLoad()

void VSTEffect::OnLoad ( wxCommandEvent &  evt)
private

◆ OnProgram()

void VSTEffect::OnProgram ( wxCommandEvent &  evt)
private

◆ OnProgramText()

void VSTEffect::OnProgramText ( wxCommandEvent &  evt)
private

◆ OnSave()

void VSTEffect::OnSave ( wxCommandEvent &  evt)
private

◆ OnSettings()

void VSTEffect::OnSettings ( wxCommandEvent &  evt)
private

◆ OnSizeWindow()

void VSTEffect::OnSizeWindow ( wxCommandEvent &  evt)
private

Definition at line 2445 of file VSTEffect.cpp.

2446{
2447 if (!mControl)
2448 {
2449 return;
2450 }
2451
2452 mControl->SetMinSize(wxSize(evt.GetInt(), (int) evt.GetExtraLong()));
2453 mControl->SetSize(wxSize(evt.GetInt(), (int) evt.GetExtraLong()));
2454
2455 // DO NOT CHANGE THE ORDER OF THESE
2456 //
2457 // Guitar Rig (and possibly others) Cocoa VSTs can resize too large
2458 // if the bounds are unlimited.
2459 mDialog->SetMinSize(wxDefaultSize);
2460 mDialog->SetMaxSize(wxDefaultSize);
2461 mDialog->Layout();
2462 mDialog->SetMinSize(mDialog->GetBestSize());
2463 mDialog->SetMaxSize(mDialog->GetBestSize());
2464 mDialog->Fit();
2465}

References mControl, and mDialog.

◆ OnSlider()

void VSTEffect::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 2467 of file VSTEffect.cpp.

2468{
2469 wxSlider *s = (wxSlider *) evt.GetEventObject();
2470 int i = s->GetId() - ID_Sliders;
2471
2472 // The plain GUI works (destructive or realtime) even without this call
2473 //
2474 //if (mValidator)
2475 // mValidator->GetInstance().callSetParameter(i, s->GetValue() / 1000.0);
2476
2477 // This, along with the call to FetchSettings below, is needed in order
2478 // to have the plain GUI work properly when realtime processing
2479 callSetParameter(i, s->GetValue() / 1000.0);
2480
2481 {
2482 // Same comments found in VSTInstanceBase::Automate apply here
2483 auto guard = std::lock_guard{ mSettingsMutex };
2485 }
2486
2488}

References VSTEffectWrapper::callSetParameter(), VSTEffectWrapper::FetchSettings(), ID_Sliders, mSettings, mSettingsMutex, and RefreshParameters().

Here is the call graph for this function:

◆ OnTimer()

void VSTEffect::OnTimer ( )

Definition at line 1956 of file VSTEffect.cpp.

1957{
1958 wxRecursionGuard guard(mTimerGuard);
1959
1960 // Ignore it if we're recursing
1961 if (guard.IsInside())
1962 {
1963 return;
1964 }
1965
1966 if (mVstVersion >= 2 && mWantsIdle)
1967 {
1968 int ret = callDispatcher(effIdle, 0, 0, NULL, 0.0);
1969 if (!ret)
1970 {
1971 mWantsIdle = false;
1972 }
1973 }
1974
1975 if (mWantsEditIdle)
1976 {
1977 callDispatcher(effEditIdle, 0, 0, NULL, 0.0);
1978 }
1979}
const int effEditIdle
Definition: aeffectx.h:108
const int effIdle
Definition: aeffectx.h:127
int mTimerGuard
Definition: VSTEffect.h:460

References VSTEffectWrapper::callDispatcher(), effEditIdle, effIdle, mTimerGuard, VSTEffectWrapper::mVstVersion, mWantsEditIdle, and mWantsIdle.

Referenced by VSTEffectTimer::Notify().

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

◆ OnUpdateDisplay()

void VSTEffect::OnUpdateDisplay ( wxCommandEvent &  evt)
private

◆ PopulateUI()

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

Adds controls to a panel that is given as the parent window of S

Parameters
Sinterface for adding controls to a panel in a dialog
instanceguaranteed to have a lifetime containing that of the returned object
accessguaranteed to have a lifetime containing that of the returned object
Returns
null for failure; else an object invoked to retrieve values of UI controls; it might also hold some state needed to implement event handlers of the controls; it will exist only while the dialog continues to exist

Reimplemented from Effect.

Definition at line 1283 of file VSTEffect.cpp.

1285{
1286 auto parent = S.GetParent();
1287 mDialog = static_cast<wxDialog *>(wxGetTopLevelParent(parent));
1288 mParent = parent;
1289
1290 // Determine if the VST editor is supposed to be used or not
1291 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
1292 wxT("UseGUI"),
1293 mGui,
1294 true);
1295 mGui = mAEffect->flags & effFlagsHasEditor ? mGui : false;
1296
1297 // Must use the GUI editor if parameters aren't provided
1298 if (mAEffect->numParams == 0)
1299 {
1300 mGui = true;
1301 }
1302
1303 // Build the appropriate dialog type
1304 if (mGui)
1305 {
1306 BuildFancy(instance);
1307 }
1308 else
1309 {
1310 BuildPlain(access);
1311 }
1312
1313 auto pParent = S.GetParent();
1314 pParent->PushEventHandler(this);
1315
1316 return std::make_unique<VSTEffectValidator>(dynamic_cast<VSTEffectInstance&>(instance), *this, access, pParent);
1317}
#define S(N)
Definition: ToChars.cpp:64
const int effFlagsHasEditor
Definition: aeffectx.h:86
int flags
Definition: aeffectx.h:280
void BuildFancy(EffectInstance &instance)
Definition: VSTEffect.cpp:2225
void BuildPlain(EffectSettingsAccess &access)
Definition: VSTEffect.cpp:2265

References BuildFancy(), BuildPlain(), effFlagsHasEditor, AEffect::flags, PluginSettings::GetConfig(), VSTEffectWrapper::mAEffect, mDialog, mGui, mParent, AEffect::numParams, S, PluginSettings::Shared, and wxT().

Here is the call graph for this function:

◆ RealtimeSupport()

auto VSTEffect::RealtimeSupport ( ) const
overridevirtual

Since which version of Audacity has the effect supported realtime?

Reimplemented from Effect.

Definition at line 895 of file VSTEffect.cpp.

896{
897 // TODO reenable after achieving statelessness
899 /* return GetType() == EffectTypeProcess
900 ? RealtimeSince::Always
901 : RealtimeSince::Never; */
902}

References EffectDefinitionInterface::Never.

◆ RefreshParameters()

void VSTEffect::RefreshParameters ( int  skip = -1) const
private

Definition at line 2394 of file VSTEffect.cpp.

2395{
2396 if (!mNames)
2397 {
2398 return;
2399 }
2400
2401 for (int i = 0; i < mAEffect->numParams; i++)
2402 {
2403 wxString text = GetString(effGetParamName, i);
2404
2405 text = text.Trim(true).Trim(false);
2406
2407 wxString name = text;
2408
2409 if (text.Right(1) != wxT(':'))
2410 {
2411 text += wxT(':');
2412 }
2413 mNames[i]->SetLabel(text);
2414
2415 // For some parameters types like on/off, setting the slider value has
2416 // a side effect that causes it to only move when the parameter changes
2417 // from off to on. However, this prevents changing the value using the
2418 // keyboard, so we skip the active slider if any.
2419 if (i != skip)
2420 {
2421 mSliders[i]->SetValue(callGetParameter(i) * 1000);
2422 }
2423 name = text;
2424
2425 text = GetString(effGetParamDisplay, i);
2426 if (text.empty())
2427 {
2428 text.Printf(wxT("%.5g"),callGetParameter(i));
2429 }
2430 mDisplays[i]->SetLabel(wxString::Format(wxT("%8s"), text));
2431 name += wxT(' ') + text;
2432
2433 text = GetString(effGetParamDisplay, i);
2434 if (!text.empty())
2435 {
2436 text.Printf(wxT("%-8s"), GetString(effGetParamLabel, i));
2437 mLabels[i]->SetLabel(wxString::Format(wxT("%8s"), text));
2438 name += wxT(' ') + text;
2439 }
2440
2441 mSliders[i]->SetName(name);
2442 }
2443}
const int effGetParamDisplay
Definition: aeffectx.h:100
const int effGetParamLabel
Definition: aeffectx.h:99
float callGetParameter(int index) const
Definition: VSTEffect.cpp:2139

References VSTEffectWrapper::callGetParameter(), effGetParamDisplay, effGetParamLabel, effGetParamName, VSTEffectWrapper::GetString(), VSTEffectWrapper::mAEffect, mDisplays, mLabels, mNames, mSliders, name, AEffect::numParams, and wxT().

Referenced by BuildPlain(), OnSlider(), and TransferDataToWindow().

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

◆ RemoveHandler()

void VSTEffect::RemoveHandler ( )
private

Definition at line 2203 of file VSTEffect.cpp.

2204{
2205}

Referenced by CloseUI().

Here is the caller graph for this function:

◆ SaveParameters()

bool VSTEffect::SaveParameters ( const RegistryPath group,
const EffectSettings settings 
) const
private

Definition at line 1914 of file VSTEffect.cpp.

1916{
1917 const auto& vstSettings = GetSettings(settings);
1918
1919 if ( ! StoreSettings(vstSettings) )
1920 return false;
1921
1922 SetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"), vstSettings.mUniqueID );
1923 SetConfig(*this, PluginSettings::Private, group, wxT("Version"), vstSettings.mVersion );
1924 SetConfig(*this, PluginSettings::Private, group, wxT("Elements"), vstSettings.mNumParams);
1925
1927 {
1928 void *chunk = NULL;
1929 int clen = (int) constCallDispatcher(effGetChunk, 1, 0, &chunk, 0.0);
1930 if (clen <= 0)
1931 {
1932 return false;
1933 }
1934
1935 SetConfig(*this, PluginSettings::Private, group, wxT("Chunk"),
1936 Base64::Encode(chunk, clen));
1937 return true;
1938 }
1939
1941 if (!SaveSettings(settings, eap))
1942 {
1943 return false;
1944 }
1945
1946 wxString parms;
1947 if (!eap.GetParameters(parms))
1948 {
1949 return false;
1950 }
1951
1952 return SetConfig(*this, PluginSettings::Private,
1953 group, wxT("Parameters"), parms);
1954}
const int effGetChunk
Definition: aeffectx.h:111
const int effFlagsProgramChunks
Definition: aeffectx.h:88
bool GetParameters(wxString &parms)
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: VSTEffect.cpp:1177
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)
intptr_t constCallDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) const
Definition: VSTEffect.cpp:2123

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

Referenced by SaveUserPreset().

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

◆ SaveSettings()

bool VSTEffect::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 1177 of file VSTEffect.cpp.

1178{
1179 const VSTEffectSettings& vstSettings = GetSettings(settings);
1180
1181 for (const auto& item : vstSettings.mParamsMap)
1182 {
1183 const auto& name = item.first;
1184 const auto& value = item.second;
1185
1186 if (!parms.Write(name, value))
1187 {
1188 return false;
1189 }
1190 }
1191
1192 return true;
1193}

References GetSettings(), VSTEffectSettings::mParamsMap, name, and settings().

Referenced by SaveParameters().

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

◆ SaveUserPreset()

bool VSTEffect::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 1237 of file VSTEffect.cpp.

1239{
1240 return SaveParameters(name, settings);
1241}
bool SaveParameters(const RegistryPath &group, const EffectSettings &settings) const
Definition: VSTEffect.cpp:1914

References name, SaveParameters(), and settings().

Here is the call graph for this function:

◆ ShowClientInterface()

int VSTEffect::ShowClientInterface ( wxWindow &  parent,
wxDialog &  dialog,
EffectUIValidator validator,
bool  forceModal 
)
overridevirtual

Some history...

Before we ran into the Antress plugin problem with buffer size limitations, (see below) we just had a plain old effect loop...get the input samples, pass them to the effect, save the output samples.

But, the hack I put in to limit the buffer size to only 8k (normally 512k or so) severely impacted performance. So, Michael C. added some intermediate buffering that sped things up quite a bit and this is how things have worked for quite a while. It still didn't get the performance back to the pre-hack stage, but it was a definite benefit.

History over...

I've recently (May 2014) tried newer versions of the Antress effects and they no longer seem to have a problem with buffer size. So, I've made a bit of a compromise...I've made the buffer size user configurable. Should have done this from the beginning. I've left the default 8k, just in case, but now the user can set the buffering based on their specific setup and needs.

And at the same time I added buffer delay compensation, which allows Audacity to account for latency introduced by some effects. This is based on information provided by the effect, so it will not work with all effects since they don't all provide the information (kn0ck0ut is one).

Reimplemented from Effect.

Definition at line 1146 of file VSTEffect.cpp.

1148{
1149 // mProcessLevel = 1; // in GUI thread
1150
1151 VSTEffectValidator* vstValidator = static_cast<VSTEffectValidator*>(validator);
1152 mValidator = vstValidator;
1153
1154 if (! vstValidator->GetInstance().IsReady() )
1155 {
1156 // Set some defaults since some VSTs need them...these will be reset when
1157 // normal or realtime processing begins
1158 vstValidator->GetInstance().mBlockSize = 8192;
1160 }
1161
1162 // Remember the dialog with a weak pointer, but don't control its lifetime
1163 mDialog = &dialog;
1164 mDialog->CentreOnParent();
1165
1166 if (SupportsRealtime() && !forceModal)
1167 {
1168 mDialog->Show();
1169 return 0;
1170 }
1171
1172 return mDialog->ShowModal();
1173}
bool DoProcessInitialize(double sampleRate)
Definition: VSTEffect.cpp:984

References VSTEffectInstance::DoProcessInitialize(), VSTEffectValidator::GetInstance(), VSTEffectInstance::IsReady(), VSTEffectInstance::mBlockSize, mDialog, EffectBase::mProjectRate, mValidator, and EffectDefinitionInterface::SupportsRealtime().

Here is the call graph for this function:

◆ ShowOptions()

void VSTEffect::ShowOptions ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1502 of file VSTEffect.cpp.

1503{
1504 VSTEffectOptionsDialog dlg(mParent, *this);
1505 if (dlg.ShowModal())
1506 {
1507 // Reinitialize configuration settings
1508
1509 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
1510 wxT("UseLatency"), mUseLatency, true);
1511 }
1512}

References PluginSettings::GetConfig(), mParent, VSTEffectWrapper::mUseLatency, PluginSettings::Shared, and wxT().

Here is the call graph for this function:

◆ SizeWindow()

void VSTEffect::SizeWindow ( int  w,
int  h 
)
overrideprotectedvirtual

Reimplemented from VSTEffectWrapper.

Definition at line 2045 of file VSTEffect.cpp.

2046{
2047 // Queue the event to make the resizes smoother
2048 if (mParent)
2049 {
2050 wxCommandEvent sw(EVT_SIZEWINDOW);
2051 sw.SetInt(w);
2052 sw.SetExtraLong(h);
2053 mParent->GetEventHandler()->AddPendingEvent(sw);
2054 }
2055
2056 return;
2057}

References mParent.

◆ SupportsAutomation()

bool VSTEffect::SupportsAutomation ( ) const
overridevirtual

Whether the effect has any automatable controls.

Reimplemented from Effect.

Definition at line 904 of file VSTEffect.cpp.

905{
906 return mAutomatable;
907}

References VSTEffectWrapper::mAutomatable.

◆ TransferDataToWindow()

bool VSTEffect::TransferDataToWindow ( const EffectSettings settings)
overridevirtual

Update controls for the settings.

Reimplemented from Effect.

Definition at line 3528 of file VSTEffect.cpp.

3529{
3531 return false;
3532
3534
3535 return true;
3536}

References GetSettings(), RefreshParameters(), settings(), and VSTEffectWrapper::StoreSettings().

Here is the call graph for this function:

◆ Unload()

void VSTEffect::Unload ( )
overrideprivatevirtual

Implements VSTEffectWrapper.

Definition at line 1774 of file VSTEffect.cpp.

1775{
1776 if (mDialog)
1777 {
1778 CloseUI();
1779 }
1780
1781 if (mAEffect)
1782 {
1783 // Finally, close the plugin
1784 callDispatcher(effClose, 0, 0, NULL, 0.0);
1785 mAEffect = NULL;
1786 }
1787
1788 //ResetModuleAndHandle();
1789}
const int effClose
Definition: aeffectx.h:92
bool CloseUI() override
Definition: VSTEffect.cpp:1334

References VSTEffectWrapper::callDispatcher(), CloseUI(), effClose, VSTEffectWrapper::mAEffect, and mDialog.

Referenced by ~VSTEffect().

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

◆ UpdateDisplay()

void VSTEffect::UpdateDisplay ( )
overrideprotectedvirtual

Reimplemented from VSTEffectWrapper.

Definition at line 2059 of file VSTEffect.cpp.

2060{
2061#if 0
2062 // Tell the dialog to refresh effect information
2063 if (mParent)
2064 {
2065 wxCommandEvent ud(EVT_UPDATEDISPLAY);
2066 mParent->GetEventHandler()->AddPendingEvent(ud);
2067 }
2068#endif
2069 return;
2070}

References mParent.

◆ ValidateUI()

bool VSTEffect::ValidateUI ( EffectSettings settings)
overridevirtual

Reimplemented from Effect.

Definition at line 1324 of file VSTEffect.cpp.

1325{
1326 if (GetType() == EffectTypeGenerate)
1327 settings.extra.SetDuration(mDuration->GetValue());
1328
1330
1331 return true;
1332}

References EffectTypeGenerate, VSTEffectWrapper::FetchSettings(), GetSettings(), GetType(), NumericConverter::GetValue(), mDuration, and settings().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ VSTEffectsModule

friend class VSTEffectsModule
friend

Definition at line 481 of file VSTEffect.h.

Member Data Documentation

◆ mContainer

wxSizerItem* VSTEffect::mContainer {}
private

Definition at line 467 of file VSTEffect.h.

◆ mControl

VSTControl* VSTEffect::mControl
private

Definition at line 470 of file VSTEffect.h.

Referenced by BuildFancy(), CloseUI(), and OnSizeWindow().

◆ mDialog

wxWeakRef<wxDialog> VSTEffect::mDialog
private

Definition at line 465 of file VSTEffect.h.

Referenced by BuildFancy(), CloseUI(), OnSizeWindow(), PopulateUI(), ShowClientInterface(), and Unload().

◆ mDisplays

ArrayOf<wxStaticText *> VSTEffect::mDisplays
private

Definition at line 475 of file VSTEffect.h.

Referenced by BuildPlain(), CloseUI(), and RefreshParameters().

◆ mDuration

NumericTextCtrl* VSTEffect::mDuration
private

Definition at line 472 of file VSTEffect.h.

Referenced by BuildPlain(), and ValidateUI().

◆ mGui

bool VSTEffect::mGui {false}
private

Definition at line 468 of file VSTEffect.h.

Referenced by IsGraphicalUI(), and PopulateUI().

◆ mID

PluginID VSTEffect::mID
private

Definition at line 455 of file VSTEffect.h.

◆ mInitialFetchDone

bool VSTEffect::mInitialFetchDone { false }
mutableprivate

Definition at line 483 of file VSTEffect.h.

Referenced by MakeSettings().

◆ mLabels

ArrayOf<wxStaticText *> VSTEffect::mLabels
private

Definition at line 476 of file VSTEffect.h.

Referenced by BuildPlain(), CloseUI(), and RefreshParameters().

◆ mNames

ArrayOf<wxStaticText *> VSTEffect::mNames
private

Definition at line 473 of file VSTEffect.h.

Referenced by BuildPlain(), CloseUI(), and RefreshParameters().

◆ mParent

wxWindow* VSTEffect::mParent
private

◆ mSettings

VSTEffectSettings VSTEffect::mSettings

Definition at line 384 of file VSTEffect.h.

Referenced by Automate(), GetSettings(), and OnSlider().

◆ mSettingsMutex

std::mutex VSTEffect::mSettingsMutex

Definition at line 385 of file VSTEffect.h.

Referenced by Automate(), OnSlider(), and VSTEffectInstance::RealtimeProcessStart().

◆ mSliders

ArrayOf<wxSlider *> VSTEffect::mSliders
private

Definition at line 474 of file VSTEffect.h.

Referenced by BuildPlain(), CloseUI(), and RefreshParameters().

◆ mTimer

std::unique_ptr<VSTEffectTimer> VSTEffect::mTimer
private

Definition at line 461 of file VSTEffect.h.

Referenced by NeedEditIdle(), NeedIdle(), and VSTEffect().

◆ mTimerGuard

int VSTEffect::mTimerGuard {0}
private

Definition at line 460 of file VSTEffect.h.

Referenced by OnTimer().

◆ mValidator

VSTEffectValidator* VSTEffect::mValidator {}
private

Definition at line 417 of file VSTEffect.h.

Referenced by CloseUI(), and ShowClientInterface().

◆ mWantsEditIdle

bool VSTEffect::mWantsEditIdle {false}
private

Definition at line 457 of file VSTEffect.h.

Referenced by NeedEditIdle(), and OnTimer().

◆ mWantsIdle

bool VSTEffect::mWantsIdle { false }
private

Definition at line 458 of file VSTEffect.h.

Referenced by NeedIdle(), and OnTimer().


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