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

#include <LV2EffectBase.h>

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

Public Member Functions

 LV2EffectBase (const LilvPlugin &plug)
 
 ~LV2EffectBase () 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 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
 
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...
 
OptionalMessage LoadParameters (const RegistryPath &group, EffectSettings &settings) const
 
bool SaveParameters (const RegistryPath &group, const EffectSettings &settings) const
 
- 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
 

Public Attributes

const LilvPlugin & mPlug
 
const LV2FeaturesList mFeatures { mPlug }
 
const LV2Ports mPorts { mPlug }
 
bool mWantsOptionsInterface { false }
 
bool mWantsStateInterface { false }
 
size_t mFramePos {}
 
FloatBuffers mCVInBuffers
 
FloatBuffers mCVOutBuffers
 
double mLength {}
 
bool mFactoryPresetsLoaded { false }
 
RegistryPaths mFactoryPresetNames
 
wxArrayString mFactoryPresetUris
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 

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 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...
 
- 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 29 of file LV2EffectBase.h.

Constructor & Destructor Documentation

◆ LV2EffectBase()

LV2EffectBase::LV2EffectBase ( const LilvPlugin &  plug)

Definition at line 28 of file LV2EffectBase.cpp.

28 : mPlug{ plug }
29{
30}
const LilvPlugin & mPlug
Definition: LV2EffectBase.h:87

◆ ~LV2EffectBase()

LV2EffectBase::~LV2EffectBase ( )
overridedefault

Member Function Documentation

◆ CanExportPresets()

bool LV2EffectBase::CanExportPresets ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 332 of file LV2EffectBase.cpp.

333{
334 return false;
335}

◆ CopySettingsContents()

bool LV2EffectBase::CopySettingsContents ( const EffectSettings src,
EffectSettings dst 
) const
overridevirtual

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 164 of file LV2EffectBase.cpp.

166{
167 auto &srcControls = GetSettings(src).values;
168 auto &dstControls = GetSettings(dst).values;
169
170 const auto &controlPorts = mPorts.mControlPorts;
171 const auto portsCount = controlPorts.size();
172 // Do not use the copy constructor of std::vector. Do an in-place rewrite
173 // of the destination vector, which will not allocate memory if dstControls
174 // began with sufficient capacity.
175 // And that will be true if dstControls originated with MakeSettings() or a
176 // copy of it, because the set of control ports does not vary after
177 // initialization of the plug-in.
178 assert(srcControls.size() == portsCount);
179 assert(dstControls.size() == portsCount);
180 // But let's be sure
181 const auto portValuesCount =
182 std::min(srcControls.size(), dstControls.size());
183
184 if (portValuesCount != portsCount)
185 return false;
186
187 size_t portIndex {};
188
189 for (auto& port : controlPorts)
190 {
191 if (port->mIsInput)
192 dstControls[portIndex] = srcControls[portIndex];
193
194 ++portIndex;
195 }
196
197 // Ignore mpState
198
199 return true;
200}
int min(int a, int b)
const LV2Ports mPorts
Definition: LV2EffectBase.h:90
LV2ControlPortArray mControlPorts
Definition: LV2Ports.h:283
DynamicRangeProcessorSettings GetSettings(EffectSettingsAccess &access)

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), LV2Ports::mControlPorts, min(), and mPorts.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString LV2EffectBase::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 65 of file LV2EffectBase.cpp.

66{
67 return XO("n/a");
68}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetFactoryPresets()

RegistryPaths LV2EffectBase::GetFactoryPresets ( ) const
overridevirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 276 of file LV2EffectBase.cpp.

