Audacity 3.2.0
Public Member Functions | 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...
 
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)
 
int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
bool InitializePlugin ()
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
std::shared_ptr< EffectInstanceDoMakeInstance ()
 
std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
 Adds controls to a panel that is given as the parent window of S More...
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
OptionalMessage ImportPresetsNC (EffectSettings &settings)
 
bool HasOptions () const override
 
void ShowOptions (const EffectPlugin &plugin) const override
 
EffectSettings MakeSettings () const override
 
- 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
 
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, bool doFetch=true) 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 ()
 
void Unload ()
 
void ResetModuleAndHandle ()
 
VstTimeInfoGetTimeInfo ()
 
float GetSampleRate ()
 
int GetProcessLevel ()
 
virtual void UpdateDisplay ()
 
virtual void SetBufferDelay (int samples)
 
std::unique_ptr< EffectInstance::MessageMakeMessageFS (const VSTEffectSettings &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 VSTEffectUIWrapper
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 StatelessPerTrackEffect
 ~StatelessPerTrackEffect () override
 
- 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...
 
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 NumericFormatSymbol 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)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
void SetTracks (TrackList *pTracks)
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
- 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 void Preview (EffectSettingsAccess &access, std::function< void()> updateUI, bool dryOnly)=0
 Calculate temporary tracks of limited length with effect applied and play. More...
 
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
 
std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
 Adds controls to a panel that is given as the parent window of S More...
 
virtual std::unique_ptr< EffectEditorMakeEditor (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Called only from PopulateUI, to add controls to effect panel. More...
 
- Public Member Functions inherited from BasicEffectUIServices
int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
void ShowOptions (const EffectPlugin &plugin) const override
 
bool ValidateUI (const EffectPlugin &context, EffectSettings &) const override
 
bool CloseUI () const override
 
- Public Member Functions inherited from EffectUIServices
virtual ~EffectUIServices ()
 
virtual int ShowHostInterface (EffectPlugin &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 

Protected Member Functions

virtual std::unique_ptr< EffectEditorMakeEditor (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const final
 Will never be called. More...
 
void UpdateDisplay () 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 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, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
void Preview (EffectSettingsAccess &access, std::function< void()> updateUI, bool dryOnly) final
 Calculate temporary tracks of limited length with effect applied and play. 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

std::vector< int > GetEffectIDs ()
 
void OnUpdateDisplay (wxCommandEvent &evt)
 
void OnProgram (wxCommandEvent &evt)
 
void OnProgramText (wxCommandEvent &evt)
 
void OnLoad (wxCommandEvent &evt)
 
void OnSave (wxCommandEvent &evt)
 
void OnSettings (wxCommandEvent &evt)
 
wxSizer * BuildProgramBar ()
 

Private Attributes

PluginID mID
 
wxSizerItem * mContainer {}
 

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 EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Types inherited from EffectUIServices
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from VSTEffectWrapper
static VSTEffectSettingsGetSettings (EffectSettings &settings)
 
static const VSTEffectSettingsGetSettings (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 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 Member Functions inherited from EffectUIServices
static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Attributes inherited from VSTEffectWrapper
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
TrackListmTracks {}
 
- 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 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 335 of file VSTEffect.h.

Constructor & Destructor Documentation

◆ VSTEffect()

VSTEffect::VSTEffect ( const PluginPath path)

Definition at line 786 of file VSTEffect.cpp.

787: VSTEffectWrapper(path)
788{
789 memset(&mTimeInfo, 0, sizeof(mTimeInfo));
790 mTimeInfo.samplePos = 0.0;
791 mTimeInfo.sampleRate = 44100.0; // this is a bogus value, but it's only for the display
792 mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
793 mTimeInfo.tempo = 120.0;
797}
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: VSTEffect.h:276
VSTEffectWrapper(const PluginPath &path)
Definition: VSTEffect.h:128

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

◆ ~VSTEffect()

VSTEffect::~VSTEffect ( )
virtual

Definition at line 799 of file VSTEffect.cpp.

800{
801}

Member Function Documentation

◆ BuildProgramBar()

wxSizer * VSTEffect::BuildProgramBar ( )
private

◆ CanExportPresets()

bool VSTEffect::CanExportPresets ( ) const
overridevirtual

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

Implements EffectPlugin.

Definition at line 1603 of file VSTEffect.cpp.

1604{
1605 return true;
1606}

◆ DoLoadFactoryPreset()

bool VSTEffect::DoLoadFactoryPreset ( int  id)

Definition at line 1545 of file VSTEffect.cpp.

1546{
1547 callSetProgram(id);
1548
1549 return true;
1550}
void callSetProgram(int index)
Definition: VSTEffect.cpp:2497

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 1046 of file VSTEffect.cpp.

1047{
1048 int userBlockSize;
1049 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
1050 wxT("BufferSize"), userBlockSize, 8192);
1051 size_t userBlockSizeC = std::max( 1, userBlockSize );
1052 bool useLatency;
1053 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
1054 wxT("UseLatency"), useLatency, true);
1055
1056
1057 return std::make_shared<VSTEffectInstance>(
1058 *this, mPath, userBlockSizeC, userBlockSizeC, useLatency);
1059}
wxT("CloseDown"))
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
PluginPath mPath
Definition: VSTEffect.h:214

References PluginSettings::GetConfig(), VSTEffectWrapper::mPath, 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 EffectPlugin plugin,
const EffectSettings settings 
) const
overridevirtual

