Audacity 3.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LadspaEffectBase Class Reference

An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class. More...

#include <LadspaEffectBase.h>

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

Public Member Functions

 LadspaEffectBase (const wxString &path, int index)
 
 ~LadspaEffectBase () override
 
bool InitializePlugin ()
 
- Public Member Functions inherited from EffectWithSettings< LadspaEffectSettings, PerTrackEffect >
EffectSettings MakeSettings () const override
 
bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const 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
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
- 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
 

Protected Member Functions

EffectSettings MakeSettings () const override
 
bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const override
 Update one settings object from another. More...
 
std::unique_ptr< EffectOutputsMakeOutputs () const override
 Produce an object to hold values to send to effect output meters. More...
 
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 InitializeControls (LadspaEffectSettings &settings) const
 
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
 
bool Load ()
 
void Unload ()
 
OptionalMessage LoadParameters (const RegistryPath &group, EffectSettings &settings) const
 
bool SaveParameters (const RegistryPath &group, const EffectSettings &settings) const
 
- 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

const wxString mPath
 
const int mIndex
 
wxDynamicLibrary mLib
 
const LADSPA_DescriptormData {}
 
wxString pluginName
 
size_t mBlockSize { 0 }
 
bool mInteractive { false }
 
unsigned mAudioIns { 0 }
 
ArrayOf< unsigned long > mInputPorts
 
unsigned mAudioOuts { 0 }
 
ArrayOf< unsigned long > mOutputPorts
 
unsigned mNumInputControls { 0 }
 
unsigned mNumOutputControls { 0 }
 
int mLatencyPort { -1 }
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Additional Inherited Members