277{
278 using namespace LV2Symbols;
280 return mFactoryPresetNames;
281
282 if (LilvNodesPtr presets{ lilv_plugin_get_related(&mPlug, node_Preset) }) {
283 LILV_FOREACH(nodes, i, presets.get()) {
284 const auto preset = lilv_nodes_get(presets.get(), i);
285
287
288 lilv_world_load_resource(gWorld, preset);
289
290 if (LilvNodesPtr labels{ lilv_world_find_nodes(gWorld, preset,
291 node_Label, nullptr) }) {
292 const auto label = lilv_nodes_get_first(labels.get());
294 }
295 else
296 mFactoryPresetNames.push_back(
297 LilvString(preset).AfterLast(wxT('#')));
298 }
299 }
300
302
303 return mFactoryPresetNames;
304}
wxT("CloseDown"))
Lilv_ptr< LilvNodes, lilv_nodes_free > LilvNodesPtr
wxString LilvString(const LilvNode *node)
Definition: LV2Utils.h:37
EffectReverbSettings preset
Definition: Reverb.cpp:44
TranslatableString label
Definition: TagsEditor.cpp:165
bool mFactoryPresetsLoaded
RegistryPaths mFactoryPresetNames
wxArrayString mFactoryPresetUris
LilvWorld * gWorld
Definition: LV2Symbols.cpp:31

References LV2Symbols::gWorld, label, LilvString(), mFactoryPresetNames, mFactoryPresetsLoaded, mFactoryPresetUris, mPlug, preset, and wxT().

Here is the call graph for this function:

◆ GetFamily()

EffectFamilySymbol LV2EffectBase::GetFamily ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 94 of file LV2EffectBase.cpp.

95{
96 return LV2EFFECTS_FAMILY;
97}
#define LV2EFFECTS_FAMILY
Definition: LV2Effect.h:31

References LV2EFFECTS_FAMILY.

◆ GetPath()

PluginPath LV2EffectBase::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 38 of file LV2EffectBase.cpp.

39{
40 return LilvString(lilv_plugin_get_uri(&mPlug));
41}

References LilvString(), and mPlug.

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol LV2EffectBase::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 43 of file LV2EffectBase.cpp.

44{
46}
static ComponentInterfaceSymbol GetPluginSymbol(const LilvPlugin &plug)

References LV2FeaturesList::GetPluginSymbol(), and mPlug.

Here is the call graph for this function:

◆ GetType()

EffectType LV2EffectBase::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 74 of file LV2EffectBase.cpp.

75{
76 if (mPorts.mAudioIn == 0 && mPorts.mAudioOut == 0)
77 {
78 return EffectTypeTool;
79 }
80
81 if (mPorts.mAudioIn == 0)
82 {
83 return EffectTypeGenerate;
84 }
85
86 if (mPorts.mAudioOut == 0)
87 {
88 return EffectTypeAnalyze;
89 }
90
91 return EffectTypeProcess;
92}
@ EffectTypeAnalyze
@ EffectTypeGenerate
@ EffectTypeTool
@ EffectTypeProcess
unsigned mAudioOut
Definition: LV2Ports.h:273
unsigned mAudioIn
Definition: LV2Ports.h:272

References EffectTypeAnalyze, EffectTypeGenerate, EffectTypeProcess, EffectTypeTool, LV2Ports::mAudioIn, LV2Ports::mAudioOut, and mPorts.

Referenced by LV2Effect::PopulateUI(), RealtimeSupport(), and LV2Effect::ShowClientInterface().

Here is the caller graph for this function:

◆ GetVendor()

VendorSymbol LV2EffectBase::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 48 of file LV2EffectBase.cpp.

49{
50 wxString vendor = LilvStringMove(lilv_plugin_get_author_name(&mPlug));
51
52 if (vendor.empty())
53 {
54 return XO("n/a");
55 }
56
57 return {vendor};
58}
wxString LilvStringMove(LilvNode *node)
Definition: LV2Utils.h:45

References LilvStringMove(), mPlug, and XO().

Referenced by LV2Effect::PopulateUI().

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

◆ GetVersion()

wxString LV2EffectBase::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 60 of file LV2EffectBase.cpp.

