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

#include <VSTEffect.h>

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

Public Member Functions

 ~VSTEffect () override
 
 VSTEffectBase (const PluginPath &path)
 
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 (EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 
- Public Member Functions inherited from VSTEffectBase
 VSTEffectBase (const PluginPath &path)
 
 ~VSTEffectBase () override
 
PluginPath GetPath () const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
bool DoLoadFactoryPreset (int id)
 
bool InitializePlugin ()
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
EffectSettings MakeSettings () const override
 
std::vector< int > GetEffectIDs ()
 
- Public Member Functions inherited from VSTWrapper
 VSTWrapper (const PluginPath &path)
 
 ~VSTWrapper ()
 
intptr_t callDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) override
 
intptr_t constCallDispatcher (int opcode, int index, intptr_t value, void *ptr, float opt) const
 
float callGetParameter (int index) const
 
void callSetChunk (bool isPgm, int len, void *buf)
 
void callSetChunk (bool isPgm, int len, void *buf, VstPatchChunkInfo *info) const
 
int GetString (wxString &outstr, int opcode, int index=0) const
 
wxString GetString (int opcode, int index=0) const
 
void ForEachParameter (ParameterVisitor visitor) const
 
bool FetchSettings (VSTSettings &vst3Settings, bool doFetch=true) const
 
bool StoreSettings (const VSTSettings &vst3settings) const
 
VstPatchChunkInfo GetChunkInfo () const
 
bool IsCompatible (const VstPatchChunkInfo &) const
 
bool LoadXML (const wxFileName &fn)
 
bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override
 
void HandleXMLEndTag (const std::string_view &tag) override
 
void HandleXMLContent (const std::string_view &content) override
 
XMLTagHandlerHandleXMLChild (const std::string_view &tag) override
 
void SetString (int opcode, const wxString &str, int index=0)
 
ComponentInterfaceSymbol GetSymbol () const
 
void callSetParameter (int index, float value) const
 
void SaveXML (const wxFileName &fn) const
 
bool LoadFXB (const wxFileName &fn)
 
bool LoadFXP (const wxFileName &fn)
 
bool LoadFXProgram (unsigned char **bptr, ssize_t &len, int index, bool dryrun)
 
void callSetProgram (int index)
 
void SaveFXB (const wxFileName &fn) const
 
void SaveFXP (const wxFileName &fn) const
 
void SaveFXProgram (wxMemoryBuffer &buf, int index) const
 
bool Load ()
 
void Unload ()
 
void ResetModuleAndHandle ()
 
VstTimeInfoGetTimeInfo ()
 
float GetSampleRate ()
 
int GetProcessLevel ()
 
virtual void SetBufferDelay (int samples)
 
std::unique_ptr< EffectInstance::MessageMakeMessageFS (const VSTSettings &settings) const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 
- Public Member Functions inherited from VSTUIWrapper
virtual void Idle ()
 
virtual void NeedIdle ()
 
virtual void SizeWindow (int w, int h)
 
virtual void Automate (int index, float value)
 
virtual void Flush ()
 
- Public Member Functions inherited from PerTrackEffect
 ~PerTrackEffect () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
double GetDefaultDuration ()
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Private Member Functions

int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
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...
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
OptionalMessage ImportPresetsNC (EffectSettings &settings)
 
void ShowOptions (const EffectPlugin &plugin) const override
 
virtual std::unique_ptr< EffectEditorMakeEditor (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const final
 Will never be called. More...
 

Additional Inherited Members

- Public Types inherited from EffectUIServices
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from VSTWrapper
using ParameterVisitor = std::function< bool(const ParameterInfo &pi) >
 
using ModuleHandle = std::unique_ptr< wxDynamicLibrary >
 
using BundleHandle = CF_ptr< CFBundleRef >
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Static Public Member Functions inherited from EffectUIServices
static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Static Public Member Functions inherited from VSTWrapper
static VSTSettingsGetSettings (EffectSettings &settings)
 
static const VSTSettingsGetSettings (const EffectSettings &settings)
 
static intptr_t AudioMaster (AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr, float opt)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
- Static Public Member Functions inherited from EffectBase
static std::optional< InstancePointerFindInstance (EffectPlugin &plugin)
 
static InstanceFinder DefaultInstanceFinder (EffectPlugin &plugin)
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Public Attributes inherited from VSTWrapper
AEffectmAEffect = nullptr
 
std::thread::id mMainThreadId
 
std::recursive_mutex mDispatcherLock
 
int mVstVersion
 
wxString mName
 
bool mInSet
 
bool mInChunk
 
wxString mChunk
 
long mXMLVersion
 
VstPatchChunkInfo mXMLInfo
 
intptr_t mCurrentEffectID {}
 
PluginPath mPath
 
ModuleHandle mModule {}
 
wxString mVendor
 
wxString mDescription
 
int mVersion
 
bool mInteractive { false }
 
unsigned mAudioIns { 0 }
 
unsigned mAudioOuts { 0 }
 
int mMidiIns { 0 }
 
int mMidiOuts { 0 }
 
bool mAutomatable
 
BundleHandle mBundleRef
 
ResourceHandle mResource
 
VstTimeInfo mTimeInfo
 
int mBufferDelay { 0 }
 
int mProcessLevel { 1 }
 
bool mGui { false }
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
std::shared_ptr< EffectOutputTracksMakeOutputTracks ()
 
void DestroyOutputTracks () const
 
- Protected Member Functions inherited from Effect
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, sampleCount *start, sampleCount *len)
 