- 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 EffectWithSettings< LadspaEffectSettings, PerTrackEffect >
static LadspaEffectSettingsGetSettings (EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static const LadspaEffectSettingsGetSettings (const EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static LadspaEffectSettingsFetchParameters (PerTrackEffect &, EffectSettings &s)
 
- 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 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>")
 

Detailed Description

An Effect that calls up a LADSPA plug in, i.e. many possible effects from this one class.

Definition at line 24 of file LadspaEffectBase.h.

Constructor & Destructor Documentation

◆ LadspaEffectBase()

LadspaEffectBase::LadspaEffectBase ( const wxString &  path,
int  index 
)

Definition at line 76 of file LadspaEffectBase.cpp.

77 : mPath{ path }
78 , mIndex{ index }
79{
80}
const wxString mPath

◆ ~LadspaEffectBase()

LadspaEffectBase::~LadspaEffectBase ( )
overridedefault

Member Function Documentation

◆ CanExportPresets()

bool LadspaEffectBase::CanExportPresets ( ) const
overrideprotectedvirtual

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

Reimplemented from Effect.

Definition at line 346 of file LadspaEffectBase.cpp.

347{
348 return false;
349}

◆ CopySettingsContents()

bool LadspaEffectBase::CopySettingsContents ( const EffectSettings src,
EffectSettings dst 
) const
overrideprotectedvirtual

Update one settings object from another.

This may run in a worker thread, and should avoid memory allocations. Therefore do not copy the underlying std::any, but copy the contents of the contained objects.

Assume that src and dst were created and previously modified only by this

Default implementation does nothing and returns true

Parameters
srcsettings to copy from
dstsettings to copy into
copyDirectiondirection in which copy is performed
Returns
success

Reimplemented from EffectSettingsManager.

Definition at line 35 of file LadspaEffectBase.cpp.

37{
38 // Do not use the copy constructor of std::vector. Do an in-place rewrite
39 // of the destination vector, which will not allocate memory if dstControls
40 // began with sufficient capacity.
41 const auto portCount = mData->PortCount;
42
43 auto &srcControls = GetSettings(src).controls;
44 auto &dstControls = GetSettings(dst).controls;
45
46 assert(srcControls.size() == portCount);
47 assert(dstControls.size() == portCount);
48
49 const auto portValuesCount =
50 std::min(srcControls.size(), dstControls.size());
51
52 if (portValuesCount != portCount)
53 return false;
54
55 for (unsigned long p = 0; p < portCount; ++p)
56 {
58
59 if (!(LADSPA_IS_PORT_CONTROL(d)))
60 continue;
61
63 dstControls[p] = srcControls[p];
64 }
65
66 return true;
67}
int min(int a, int b)
static LadspaEffectSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
Definition: Effect.h:166
const LADSPA_Descriptor * mData
int LADSPA_PortDescriptor
Definition: ladspa.h:152
#define LADSPA_IS_PORT_INPUT(x)
Definition: ladspa.h:168
#define LADSPA_IS_PORT_CONTROL(x)
Definition: ladspa.h:170
const LADSPA_PortDescriptor * PortDescriptors
Definition: ladspa.h:410
unsigned long PortCount
Definition: ladspa.h:406
std::vector< float > controls

References LadspaEffectSettings::controls, EffectWithSettings< LadspaEffectSettings, PerTrackEffect >::GetSettings(), LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, mData, min(), _LADSPA_Descriptor::PortCount, and _LADSPA_Descriptor::PortDescriptors.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString LadspaEffectBase::GetDescription ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 108 of file LadspaEffectBase.cpp.

109{
110 return Verbatim( LAT1CTOWX(mData->Copyright) );
111}
#define LAT1CTOWX(X)
Definition: Internat.h:158
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
const char * Copyright
Definition: ladspa.h:402

References _LADSPA_Descriptor::Copyright, LAT1CTOWX, mData, and Verbatim().

Here is the call graph for this function:

◆ GetFactoryPresets()

RegistryPaths LadspaEffectBase::GetFactoryPresets ( ) const
overrideprotectedvirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 336 of file LadspaEffectBase.cpp.

337{
338 return {};
339}

◆ GetFamily()

EffectFamilySymbol LadspaEffectBase::GetFamily ( ) const
overrideprotectedvirtual

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

Reimplemented from Effect.

Definition at line 137 of file LadspaEffectBase.cpp.

138{
140}
#define LADSPAEFFECTS_FAMILY

References LADSPAEFFECTS_FAMILY.

◆ GetPath()

PluginPath LadspaEffectBase::GetPath ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 88 of file LadspaEffectBase.cpp.

89{
90 return wxString::Format(wxT("%s;%d"), mPath, mIndex);
91}
wxT("CloseDown"))

References mIndex, mPath, and wxT().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol LadspaEffectBase::GetSymbol ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 93 of file LadspaEffectBase.cpp.

94{
95 return LAT1CTOWX(mData->Name);
96}
const char * Name
Definition: ladspa.h:393

References LAT1CTOWX, mData, and _LADSPA_Descriptor::Name.

◆ GetType()

EffectType LadspaEffectBase::GetType ( ) const
overrideprotectedvirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 117 of file LadspaEffectBase.cpp.

118{
119 if (mAudioIns == 0 && mAudioOuts == 0)
120 {
121 return EffectTypeTool;
122 }
123
124 if (mAudioIns == 0)
125 {
126 return EffectTypeGenerate;
127 }
128
129 if (mAudioOuts == 0)
130 {
131 return EffectTypeAnalyze;
132 }
133
134 return EffectTypeProcess;
135}
@ EffectTypeAnalyze
@ EffectTypeGenerate
@ EffectTypeTool
@ EffectTypeProcess

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

Referenced by LadspaEffect::MakeEditor(), RealtimeSupport(), and LadspaEffect::ShowClientInterface().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol LadspaEffectBase::GetVendor ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 98 of file LadspaEffectBase.cpp.

99{
100 return { LAT1CTOWX(mData->Maker) };
101}
const char * Maker
Definition: ladspa.h:397

References LAT1CTOWX, _LADSPA_Descriptor::Maker, and mData.

◆ GetVersion()

wxString LadspaEffectBase::GetVersion ( ) const
overrideprotectedvirtual

Reimplemented from Effect.

Definition at line 103 of file LadspaEffectBase.cpp.

104{
105 return "n/a";
106}

◆ HasOptions()

bool LadspaEffectBase::HasOptions ( ) const
overrideprotectedvirtual

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

Reimplemented from Effect.

Definition at line 351 of file LadspaEffectBase.cpp.

352{
353 return true;
354}

◆ InitializeControls()

bool LadspaEffectBase::InitializeControls ( LadspaEffectSettings settings) const
protected

Definition at line 267 of file LadspaEffectBase.cpp.

268{
269 auto &controls = settings.controls;
270 // (Re-)initialize with right-sized vector
271 std::vector<float>(mData->PortCount).swap(controls);
272
273 for (unsigned long p = 0; p < mData->PortCount; ++p) {
276 // Determine the port's default value
277 controls[p] = InputControlPortDefaultValue(
279 else
280 controls[p] = 0;
281 }
282 return true;
283}
static Settings & settings()
Definition: TrackInfo.cpp:47
double mProjectRate
Definition: EffectBase.h:110
float InputControlPortDefaultValue(const LADSPA_PortRangeHint &hint, double sampleRate)
const LADSPA_PortRangeHint * PortRangeHints
Definition: ladspa.h:419

References anonymous_namespace{LadspaEffectBase.cpp}::InputControlPortDefaultValue(), LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, mData, EffectBase::mProjectRate, _LADSPA_Descriptor::PortCount, _LADSPA_Descriptor::PortDescriptors, _LADSPA_Descriptor::PortRangeHints, and settings().

Referenced by LadspaEffect::LadspaEffectBase().

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

◆ InitializePlugin()

bool LadspaEffectBase::InitializePlugin ( )

Definition at line 229 of file LadspaEffectBase.cpp.

230{
231 if (!Load())
232 return false;
233
236 for (unsigned long p = 0; p < mData->PortCount; p++) {
238
239 // Collect the audio ports
240 if (LADSPA_IS_PORT_AUDIO(d)) {
242 mInputPorts[mAudioIns++] = p;
243 else if (LADSPA_IS_PORT_OUTPUT(d))
245 }
246 // Count control ports
247 else if (LADSPA_IS_PORT_CONTROL(d)) {
248 if (LADSPA_IS_PORT_INPUT(d)) {
249 mInteractive = true;
251 }
252 else if (LADSPA_IS_PORT_OUTPUT(d)) {
253 // LADSPA effects have a convention of providing latency on an output
254 // control port whose name is "latency".
255 if (strcmp(mData->PortNames[p], "latency") == 0)
256 mLatencyPort = p;
257 else {
258 mInteractive = true;
260 }
261 }
262 }
263 }
264 return true;
265}
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:59
unsigned mNumInputControls
ArrayOf< unsigned long > mInputPorts
ArrayOf< unsigned long > mOutputPorts
unsigned mNumOutputControls
#define LADSPA_IS_PORT_AUDIO(x)
Definition: ladspa.h:171
#define LADSPA_IS_PORT_OUTPUT(x)
Definition: ladspa.h:169
const char *const * PortNames
Definition: ladspa.h:415

References LADSPA_IS_PORT_AUDIO, LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, LADSPA_IS_PORT_OUTPUT, Load(), mAudioIns, mAudioOuts, mData, mInputPorts, mInteractive, mLatencyPort, mNumInputControls, mNumOutputControls, mOutputPorts, _LADSPA_Descriptor::PortCount, _LADSPA_Descriptor::PortDescriptors, _LADSPA_Descriptor::PortNames, and ArrayOf< X >::reinit().

Referenced by LadspaEffectsModule::DiscoverPluginsAtPath().

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

◆ IsDefault()

bool LadspaEffectBase::IsDefault ( ) const
overrideprotectedvirtual

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

Reimplemented from Effect.

Definition at line 147 of file LadspaEffectBase.cpp.

148{
149 return false;
150}

◆ IsInteractive()

bool LadspaEffectBase::IsInteractive ( ) const
overrideprotectedvirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 142 of file LadspaEffectBase.cpp.

143{
144 return mInteractive;
145}

References mInteractive.

◆ Load()

bool LadspaEffectBase::Load ( )
protected

Definition at line 360 of file LadspaEffectBase.cpp.

361{
362 if (mLib.IsLoaded())
363 {
364 return true;
365 }
366
367 wxFileName ff = mPath;
368 wxString envpath;
369 bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
370 wxSetEnv(wxT("PATH"), ff.GetPath() + wxFILE_SEP_PATH + envpath);
371 wxString saveOldCWD = ff.GetCwd();
372 ff.SetCwd();
373
374 LADSPA_Descriptor_Function mainFn = NULL;
375
376 if (mLib.Load(mPath, wxDL_NOW))
377 {
378 wxLogNull logNo;
379
380 mainFn = (LADSPA_Descriptor_Function) mLib.GetSymbol(wxT("ladspa_descriptor"));
381 if (mainFn)
382 {
383 mData = mainFn(mIndex);
384 return true;
385 }
386 }
387
388 if (mLib.IsLoaded())
389 {
390 mLib.Unload();
391 }
392
393 wxSetWorkingDirectory(saveOldCWD);
394 hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));
395
396 return false;
397}
wxDynamicLibrary mLib
const LADSPA_Descriptor *(* LADSPA_Descriptor_Function)(unsigned long Index)
Definition: ladspa.h:593