Reimplemented from BasicEffectUIServices.

Definition at line 1609 of file VSTEffect.cpp.

1611{
1612 wxString path;
1613
1614 // Ask the user for the real name
1615 //
1616 // Passing a valid parent will cause some effects dialogs to malfunction
1617 // upon returning from the SelectFile().
1618 path = SelectFile(FileNames::Operation::Presets,
1619 XO("Save VST Preset As:"),
1620 wxEmptyString,
1621 wxT("preset"),
1622 wxT("xml"),
1623 {
1624 { XO("Standard VST bank file"), { wxT("fxb") }, true },
1625 { XO("Standard VST program file"), { wxT("fxp") }, true },
1626 { XO("Audacity VST preset file"), { wxT("xml") }, true },
1627 },
1628 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
1629 NULL);
1630
1631 // User canceled...
1632 if (path.empty())
1633 {
1634 return;
1635 }
1636
1638 return;
1639
1640 wxFileName fn(path);
1641 wxString ext = fn.GetExt();
1642 if (ext.CmpNoCase(wxT("fxb")) == 0)
1643 {
1644 SaveFXB(fn);
1645 }
1646 else if (ext.CmpNoCase(wxT("fxp")) == 0)
1647 {
1648 SaveFXP(fn);
1649 }
1650 else if (ext.CmpNoCase(wxT("xml")) == 0)
1651 {
1652 // may throw
1653 SaveXML(fn);
1654 }
1655 else
1656 {
1657 // This shouldn't happen, but complain anyway
1659 XO("Unrecognized file extension."),
1660 XO("Error Saving VST Presets"),
1661 wxOK | wxCENTRE,
1662 nullptr);
1663
1664 return;
1665 }
1666}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
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
bool StoreSettings(const VSTEffectSettings &vst3settings) const
Definition: VSTEffect.cpp:3833
void SaveFXP(const wxFileName &fn) const
Definition: VSTEffect.cpp:3323
void SaveXML(const wxFileName &fn) const
Definition: VSTEffect.cpp:3420
void SaveFXB(const wxFileName &fn) const
Definition: VSTEffect.cpp:3235
static VSTEffectSettings & GetSettings(EffectSettings &settings)
Definition: VSTEffect.h:114

References AudacityMessageBox(), fn, VSTEffectWrapper::GetSettings(), 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

Implements ComponentInterface.

Definition at line 841 of file VSTEffect.cpp.