61{
62 return wxT("1.0");
63}

References wxT().

Here is the call graph for this function:

◆ HasOptions()

bool LV2EffectBase::HasOptions ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 337 of file LV2EffectBase.cpp.

338{
339 return true;
340}

◆ InitializePlugin()

bool LV2EffectBase::InitializePlugin ( )

Definition at line 122 of file LV2EffectBase.cpp.

123{
124 if (!mFeatures.mOk)
125 return false;
126
127 // Do a check only on temporary feature list objects
128 auto instanceFeatures = LV2InstanceFeaturesList{ mFeatures };
129 if (!instanceFeatures.mOk)
130 return false;
132 return false;
133
134 // Determine available extensions
136 mWantsStateInterface = false;
137 if (LilvNodesPtr extdata{ lilv_plugin_get_extension_data(&mPlug) }) {
138 LILV_FOREACH(nodes, i, extdata.get()) {
139 const auto node = lilv_nodes_get(extdata.get(), i);
140 const auto uri = lilv_node_as_string(node);
141 if (strcmp(uri, LV2_OPTIONS__interface) == 0)
143 else if (strcmp(uri, LV2_STATE__interface) == 0)
145 }
146 }
147
148 return true;
149}
static result_type Call(Arguments &&...arguments)
Null check of the installed function is done for you.
bool mWantsStateInterface
Definition: LV2EffectBase.h:93
const LV2FeaturesList mFeatures
Definition: LV2EffectBase.h:88
bool mWantsOptionsInterface
Definition: LV2EffectBase.h:92

References GlobalHook< ValidatePlugin, std::remove_pointer_t< decltype(DefaultFunction)>, DefaultFunction, Options... >::Call(), mFeatures, LV2FeaturesList::mOk, mPlug, mWantsOptionsInterface, and mWantsStateInterface.

Referenced by LV2EffectsModule::DiscoverPluginsAtPath().

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

◆ IsDefault()

bool LV2EffectBase::IsDefault ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 104 of file LV2EffectBase.cpp.

105{
106 return false;
107}

◆ IsInteractive()

bool LV2EffectBase::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 99 of file LV2EffectBase.cpp.

100{
101 return mPorts.mControlPorts.size() != 0;
102}

References LV2Ports::mControlPorts, and mPorts.

◆ LoadFactoryPreset()

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

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

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 307 of file LV2EffectBase.cpp.