References mData, mIndex, mLib, mPath, and wxT().

Referenced by InitializePlugin().

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

◆ LoadFactoryPreset()

OptionalMessage LadspaEffectBase::LoadFactoryPreset ( int  id,
EffectSettings settings 
) const
overrideprotectedvirtual

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

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 341 of file LadspaEffectBase.cpp.

342{
343 return { nullptr };
344}

◆ LoadParameters()

OptionalMessage LadspaEffectBase::LoadParameters ( const RegistryPath group,
EffectSettings settings 
) const
protected

Definition at line 407 of file LadspaEffectBase.cpp.

409{
410 wxString parms;
411 if (!GetConfig(*this, PluginSettings::Private, group, wxT("Parameters"),
412 parms, wxEmptyString))
413 {
414 return {};
415 }
416
418 if (!eap.SetParameters(parms))
419 {
420 return {};
421 }
422
423 if (!LoadSettings(eap, settings))
424 return {};
425 return { nullptr };
426}
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.
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)

References PluginSettings::GetConfig(), 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 LadspaEffectBase::LoadSettings ( const CommandParameters parms,
EffectSettings settings 
) const
overrideprotectedvirtual

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 305 of file LadspaEffectBase.cpp.

307{
308 auto &controls = GetSettings(settings).controls;
309 for (unsigned long p = 0; p < mData->PortCount; p++) {
311
312 if (LADSPA_IS_PORT_CONTROL(descriptor) &&
313 LADSPA_IS_PORT_INPUT(descriptor)) {
314 wxString labelText = LAT1CTOWX(mData->PortNames[p]);
315 double d = 0.0;
316 if (!parms.Read(labelText, &d))
317 return false;
318 controls[p] = d;
319 }
320 }
321 return true;
322}