842{
843 // VST does have a product string opcode and some effects return a short
844 // description, but most do not or they just return the name again. So,
845 // try to provide some sort of useful information.
846 return XO("Audio In: %d, Audio Out: %d").Format( mAudioIns, mAudioOuts );
847}
unsigned mAudioOuts
Definition: VSTEffect.h:233
unsigned mAudioIns
Definition: VSTEffect.h:232

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

Here is the call graph for this function:

◆ GetEffectIDs()

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

Definition at line 2065 of file VSTEffect.cpp.

2066{
2067 std::vector<int> effectIDs;
2068
2069 // Are we a shell?
2071 {
2072 char name[64];
2073 int effectID;
2074
2075 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
2076 while (effectID)
2077 {
2078 effectIDs.push_back(effectID);
2079 effectID = (int) callDispatcher(effShellGetNextPlugin, 0, 0, &name, 0);
2080 }
2081 }
2082
2083 return effectIDs;
2084}
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
intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt) override
Definition: VSTEffect.cpp:2456

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.

Implements EffectSettingsManager.

Definition at line 1515 of file VSTEffect.cpp.

1516{
1517 RegistryPaths progs;
1518
1519 // Some plugins, like Guitar Rig 5, only report 128 programs while they have hundreds. While
1520 // I was able to come up with a hack in the Guitar Rig case to gather all of the program names
1521 // it would not let me set a program outside of the first 128.
1522 if (mVstVersion >= 2)
1523 {
1524 for (int i = 0; i < mAEffect->numPrograms; i++)
1525 {
1526 progs.push_back(GetString(effGetProgramNameIndexed, i));
1527 }
1528 }
1529
1530 return progs;
1531}
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: VSTEffect.cpp:2425
AEffect * mAEffect
Definition: VSTEffect.h:135

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.

Implements EffectDefinitionInterface.

Definition at line 874 of file VSTEffect.cpp.

875{
876 return VSTPLUGINTYPE;
877}
#define VSTPLUGINTYPE
Definition: VSTEffect.h:39

References VSTPLUGINTYPE.

◆ GetPath()

PluginPath VSTEffect::GetPath ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 807 of file VSTEffect.cpp.

808{
809 return mPath;
810}

References VSTEffectWrapper::mPath.

◆ GetSymbol()

ComponentInterfaceSymbol VSTEffect::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 812 of file VSTEffect.cpp.

813{
815}
ComponentInterfaceSymbol GetSymbol() const
Definition: VSTEffect.cpp:3890

References VSTEffectWrapper::GetSymbol().

Here is the call graph for this function:

◆ GetType()

EffectType VSTEffect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 853 of file VSTEffect.cpp.

854{
855 if (mAudioIns == 0 && mAudioOuts == 0)
856 {
857 return EffectTypeTool;
858 }
859
860 if (mAudioIns == 0)
861 {
862 return EffectTypeGenerate;
863 }
864
865 if (mAudioOuts == 0)
866 {
867 return EffectTypeAnalyze;
868 }
869
870 return EffectTypeProcess;
871}
@ EffectTypeAnalyze
@ EffectTypeGenerate
@ EffectTypeTool
@ EffectTypeProcess

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

Referenced by PopulateUI().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol VSTEffect::GetVendor ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 817 of file VSTEffect.cpp.

818{
819 return { mVendor };
820}
wxString mVendor
Definition: VSTEffect.h:228

References VSTEffectWrapper::mVendor.

◆ GetVersion()

wxString VSTEffect::GetVersion ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 822 of file VSTEffect.cpp.

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

References VSTEffectWrapper::mVersion, and wxT().

Here is the call graph for this function:

◆ HasOptions()

bool VSTEffect::HasOptions ( ) const
overridevirtual

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

Implements EffectPlugin.

Definition at line 1751 of file VSTEffect.cpp.

1752{
1753 return true;
1754}

◆ ImportPresets()