- Protected Member Functions inherited from EffectBase
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Detailed Description

Definition at line 52 of file VSTEffect.h.

Constructor & Destructor Documentation

◆ ~VSTEffect()

VSTEffect::~VSTEffect ( )
overridedefault

Member Function Documentation

◆ ExportPresets()

void VSTEffect::ExportPresets ( const EffectPlugin plugin,
const EffectSettings settings 
) const
overrideprivatevirtual

Reimplemented from BasicEffectUIServices.

Definition at line 149 of file VSTEffect.cpp.

151{
152 wxString path;
153
154 // Ask the user for the real name
155 //
156 // Passing a valid parent will cause some effects dialogs to malfunction
157 // upon returning from the SelectFile().
158 path = SelectFile(FileNames::Operation::Presets,
159 XO("Save VST Preset As:"),
160 wxEmptyString,
161 wxT("preset"),
162 wxT("xml"),
163 {
164 { XO("Standard VST bank file"), { wxT("fxb") }, true },
165 { XO("Standard VST program file"), { wxT("fxp") }, true },
166 { XO("Audacity VST preset file"), { wxT("xml") }, true },
167 },
168 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER,
169 NULL);
170
171 // User canceled...
172 if (path.empty())
173 {
174 return;
175 }
176
178 return;
179
180 wxFileName fn(path);
181 wxString ext = fn.GetExt();
182 if (ext.CmpNoCase(wxT("fxb")) == 0)
183 {
184 SaveFXB(fn);
185 }
186 else if (ext.CmpNoCase(wxT("fxp")) == 0)
187 {
188 SaveFXP(fn);
189 }
190 else if (ext.CmpNoCase(wxT("xml")) == 0)
191 {
192 // may throw
193 SaveXML(fn);
194 }
195 else
196 {
197 // This shouldn't happen, but complain anyway
199 XO("Unrecognized file extension."),
200 XO("Error Saving VST Presets"),
201 wxOK | wxCENTRE,
202 nullptr);
203
204 return;
205 }
206}
wxT("CloseDown"))
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:51
static const auto fn
void SaveFXP(const wxFileName &fn) const
static VSTSettings & GetSettings(EffectSettings &settings)
Definition: VSTWrapper.h:103
bool StoreSettings(const VSTSettings &vst3settings) const
void SaveFXB(const wxFileName &fn) const
void SaveXML(const wxFileName &fn) const

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

Here is the call graph for this function:

◆ ImportPresets()

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

Reimplemented from BasicEffectUIServices.

Definition at line 213 of file VSTEffect.cpp.

215{
216 auto temp = std::make_unique<VSTEffect>(this->mPath);
217 if (!temp->InitializePlugin())
218 return {};
219 return temp->ImportPresetsNC(settings);
220}
PluginPath mPath
Definition: VSTWrapper.h:203

References VSTWrapper::mPath, and settings().

Here is the call graph for this function:

◆ ImportPresetsNC()

OptionalMessage VSTEffect::ImportPresetsNC ( EffectSettings settings)
private

Definition at line 222 of file VSTEffect.cpp.