References LadspaEffectSettings::controls, EffectWithSettings< LadspaEffectSettings, PerTrackEffect >::GetSettings(), LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, LAT1CTOWX, mData, _LADSPA_Descriptor::PortCount, _LADSPA_Descriptor::PortDescriptors, _LADSPA_Descriptor::PortNames, and settings().

Referenced by LoadParameters().

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

◆ LoadUserPreset()

OptionalMessage LadspaEffectBase::LoadUserPreset ( const RegistryPath name,
EffectSettings settings 
) const
overrideprotectedvirtual

Change settings to a user-named preset

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 324 of file LadspaEffectBase.cpp.

326{
328}
const TranslatableString name
Definition: Distortion.cpp:76
OptionalMessage LoadParameters(const RegistryPath &group, EffectSettings &settings) const

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

Here is the call graph for this function:

◆ MakeInstance()

std::shared_ptr< EffectInstance > LadspaEffectBase::MakeInstance ( ) const
overrideprotectedvirtual

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 285 of file LadspaEffectBase.cpp.

286{
287 return std::make_shared<LadspaInstance>(*this, mData,
290}

References mAudioIns, mAudioOuts, mData, mInputPorts, mLatencyPort, and mOutputPorts.

◆ MakeOutputs()

auto LadspaEffectBase::MakeOutputs ( ) const
overrideprotectedvirtual

Produce an object to hold values to send to effect output meters.

Default implementation returns nullptr

Reimplemented from EffectSettingsManager.

Definition at line 69 of file LadspaEffectBase.cpp.

70{
71 auto result = std::make_unique<LadspaEffectOutputs>();
72 result->controls.resize(mData->PortCount);
73 return result;
74}

References mData, and _LADSPA_Descriptor::PortCount.

◆ MakeSettings()

EffectSettings LadspaEffectBase::MakeSettings ( ) const
overrideprotectedvirtual

Produce an object holding new, independent settings

Default implementation returns an empty any

Reimplemented from EffectSettingsManager.

Definition at line 28 of file LadspaEffectBase.cpp.

29{
30 auto result = EffectSettings::Make<LadspaEffectSettings>( mData->PortCount );
32 return result;
33}
bool InitializeControls(LadspaEffectSettings &settings) const

◆ RealtimeSupport()

auto LadspaEffectBase::RealtimeSupport ( ) const
overrideprotectedvirtual

Since which version of Audacity has the effect supported realtime?

Reimplemented from Effect.

Definition at line 152 of file LadspaEffectBase.cpp.

References EffectDefinitionInterface::After_3_1, EffectTypeProcess, GetType(), and EffectDefinitionInterface::Never.

Here is the call graph for this function:

◆ SaveParameters()

bool LadspaEffectBase::SaveParameters ( const RegistryPath group,
const EffectSettings settings 
) const
protected

Definition at line 428 of file LadspaEffectBase.cpp.

430{
432 if (!SaveSettings(settings, eap))
433 {
434 return false;
435 }
436
437 wxString parms;
438 if (!eap.GetParameters(parms))
439 {
440 return false;
441 }
442
444 group, wxT("Parameters"), parms);
445}
bool GetParameters(wxString &parms)
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)

References CommandParameters::GetParameters(), PluginSettings::Private, SaveSettings(), PluginSettings::SetConfig(), settings(), and wxT().

Referenced by SaveUserPreset().

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

◆ SaveSettings()