OptionalMessage VSTEffect::ImportPresets ( const EffectPlugin plugin,
EffectSettings settings 
) const
overridevirtual
Returns
nullopt for failure

Reimplemented from BasicEffectUIServices.

Definition at line 1673 of file VSTEffect.cpp.

1675{
1676 auto temp = std::make_unique<VSTEffect>(this->mPath);
1677 if (!temp->InitializePlugin())
1678 return {};
1679 return temp->ImportPresetsNC(settings);
1680}

References VSTEffectWrapper::mPath, and settings().

Here is the call graph for this function:

◆ ImportPresetsNC()

OptionalMessage VSTEffect::ImportPresetsNC ( EffectSettings settings)

Definition at line 1682 of file VSTEffect.cpp.

1683{
1684 wxString path;
1685
1686 // Ask the user for the real name
1687 path = SelectFile(FileNames::Operation::Presets,
1688 XO("Load VST Preset:"),
1689 wxEmptyString,
1690 wxT("preset"),
1691 wxT("xml"),
1692 { {
1693 XO("VST preset files"),
1694 { wxT("fxb"), wxT("fxp"), wxT("xml") },
1695 true
1696 } },
1697 wxFD_OPEN | wxRESIZE_BORDER,
1698 nullptr);
1699
1700 // User canceled...
1701 if (path.empty())
1702 {
1703 return {};
1704 }
1705
1706 wxFileName fn(path);
1707 wxString ext = fn.GetExt();
1708 bool success = false;
1709 if (ext.CmpNoCase(wxT("fxb")) == 0)
1710 {
1711 success = LoadFXB(fn);
1712 }
1713 else if (ext.CmpNoCase(wxT("fxp")) == 0)
1714 {
1715 success = LoadFXP(fn);
1716 }
1717 else if (ext.CmpNoCase(wxT("xml")) == 0)
1718 {
1719 success = LoadXML(fn);
1720 }
1721 else
1722 {
1723 // This shouldn't happen, but complain anyway
1725 XO("Unrecognized file extension."),
1726 XO("Error Loading VST Presets"),
1727 wxOK | wxCENTRE,
1728 nullptr);
1729
1730 return {};
1731 }
1732
1733 if (!success)
1734 {
1736 XO("Unable to load presets file."),
1737 XO("Error Loading VST Presets"),
1738 wxOK | wxCENTRE,
1739 nullptr);
1740
1741 return {};
1742 }
1743
1745 return {};
1746
1747 return MakeMessageFS(
1749}
std::unique_ptr< EffectInstance::Message > MakeMessageFS(const VSTEffectSettings &settings) const
Definition: VSTEffect.cpp:3910
bool FetchSettings(VSTEffectSettings &vst3Settings, bool doFetch=true) const
Definition: VSTEffect.cpp:3783
bool LoadFXB(const wxFileName &fn)
Definition: VSTEffect.cpp:2824
bool LoadXML(const wxFileName &fn)
Definition: VSTEffect.cpp:3203
bool LoadFXP(const wxFileName &fn)
Definition: VSTEffect.cpp:2997

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

Here is the call graph for this function:

◆ InitializePlugin()

bool VSTEffect::InitializePlugin ( )

Definition at line 903 of file VSTEffect.cpp.

904{
905 if (!mAEffect)
906 {
907 Load();
908 }
909
910 if (!mAEffect)
911 {
912 return false;
913 }
914
915 return true;
916}

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.

Implements EffectDefinitionInterface.

Definition at line 884 of file VSTEffect.cpp.

885{
886 return false;
887}

◆ IsInteractive()

bool VSTEffect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Implements EffectDefinitionInterface.

Definition at line 879 of file VSTEffect.cpp.

880{
881 return mInteractive;
882}

References VSTEffectWrapper::mInteractive.

◆ LoadFactoryPreset()

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

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

Returns
nullopt for failure

Implements EffectSettingsManager.

Definition at line 1534 of file VSTEffect.cpp.