223{
224 wxString path;
225
226 // Ask the user for the real name
227 path = SelectFile(FileNames::Operation::Presets,
228 XO("Load VST Preset:"),
229 wxEmptyString,
230 wxT("preset"),
231 wxT("xml"),
232 { {
233 XO("VST preset files"),
234 { wxT("fxb"), wxT("fxp"), wxT("xml") },
235 true
236 } },
237 wxFD_OPEN | wxRESIZE_BORDER,
238 nullptr);
239
240 // User canceled...
241 if (path.empty())
242 {
243 return {};
244 }
245
246 wxFileName fn(path);
247 wxString ext = fn.GetExt();
248 bool success = false;
249 if (ext.CmpNoCase(wxT("fxb")) == 0)
250 {
251 success = LoadFXB(fn);
252 }
253 else if (ext.CmpNoCase(wxT("fxp")) == 0)
254 {
255 success = LoadFXP(fn);
256 }
257 else if (ext.CmpNoCase(wxT("xml")) == 0)
258 {
259 success = LoadXML(fn);
260 }
261 else
262 {
263 // This shouldn't happen, but complain anyway
265 XO("Unrecognized file extension."),
266 XO("Error Loading VST Presets"),
267 wxOK | wxCENTRE,
268 nullptr);
269
270 return {};
271 }
272
273 if (!success)
274 {
276 XO("Unable to load presets file."),
277 XO("Error Loading VST Presets"),
278 wxOK | wxCENTRE,
279 nullptr);
280
281 return {};
282 }
283
285 return {};
286
287 return MakeMessageFS(
289}
bool FetchSettings(VSTSettings &vst3Settings, bool doFetch=true) const
bool LoadXML(const wxFileName &fn)
bool LoadFXP(const wxFileName &fn)
Definition: VSTWrapper.cpp:931
std::unique_ptr< EffectInstance::Message > MakeMessageFS(const VSTSettings &settings) const
bool LoadFXB(const wxFileName &fn)
Definition: VSTWrapper.cpp:758

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

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
finalprivatevirtual

Will never be called.

Will not come here because Effect::PopulateUI is overridden

Implements StatelessEffectUIServices.

Definition at line 139 of file VSTEffect.cpp.

142{
144 assert(false);
145 return nullptr;
146}

◆ PopulateUI()

std::unique_ptr< EffectEditor > VSTEffect::PopulateUI ( const EffectPlugin plugin,
ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
) const
overrideprivatevirtual

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

100{
101 auto parent = S.GetParent();
102
103 // Determine whether fancy UI is available
104 bool gui = mGui;
105
106 // Then use fancy UI only if preferences say so
107 if (gui)
108 GetConfig(*this, PluginSettings::Shared, wxT("Options"),
109 wxT("UseGUI"),
110 gui,
111 true);
112
113 auto pParent = S.GetParent();
114
115 auto& vst2Instance = dynamic_cast<VSTInstance&>(instance);
116
117 auto editor = std::make_unique<VSTEditor>(
118 vst2Instance, GetType(), gui, *this, access, pParent, mAEffect->numParams);
119
120 // Also let the instance know about the validator, so it can forward
121 // to it calls coming from the vst callback
122 vst2Instance.SetOwningValidator(editor.get());
123
124
125 // Build the appropriate dialog type
126 if (gui)
127 {
128 editor->BuildFancy(instance);
129 }
130 else
131 {
132 editor->BuildPlain(access, GetType(), mProjectRate);
133 }
134
135
136 return editor;
137}
#define S(N)
Definition: ToChars.cpp:64
int numParams
Definition: aeffectx.h:274
double mProjectRate
Definition: EffectBase.h:119
EffectType GetType() const override
Type determines how it behaves.
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
AEffect * mAEffect
Definition: VSTWrapper.h:124

References PluginSettings::GetConfig(), VSTEffectBase::GetType(), VSTWrapper::mAEffect, VSTWrapper::mGui, EffectBase::mProjectRate, AEffect::numParams, S, PluginSettings::Shared, 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
overrideprivatevirtual

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

89{
90 // mProcessLevel = 1; // in GUI thread
91
92 VSTEditor* vstEditor = static_cast<VSTEditor*>(pEditor);
93
94 return vstEditor->ShowDialog(/* nonModal = */ SupportsRealtime() && !forceModal);
95}
int ShowDialog(bool nonModal)
Definition: VSTEditor.cpp:88

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

Here is the call graph for this function:

◆ ShowOptions()

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

Reimplemented from BasicEffectUIServices.

Definition at line 291 of file VSTEffect.cpp.

292{
293 VSTEffectOptionsDialog{ *this }.ShowModal();
294}

◆ VSTEffectBase()

VSTEffectBase::VSTEffectBase ( const PluginPath path)

Definition at line 31 of file VSTEffectBase.cpp.

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

References kVstNanosValid, and kVstTempoValid.


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