bool LadspaEffectBase::SaveSettings ( const EffectSettings settings,
CommandParameters parms 
) const
overrideprotectedvirtual

Store settings as keys and values.

The override may assume parms is initially empty

Returns
true on success

Reimplemented from Effect.

Definition at line 292 of file LadspaEffectBase.cpp.

294{
295 const auto &controls = GetSettings(settings).controls;
296 for (unsigned long p = 0; p < mData->PortCount; p++) {
299 if (!parms.Write(LAT1CTOWX(mData->PortNames[p]), controls[p]))
300 return false;
301 }
302 return true;
303}

References LadspaEffectSettings::controls, EffectWithSettings< LadspaEffectSettings, PerTrackEffect >::GetSettings(), LADSPA_IS_PORT_CONTROL, LADSPA_IS_PORT_INPUT, LAT1CTOWX, mData, _LADSPA_Descriptor::PortCount, _LADSPA_Descriptor::PortDescriptors, _LADSPA_Descriptor::PortNames, and settings().

Referenced by SaveParameters().

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

◆ SaveUserPreset()

bool LadspaEffectBase::SaveUserPreset ( const RegistryPath name,
const EffectSettings settings 
) const
overrideprotectedvirtual

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

Reimplemented from Effect.

Definition at line 330 of file LadspaEffectBase.cpp.

332{
334}
bool SaveParameters(const RegistryPath &group, const EffectSettings &settings) const

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

Here is the call graph for this function:

◆ SupportsAutomation()

bool LadspaEffectBase::SupportsAutomation ( ) const
overrideprotectedvirtual

Whether the effect has any automatable controls.

Reimplemented from Effect.

Definition at line 159 of file LadspaEffectBase.cpp.

160{
161 return mNumInputControls > 0;
162}

References mNumInputControls.

◆ Unload()

void LadspaEffectBase::Unload ( )
protected

Definition at line 399 of file LadspaEffectBase.cpp.

400{
401 if (mLib.IsLoaded())
402 {
403 mLib.Unload();
404 }
405}

References mLib.

Member Data Documentation

◆ mAudioIns

unsigned LadspaEffectBase::mAudioIns { 0 }
protected

Definition at line 95 of file LadspaEffectBase.h.

Referenced by GetType(), InitializePlugin(), and MakeInstance().

◆ mAudioOuts

unsigned LadspaEffectBase::mAudioOuts { 0 }
protected

Definition at line 99 of file LadspaEffectBase.h.

Referenced by GetType(), InitializePlugin(), and MakeInstance().

◆ mBlockSize

size_t LadspaEffectBase::mBlockSize { 0 }
protected

Definition at line 91 of file LadspaEffectBase.h.

◆ mData

const LADSPA_Descriptor* LadspaEffectBase::mData {}
protected

◆ mIndex

const int LadspaEffectBase::mIndex
protected

Definition at line 84 of file LadspaEffectBase.h.

Referenced by GetPath(), and Load().

◆ mInputPorts

ArrayOf<unsigned long> LadspaEffectBase::mInputPorts
protected

Definition at line 97 of file LadspaEffectBase.h.

Referenced by InitializePlugin(), and MakeInstance().

◆ mInteractive

bool LadspaEffectBase::mInteractive { false }
protected

Definition at line 93 of file LadspaEffectBase.h.

Referenced by InitializePlugin(), and IsInteractive().

◆ mLatencyPort

int LadspaEffectBase::mLatencyPort { -1 }
protected

Definition at line 106 of file LadspaEffectBase.h.

Referenced by InitializePlugin(), and MakeInstance().

◆ mLib

wxDynamicLibrary LadspaEffectBase::mLib
protected

Definition at line 86 of file LadspaEffectBase.h.

Referenced by Load(), and Unload().

◆ mNumInputControls

unsigned LadspaEffectBase::mNumInputControls { 0 }
protected

◆ mNumOutputControls

unsigned LadspaEffectBase::mNumOutputControls { 0 }
protected

Definition at line 104 of file LadspaEffectBase.h.

Referenced by InitializePlugin(), and LadspaEffect::MakeEditor().

◆ mOutputPorts

ArrayOf<unsigned long> LadspaEffectBase::mOutputPorts
protected

Definition at line 101 of file LadspaEffectBase.h.

Referenced by InitializePlugin(), and MakeInstance().

◆ mPath

const wxString LadspaEffectBase::mPath
protected

Definition at line 83 of file LadspaEffectBase.h.

Referenced by GetPath(), and Load().

◆ pluginName

wxString LadspaEffectBase::pluginName
protected

Definition at line 89 of file LadspaEffectBase.h.


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