1535{
1536 // To do: externalize state so const_cast isn't needed
1537 bool loadOK = const_cast<VSTEffect*>(this)->DoLoadFactoryPreset(id) &&
1539 if (!loadOK)
1540 return {};
1541 return MakeMessageFS(
1543}
bool DoLoadFactoryPreset(int id)
Definition: VSTEffect.cpp:1545

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

Here is the call 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

Implements EffectSettingsManager.

Definition at line 1477 of file VSTEffect.cpp.

1478{
1479 VSTEffectSettings& vstSettings = GetSettings(settings);
1480
1481 long index{};
1482 wxString key;
1483 double value = 0.0;
1484 if (parms.GetFirstEntry(key, index))
1485 {
1486 do
1487 {
1488 if (parms.Read(key, &value)) {
1489 auto &map = vstSettings.mParamsMap;
1490 auto iter = map.find(key);
1491 if (iter != map.end()) {
1492 if (iter->second)
1493 // Should be guaranteed by MakeSettings
1494 iter->second = value;
1495 else {
1496 assert(false);
1497 }
1498 }
1499 else
1500 // Unknown parameter name in the file
1501 return false;
1502 }
1503 } while (parms.GetNextEntry(key, index));
1504 }
1505
1506 // Loads key-value pairs only from a config file -- no chunk
1507 vstSettings.mChunk.resize(0);
1511
1512 return true;
1513}
static const AudacityProject::AttachedObjects::RegisteredFactory key
int numParams
Definition: aeffectx.h:274
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, std::optional< double > > mParamsMap
Definition: VSTEffect.h:99
std::vector< char > mChunk
Definition: VSTEffect.h:96
int32_t mNumParams
Definition: VSTEffect.h:88

References VSTEffectWrapper::GetSettings(), key, VSTEffectWrapper::mAEffect, VSTEffectSettings::mChunk, VSTEffectSettings::mNumParams, VSTEffectSettings::mParamsMap, VSTEffectSettings::mUniqueID, VSTEffectSettings::mVersion, VSTEffectWrapper::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 VSTEffect::LoadUserPreset ( const RegistryPath name,
EffectSettings settings 
) const
overridevirtual

Change settings to a user-named preset

Returns
nullopt for failure

Implements EffectSettingsManager.

Definition at line 2100 of file VSTEffect.cpp.

2102{
2103 wxString value;
2104
2105 auto info = GetChunkInfo();
2106
2107 GetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"),
2108 info.pluginUniqueID, info.pluginUniqueID);
2109 GetConfig(*this, PluginSettings::Private, group, wxT("Version"),
2110 info.pluginVersion, info.pluginVersion);
2111 GetConfig(*this, PluginSettings::Private, group, wxT("Elements"),
2112 info.numElements, info.numElements);
2113
2114 if ( ! IsCompatible(info) )
2115 {
2116 return {};
2117 }
2118
2119 if (GetConfig(*this,
2120 PluginSettings::Private, group, wxT("Chunk"), value, wxEmptyString))
2121 {
2122 ArrayOf<char> buf{ value.length() / 4 * 3 };
2123
2124 int len = Base64::Decode(value, buf.get());
2125 if (len)
2126 {
2127 callSetChunk(true, len, buf.get(), &info);
2129 return {};
2130 }
2131
2132 return MakeMessageFS(
2134 }
2135
2136 wxString parms;
2137 if (!GetConfig(*this,
2138 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
2139 {
2140 return {};
2141 }
2142
2144 if (!eap.SetParameters(parms))
2145 {
2146 return {};
2147 }
2148
2149 const bool loadOK = LoadSettings(eap, settings) &&
2151 if (!loadOK)
2152 return {};
2153
2154 return MakeMessageFS(
2156}
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:1477
STRINGS_API int Decode(const wxString &in, void *out)
Definition: Base64.cpp:67
VstPatchChunkInfo GetChunkInfo() const
Definition: VSTEffect.cpp:2087
bool IsCompatible(const VstPatchChunkInfo &) const
Definition: VSTEffect.cpp:2093
void callSetChunk(bool isPgm, int len, void *buf)
Definition: VSTEffect.cpp:2507

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

Here is the call graph for this function:

◆ MakeEditor()

std::unique_ptr< EffectEditor > VSTEffect::MakeEditor ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
) const
finalprotectedvirtual

Will never be called.

Will not come here because Effect::PopulateUI is overridden

Implements StatelessEffectUIServices.

Definition at line 1594 of file VSTEffect.cpp.

1597{
1599 assert(false);
1600 return nullptr;
1601}

◆ 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 1041 of file VSTEffect.cpp.

1042{
1043 return const_cast<VSTEffect*>(this)->DoMakeInstance();
1044}
std::shared_ptr< EffectInstance > DoMakeInstance()
Definition: VSTEffect.cpp:1046

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 3895 of file VSTEffect.cpp.

3896{
3899 return EffectSettings::Make<VSTEffectSettings>(std::move(settings));
3900}

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

Here is the call graph for this function:

◆ 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

◆ OnUpdateDisplay()

void VSTEffect::OnUpdateDisplay ( wxCommandEvent &  evt)
private

◆ PopulateUI()

std::unique_ptr< EffectEditor > VSTEffect::PopulateUI ( const EffectPlugin plugin,
ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
) const
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
pOutputsnull, or else points to outputs with 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 StatelessEffectUIServices.

Definition at line 1552 of file VSTEffect.cpp.

1555{
1556 auto parent = S.GetParent();
1557
1558 // Determine whether fancy UI is available
1559 bool gui = mGui;
1560
1561 // Then use fancy UI only if preferences say so
1562 if (gui)
1563 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
1564 wxT("UseGUI"),
1565 gui,
1566 true);
1567
1568 auto pParent = S.GetParent();
1569
1570 auto& vst2Instance = dynamic_cast<VSTEffectInstance&>(instance);
1571
1572 auto editor = std::make_unique<VSTEffectEditor>(
1573 vst2Instance, gui, *this, access, pParent, mAEffect->numParams);
1574
1575 // Also let the instance know about the validator, so it can forward
1576 // to it calls coming from the vst callback
1577 vst2Instance.SetOwningValidator(editor.get());
1578
1579
1580 // Build the appropriate dialog type
1581 if (mGui)
1582 {
1583 editor->BuildFancy(instance);
1584 }
1585 else
1586 {
1587 editor->BuildPlain(access, GetType(), mProjectRate);
1588 }
1589
1590
1591 return editor;
1592}
#define S(N)
Definition: ToChars.cpp:64
double mProjectRate
Definition: EffectBase.h:105
EffectType GetType() const override
Type determines how it behaves.
Definition: VSTEffect.cpp:853

References PluginSettings::GetConfig(), GetType(), VSTEffectWrapper::mAEffect, VSTEffectWrapper::mGui, EffectBase::mProjectRate, 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?

Implements EffectDefinitionInterface.

Definition at line 889 of file VSTEffect.cpp.

890{
892
893 /* return GetType() == EffectTypeProcess
894 ? RealtimeSince::Always
895 : RealtimeSince::Never; */
896}

References EffectDefinitionInterface::Always.

◆ 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

Implements EffectSettingsManager.

Definition at line 1455 of file VSTEffect.cpp.

1456{
1457 const VSTEffectSettings& vstSettings = GetSettings(settings);
1458
1459 for (const auto& item : vstSettings.mParamsMap)
1460 {
1461 if (item.second)
1462 {
1463 const auto& name = item.first;
1464 const auto& value = *(item.second);
1465
1466 if (!parms.Write(name, value))
1467 {
1468 return false;
1469 }
1470 }
1471 }
1472
1473 return true;
1474}

References VSTEffectWrapper::GetSettings(), VSTEffectSettings::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 VSTEffect::SaveUserPreset ( const RegistryPath name,
const EffectSettings settings 
) const
overridevirtual

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

Implements EffectSettingsManager.

Definition at line 2159 of file VSTEffect.cpp.

2161{
2162 const auto& vstSettings = GetSettings(settings);
2163
2164 if ( ! StoreSettings(vstSettings) )
2165 return false;
2166
2167 SetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"), vstSettings.mUniqueID );
2168 SetConfig(*this, PluginSettings::Private, group, wxT("Version"), vstSettings.mVersion );
2169 SetConfig(*this, PluginSettings::Private, group, wxT("Elements"), vstSettings.mNumParams);
2170
2172 {
2173 void *chunk = NULL;
2174 int clen = (int) constCallDispatcher(effGetChunk, 1, 0, &chunk, 0.0);
2175 if (clen <= 0)
2176 {
2177 return false;
2178 }
2179
2180 SetConfig(*this, PluginSettings::Private, group, wxT("Chunk"),
2181 Base64::Encode(chunk, clen));
2182 return true;
2183 }
2184
2186 if (!SaveSettings(settings, eap))
2187 {
2188 return false;
2189 }
2190
2191 wxString parms;
2192 if (!eap.GetParameters(parms))
2193 {
2194 return false;
2195 }
2196
2197 return SetConfig(*this, PluginSettings::Private,
2198 group, wxT("Parameters"), parms);
2199}
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.
Definition: VSTEffect.cpp:1455
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:2465

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

Here is the call graph for this function:

◆ ShowClientInterface()

int VSTEffect::ShowClientInterface ( const EffectPlugin plugin,
wxWindow &  parent,
wxDialog &  dialog,
EffectEditor pEditor,
bool  forceModal 
) const
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 BasicEffectUIServices.

Definition at line 1426 of file VSTEffect.cpp.

1429{
1430 // mProcessLevel = 1; // in GUI thread
1431
1432 VSTEffectEditor* vstEditor = static_cast<VSTEffectEditor*>(pEditor);
1433
1434 return vstEditor->ShowDialog(/* nonModal = */ SupportsRealtime() && !forceModal);
1435}
int ShowDialog(bool nonModal)
Definition: VSTEffect.cpp:1437

References VSTEffectEditor::ShowDialog(), and EffectDefinitionInterface::SupportsRealtime().

Here is the call graph for this function:

◆ ShowOptions()

void VSTEffect::ShowOptions ( const EffectPlugin plugin) const
overridevirtual

Reimplemented from BasicEffectUIServices.

Definition at line 1756 of file VSTEffect.cpp.

1757{
1758 VSTEffectOptionsDialog{ *this }.ShowModal();
1759}

◆ SupportsAutomation()

bool VSTEffect::SupportsAutomation ( ) const
overridevirtual

Whether the effect has any automatable controls.

Implements EffectDefinitionInterface.

Definition at line 898 of file VSTEffect.cpp.

899{
900 return mAutomatable;
901}

References VSTEffectWrapper::mAutomatable.

◆ UpdateDisplay()

void VSTEffect::UpdateDisplay ( )
overrideprotectedvirtual

Reimplemented from VSTEffectWrapper.

Definition at line 2395 of file VSTEffect.cpp.

2396{
2397#if 0
2398 // Tell the dialog to refresh effect information
2399 if (mParent)
2400 {
2401 wxCommandEvent ud(EVT_UPDATEDISPLAY);
2402 mParent->GetEventHandler()->AddPendingEvent(ud);
2403 }
2404#endif
2405 return;
2406}

Friends And Related Function Documentation

◆ VSTEffectsModule

friend class VSTEffectsModule
friend

Definition at line 445 of file VSTEffect.h.

Member Data Documentation

◆ mContainer

wxSizerItem* VSTEffect::mContainer {}
private

Definition at line 443 of file VSTEffect.h.

◆ mID

PluginID VSTEffect::mID
private

Definition at line 441 of file VSTEffect.h.


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