308{
309 using namespace LV2Symbols;
310 if (id < 0 || id >= (int) mFactoryPresetUris.size())
311 return {};
312
313 LilvNodePtr preset{ lilv_new_uri(gWorld, mFactoryPresetUris[id].ToUTF8()) };
314 if (!preset)
315 return {};
316
317 using LilvStatePtr = Lilv_ptr<LilvState, lilv_state_free>;
318 LilvStatePtr state{
319 lilv_state_new_from_world(gWorld,
321 };
322 if (!state)
323 return {};
324
325 auto &mySettings = GetSettings(settings);
326 mPorts.EmitPortValues(*state, mySettings);
327 // Save the state, for whatever might not be contained in port values
328 mySettings.mpState = move(state);
329 return { nullptr };
330}
std::unique_ptr< Type, Lilv_deleter< Type, f > > Lilv_ptr
Generate classes of smart pointers to lv2 resources.
Definition: LV2Utils.h:26
Lilv_ptr< LilvNode, lilv_node_free > LilvNodePtr
Definition: LV2Utils.h:33
static Settings & settings()
Definition: TrackInfo.cpp:47
LV2_URID_Map * URIDMapFeature() const
void EmitPortValues(const LilvState &state, LV2EffectSettings &settings) const
Definition: LV2Ports.cpp:411
std::string ToUTF8(const std::wstring &wstr)

References LV2Ports::EmitPortValues(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), LV2Symbols::gWorld, mFactoryPresetUris, mFeatures, mPorts, preset, settings(), audacity::ToUTF8(), and LV2FeaturesList::URIDMapFeature().

Here is the call graph for this function:

◆ LoadParameters()

OptionalMessage LV2EffectBase::LoadParameters ( const RegistryPath group,
EffectSettings settings 
) const

Definition at line 346 of file LV2EffectBase.cpp.

348{
349 wxString parms;
350 if (!GetConfig(*this,
351 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
352 return {};
354 if (!eap.SetParameters(parms))
355 return {};
356 if (!LoadSettings(eap, settings))
357 return {};
358 return { nullptr };
359}
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 LV2EffectBase::LoadSettings ( const CommandParameters parms,
EffectSettings settings 
) const
overridevirtual

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 233 of file LV2EffectBase.cpp.

235{
236 // First pass validates values
237 for (auto & port : mPorts.mControlPorts) {
238 if (port->mIsInput) {
239 double d = 0.0;
240 if (!parms.Read(port->mName, &d))
241 return false;
242 // Use unscaled range here
243 if (d < port->mMin || d > port->mMax)
244 return false;
245 }
246 }
247
248 // Second pass actually sets the values
249 auto &values = GetSettings(settings).values;
250 size_t index = 0;
251 for (auto & port : mPorts.mControlPorts) {
252 if (port->mIsInput) {
253 double d = 0.0;
254 if (!parms.Read(port->mName, &d))
255 return false;
256 values[index] = d;
257 }
258 ++index;
259 }
260
261 return true;
262}
const wxChar * values

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), LV2Ports::mControlPorts, mPorts, settings(), and values.

Referenced by LoadParameters().

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

◆ LoadUserPreset()

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

Change settings to a user-named preset

Returns
nullopt for failure

Reimplemented from Effect.

Definition at line 264 of file LV2EffectBase.cpp.

266{
268}
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 > LV2EffectBase::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 211 of file LV2EffectBase.cpp.

212{
213 auto result = std::make_shared<LV2Instance>(*this, mFeatures, mPorts);
214 if (result->IsOk())
215 return result;
216 return nullptr;
217}

References mFeatures, and mPorts.

◆ MakeOutputs()

auto LV2EffectBase::MakeOutputs ( ) const
overridevirtual

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

Default implementation returns nullptr

Reimplemented from EffectSettingsManager.

Definition at line 202 of file LV2EffectBase.cpp.

203{
204 auto result = std::make_unique<LV2EffectOutputs>();
205 auto &values = result->values;
206 // This may waste a bit of space on input ports, but not likely much
207 values.resize(mPorts.mControlPorts.size());
208 return result;
209}

References LV2Ports::mControlPorts, mPorts, and values.

◆ MakeSettings()

EffectSettings LV2EffectBase::MakeSettings ( ) const
overridevirtual

Produce an object holding new, independent settings

Default implementation returns an empty any

Reimplemented from EffectSettingsManager.

Definition at line 151 of file LV2EffectBase.cpp.

152{
153 auto result = EffectSettings::Make<LV2EffectSettings>();
154 auto &settings = GetSettings(result);
155 // This may waste a bit of space on output ports, but not likely much
156 settings.values.reserve(mPorts.mControlPorts.size());
157 for (auto &controlPort : mPorts.mControlPorts) {
158 auto &value = settings.values.emplace_back();
159 value = controlPort->mDef;
160 }
161 return result;
162}

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), LV2Ports::mControlPorts, mPorts, and settings().

Here is the call graph for this function:

◆ RealtimeSupport()

auto LV2EffectBase::RealtimeSupport ( ) const
overridevirtual

Since which version of Audacity has the effect supported realtime?

Reimplemented from Effect.

Definition at line 109 of file LV2EffectBase.cpp.

110{
111 // TODO reenable after achieving statelessness
112 return GetType() == EffectTypeProcess
115}
EffectType GetType() const override
Type determines how it behaves.

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

Here is the call graph for this function:

◆ SaveParameters()

bool LV2EffectBase::SaveParameters ( const RegistryPath group,
const EffectSettings settings 
) const

Definition at line 361 of file LV2EffectBase.cpp.

363{
364 // PRL: This function just dumps the several control port values to the
365 // config files. Should it be reimplemented with
366 // lilv_state_new_from_instance to capture -- I don't know what -- other
367 // important state?
368
370 if (!SaveSettings(settings, eap))
371 return false;
372
373 wxString parms;
374 if (!eap.GetParameters(parms))
375 return false;
376
377 return SetConfig(*this,
378 PluginSettings::Private, group, wxT("Parameters"), parms);
379}
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 LV2EffectBase::SaveSettings ( const EffectSettings settings,
CommandParameters parms 
) const
overridevirtual

Store settings as keys and values.

The override may assume parms is initially empty

Returns
true on success

Reimplemented from Effect.

Definition at line 219 of file LV2EffectBase.cpp.

221{
222 auto &values = GetSettings(settings).values;
223 size_t index = 0;
224 for (auto & port : mPorts.mControlPorts) {
225 if (port->mIsInput)
226 if (!parms.Write(port->mName, values[index]))
227 return false;
228 ++index;
229 }
230 return true;
231}

References anonymous_namespace{DynamicRangeProcessorEditor.cpp}::GetSettings(), LV2Ports::mControlPorts, mPorts, settings(), and values.

Referenced by SaveParameters().

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

◆ SaveUserPreset()

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

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

Reimplemented from Effect.

Definition at line 270 of file LV2EffectBase.cpp.

272{
274}
bool SaveParameters(const RegistryPath &group, const EffectSettings &settings) const

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

Here is the call graph for this function:

◆ SupportsAutomation()

bool LV2EffectBase::SupportsAutomation ( ) const
overridevirtual

Whether the effect has any automatable controls.

Reimplemented from Effect.

Definition at line 117 of file LV2EffectBase.cpp.

118{
119 return true;
120}

Member Data Documentation

◆ mCVInBuffers

FloatBuffers LV2EffectBase::mCVInBuffers

Definition at line 97 of file LV2EffectBase.h.

◆ mCVOutBuffers

FloatBuffers LV2EffectBase::mCVOutBuffers

Definition at line 98 of file LV2EffectBase.h.

◆ mFactoryPresetNames

RegistryPaths LV2EffectBase::mFactoryPresetNames
mutable

Definition at line 104 of file LV2EffectBase.h.

Referenced by GetFactoryPresets().

◆ mFactoryPresetsLoaded

bool LV2EffectBase::mFactoryPresetsLoaded { false }
mutable

Definition at line 103 of file LV2EffectBase.h.

Referenced by GetFactoryPresets().

◆ mFactoryPresetUris

wxArrayString LV2EffectBase::mFactoryPresetUris
mutable

Definition at line 105 of file LV2EffectBase.h.

Referenced by GetFactoryPresets(), and LoadFactoryPreset().

◆ mFeatures

const LV2FeaturesList LV2EffectBase::mFeatures { mPlug }

◆ mFramePos

size_t LV2EffectBase::mFramePos {}

Definition at line 95 of file LV2EffectBase.h.

◆ mLength

double LV2EffectBase::mLength {}

Definition at line 100 of file LV2EffectBase.h.

◆ mPlug

const LilvPlugin& LV2EffectBase::mPlug

◆ mPorts

const LV2Ports LV2EffectBase::mPorts { mPlug }

◆ mWantsOptionsInterface

bool LV2EffectBase::mWantsOptionsInterface { false }

Definition at line 92 of file LV2EffectBase.h.

Referenced by InitializePlugin().

◆ mWantsStateInterface

bool LV2EffectBase::mWantsStateInterface { false }

Definition at line 93 of file LV2EffectBase.h.

Referenced by InitializePlugin().


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