Audacity 3.2.0
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
LV2Effect Class Referencefinal

#include <LV2Effect.h>

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

Public Member Functions

 LV2Effect (const LilvPlugin *plug)
 
virtual ~LV2Effect ()
 
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...
 
bool SupportsRealtime () const override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
bool DoLoadUserPreset (const RegistryPath &name, EffectSettings &settings)
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool DoLoadFactoryPreset (int id)
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
int GetMidiInCount () const override
 Function that has not yet found a use. More...
 
int GetMidiOutCount () const override
 Function that has not yet found a use. More...
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
sampleCount GetLatency () override
 
bool ProcessInitialize (EffectSettings &settings, sampleCount totalLen, ChannelNames chanMap) override
 
bool ProcessFinalize () override
 
size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
 Called for destructive effect computation. More...
 
bool RealtimeInitialize (EffectSettings &settings) override
 
bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize (EffectSettings &settings) noexcept override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart (EffectSettings &settings) override
 
size_t RealtimeProcess (int group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd (EffectSettings &settings) noexcept override
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal) override
 
bool InitializePlugin ()
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
std::shared_ptr< EffectInstanceDoMakeInstance ()
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
- Public Member Functions inherited from StatefulPerTrackEffect
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
virtual sampleCount GetLatency ()
 
virtual bool ProcessInitialize (EffectSettings &settings, sampleCount totalLen, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize ()
 
virtual size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)
 Called for destructive effect computation. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual void SetSampleRate (double rate)
 
virtual bool RealtimeInitialize (EffectSettings &settings)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume () noexcept
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 
virtual size_t RealtimeProcess (int group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual bool Init ()
 Call once to set up state for whole list of tracks to be processed. More...
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 Actually do the effect here. More...
 
virtual void SetSampleRate (double rate)
 
virtual bool RealtimeInitialize (EffectSettings &settings)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume () noexcept
 
virtual bool RealtimeProcessStart (EffectSettings &settings)
 
virtual size_t RealtimeProcess (int group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () 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
 
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...
 
bool SupportsRealtime () const override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id, EffectSettings &settings) const override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults (EffectSettings &settings) const override
 Change settings back to "factory default". More...
 
unsigned GetAudioInCount () const override
 How many input buffers to allocate at once. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
virtual const EffectParameterMethodsParameters () const
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI (EffectSettings &) override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets (const EffectSettings &settings) const override
 
void ImportPresets (EffectSettings &settings) override
 
bool HasOptions () override
 
void ShowOptions () override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, EffectInstance &instance, EffectSettingsAccess &access, bool forceModal=false) override
 Usually applies factory to self and given access. More...
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
bool TransferDataToWindow (const EffectSettings &settings) override
 Update controls for the settings. More...
 
bool TransferDataFromWindow (EffectSettings &settings) override
 Update the given settings from controls. More...
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings)
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={}) const
 
bool EnableApply (bool enable=true)
 
wxWindow * GetUIParent ()
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
virtual int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false)=0
 
virtual bool IsGraphicalUI ()=0
 
virtual std::unique_ptr< EffectUIValidatorPopulateUI (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)=0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual bool CanExportPresets ()=0
 
virtual void ExportPresets (const EffectSettings &settings) const =0
 
virtual void ImportPresets (EffectSettings &settings)=0
 
virtual bool HasOptions ()=0
 
virtual void ShowOptions ()=0
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, EffectInstance &instance, EffectSettingsAccess &access, bool forceModal=false)=0
 Usually applies factory to self and given access. More...
 
virtual void Preview (EffectSettingsAccess &access, bool dryOnly)=0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual bool LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={}, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 Unfortunately complicated dual-use function. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)=0
 Update controls for the settings. More...
 
virtual bool TransferDataFromWindow (EffectSettings &settings)=0
 Update the given settings from controls. More...
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
virtual unsigned GetAudioInCount () const =0
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const =0
 How many output buffers to allocate at once. More...
 
virtual int GetMidiInCount () const
 Function that has not yet found a use. More...
 
virtual int GetMidiOutCount () const
 Function that has not yet found a use. 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 EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual bool SupportsRealtime () const =0
 Whether the effect supports realtime previewing (while audio is playing). More...
 
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

bool LoadParameters (const RegistryPath &group, EffectSettings &settings)
 
bool SaveParameters (const RegistryPath &group, const EffectSettings &settings) const
 
LV2WrapperInitInstance (float sampleRate)
 
void FreeInstance (LV2Wrapper *wrapper)
 
LV2_URID URID_Map (const char *uri)
 
const char * URID_Unmap (LV2_URID urid)
 
int UIResize (int width, int height)
 
void UIClosed ()
 
int LogVPrintf (LV2_URID type, const char *fmt, va_list ap)
 
void SizeRequest (GtkWidget *widget, GtkRequisition *requisition)
 
size_t AddOption (LV2_URID, uint32_t size, LV2_URID, const void *value)
 
bool ValidateOptions (const LilvNode *subject)
 
bool CheckOptions (const LilvNode *subject, const LilvNode *predicate, bool required)
 
LV2_Feature * AddFeature (const char *uri, void *data)
 
bool ValidateFeatures (const LilvNode *subject)
 
bool CheckFeatures (const LilvNode *subject, const LilvNode *predicate, bool required)
 
bool BuildFancy ()
 
bool BuildPlain (EffectSettingsAccess &access)
 
bool TransferDataToWindow ()
 
void SetSlider (const LV2ControlPortPtr &port)
 
void OnTrigger (wxCommandEvent &evt)
 
void OnToggle (wxCommandEvent &evt)
 
void OnChoice (wxCommandEvent &evt)
 
void OnText (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnTimer (wxTimerEvent &evt)
 
void OnIdle (wxIdleEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void OnSizeWindow (wxCommandEvent &evt)
 
void SuilPortWrite (uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)
 
uint32_t SuilPortIndex (const char *port_symbol)
 
const void * GetPortValue (const char *port_symbol, uint32_t *size, uint32_t *type)
 
void SetPortValue (const char *port_symbol, const void *value, uint32_t size, uint32_t type)
 

Static Private Member Functions

static uint32_t uri_to_id (LV2_URI_Map_Callback_Data callback_data, const char *map, const char *uri)
 
static LV2_URID urid_map (LV2_URID_Map_Handle handle, const char *uri)
 
static const char * urid_unmap (LV2_URID_Unmap_Handle handle, LV2_URID urid)
 
static int ui_resize (LV2UI_Feature_Handle handle, int width, int height)
 
static void ui_closed (LV2UI_Controller controller)
 
static int log_printf (LV2_Log_Handle handle, LV2_URID type, const char *fmt,...)
 
static int log_vprintf (LV2_Log_Handle handle, LV2_URID type, const char *fmt, va_list ap)
 
static void size_request (GtkWidget *widget, GtkRequisition *requisition, LV2Effect *win)
 
static void suil_port_write_func (SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)
 
static uint32_t suil_port_index_func (SuilController controller, const char *port_symbol)
 
static const void * get_value_func (const char *port_symbol, void *user_data, uint32_t *size, uint32_t *type)
 
static void set_value_func (const char *port_symbol, void *user_data, const void *value, uint32_t size, uint32_t type)
 

Private Attributes

LV2Symbols::URIDMap mURIDMap
 
const LilvPlugin * mPlug
 
float mSampleRate
 
int mBlockSize
 
int mSeqSize
 
int mMinBlockSize
 
int mMaxBlockSize
 
int mUserBlockSize
 
std::unordered_map< uint32_t, LV2ControlPortPtrmControlPortMap
 
LV2ControlPortArray mControlPorts
 
LV2AudioPortArray mAudioPorts
 
unsigned mAudioIn
 
unsigned mAudioOut
 
LV2AtomPortArray mAtomPorts
 
LV2AtomPortPtr mControlIn
 
LV2AtomPortPtr mControlOut
 
unsigned mMidiIn
 
unsigned mMidiOut
 
LV2CVPortArray mCVPorts
 
unsigned mCVIn
 
unsigned mCVOut
 
std::unordered_map< TranslatableString, std::vector< int > > mGroupMap
 
TranslatableStrings mGroups
 
bool mWantsOptionsInterface
 
bool mWantsStateInterface
 
bool mWantsWorkerInterface
 
bool mNoResize
 
bool mUseLatency
 
int mLatencyPort
 
bool mLatencyDone
 
bool mRolling
 
bool mActivated
 
LV2WrappermMaster
 
LV2WrappermProcess
 
std::vector< LV2Wrapper * > mSlaves
 
FloatBuffers mMasterIn
 
size_t mNumSamples
 
size_t mFramePos
 
FloatBuffers mCVInBuffers
 
FloatBuffers mCVOutBuffers
 
float mPositionSpeed
 
float mPositionFrame
 
double mLength
 
wxTimer mTimer
 
wxWeakRef< wxDialog > mDialog
 
wxWindow * mParent
 
bool mUseGUI
 
LV2_URI_Map_Feature mUriMapFeature
 
LV2_URID_Map mURIDMapFeature
 
LV2_URID_Unmap mURIDUnmapFeature
 
LV2UI_Resize mUIResizeFeature
 
LV2_Log_Log mLogFeature
 
LV2_Extension_Data_Feature mExtensionDataFeature
 
LV2_External_UI_Host mExternalUIHost
 
LV2_External_UI_WidgetmExternalWidget
 
bool mExternalUIClosed
 
LV2_Atom_Forge mForge
 
std::vector< LV2_Options_Option > mOptions
 
size_t mBlockSizeOption
 
size_t mSampleRateOption
 
bool mSupportsNominalBlockLength
 
bool mSupportsSampleRate
 
std::vector< std::unique_ptr< LV2_Feature > > mFeatures
 
LV2_Feature * mInstanceAccessFeature
 
LV2_Feature * mParentFeature
 
LV2_Feature * mWorkerScheduleFeature
 
bool mFreewheeling
 
SuilHost * mSuilHost
 
SuilInstance * mSuilInstance
 
NativeWindowmNativeWin
 
wxSize mNativeWinInitialSize
 
wxSize mNativeWinLastSize
 
bool mResizing
 
bool mResized
 
LV2UI_Idle_Interface * mUIIdleInterface
 
LV2UI_Show_Interface * mUIShowInterface
 
NumericTextCtrlmDuration
 
bool mFactoryPresetsLoaded { false }
 
RegistryPaths mFactoryPresetNames
 
wxArrayString mFactoryPresetUris
 

Friends

class LV2Wrapper
 
class LV2EffectSettingsDialog
 
class LV2EffectsModule
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
- Protected Member Functions inherited from Effect
bool EnablePreview (bool enable=true)
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
virtual std::unique_ptr< EffectUIValidatorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access)
 Add controls to effect panel; always succeeds. More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
- Protected Member Functions inherited from EffectBase
void Preview (EffectSettingsAccess &access, bool dryOnly) override
 
bool DoEffect (EffectSettings &settings, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent, const EffectDialogFactory &dialogFactory, const EffectSettingsAccessPtr &pAccess) override
 Unfortunately complicated dual-use function. More...
 
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
virtual bool ValidateUI (EffectSettings &settings)=0
 
virtual bool CloseUI ()=0
 
- Protected Attributes inherited from StatefulEffectBase
double mSampleRate {}
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from Effect
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWindow * mUIParent {}
 
- Protected Attributes inherited from EffectBase
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0 {}
 
double mT1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 
- Protected Attributes inherited from EffectUIClientInterface
friend EffectUIValidator
 
friend DefaultEffectUIValidator
 
- Static Protected Attributes inherited from EffectBase
static int nEffectsDone = 0
 

Detailed Description

Definition at line 251 of file LV2Effect.h.

Constructor & Destructor Documentation

◆ LV2Effect()

LV2Effect::LV2Effect ( const LilvPlugin *  plug)

Definition at line 350 of file LV2Effect.cpp.

351{
352 mPlug = plug;
353
354 mMaster = NULL;
355 mProcess = NULL;
356 mSuilInstance = NULL;
357
358 mSampleRate = 44100;
361
362 mMinBlockSize = 1;
365
366 mLatencyPort = -1;
367 mLatencyDone = false;
368 mRolling = false;
369 mActivated = false;
370
371 mUIIdleInterface = NULL;
372 mUIShowInterface = NULL;
373
374 mAudioIn = 0;
375 mAudioOut = 0;
376 mMidiIn = 0;
377 mMidiOut = 0;
378
379 mControlIn.reset();
380 mControlOut.reset();
381
382 mPositionSpeed = 1.0;
383 mPositionFrame = 0.0;
384
385 mNativeWin = NULL;
386 mNativeWinInitialSize = wxDefaultSize;
387 mNativeWinLastSize = wxDefaultSize;
388 mResizing = false;
389#if defined(__WXGTK__)
390 mResized = false;
391#endif
392
394 mExternalWidget = NULL;
395 mExternalUIClosed = false;
396
397 mNoResize = false;
398
400 mSupportsSampleRate = false;
401}
#define DEFAULT_BLOCKSIZE
Definition: LV2Effect.cpp:70
#define DEFAULT_SEQSIZE
Definition: LV2Effect.cpp:73
wxSize mNativeWinInitialSize
Definition: LV2Effect.h:536
int mMinBlockSize
Definition: LV2Effect.h:445
LV2AtomPortPtr mControlOut
Definition: LV2Effect.h:458
SuilInstance * mSuilInstance
Definition: LV2Effect.h:533
bool mExternalUIClosed
Definition: LV2Effect.h:514
bool mResized
Definition: LV2Effect.h:540
int mMaxBlockSize
Definition: LV2Effect.h:446
bool mRolling
Definition: LV2Effect.h:477
bool mLatencyDone
Definition: LV2Effect.h:476
bool mNoResize
Definition: LV2Effect.h:472
bool mActivated
Definition: LV2Effect.h:478
LV2_External_UI_Widget * mExternalWidget
Definition: LV2Effect.h:513
bool mSupportsNominalBlockLength
Definition: LV2Effect.h:521
const LilvPlugin * mPlug
Definition: LV2Effect.h:439
int mSeqSize
Definition: LV2Effect.h:443
LV2Wrapper * mMaster
Definition: LV2Effect.h:480
unsigned mAudioOut
Definition: LV2Effect.h:454
int mBlockSize
Definition: LV2Effect.h:442
bool mResizing
Definition: LV2Effect.h:538
NativeWindow * mNativeWin
Definition: LV2Effect.h:535
LV2UI_Show_Interface * mUIShowInterface
Definition: LV2Effect.h:544
wxSize mNativeWinLastSize
Definition: LV2Effect.h:537
bool mSupportsSampleRate
Definition: LV2Effect.h:522
float mPositionFrame
Definition: LV2Effect.h:493
LV2AtomPortPtr mControlIn
Definition: LV2Effect.h:457
float mSampleRate
Definition: LV2Effect.h:441
int mLatencyPort
Definition: LV2Effect.h:475
LV2_External_UI_Host mExternalUIHost
Definition: LV2Effect.h:512
unsigned mMidiIn
Definition: LV2Effect.h:459
unsigned mAudioIn
Definition: LV2Effect.h:453
float mPositionSpeed
Definition: LV2Effect.h:492
LV2Wrapper * mProcess
Definition: LV2Effect.h:481
LV2UI_Idle_Interface * mUIIdleInterface
Definition: LV2Effect.h:543
int mUserBlockSize
Definition: LV2Effect.h:447
unsigned mMidiOut
Definition: LV2Effect.h:460
const char * plugin_human_id

References DEFAULT_BLOCKSIZE, and DEFAULT_SEQSIZE.

◆ ~LV2Effect()

LV2Effect::~LV2Effect ( )
virtual

Definition at line 403 of file LV2Effect.cpp.

404{
405}

Member Function Documentation

◆ AddFeature()

LV2_Feature * LV2Effect::AddFeature ( const char *  uri,
void *  data 
)
private

Definition at line 1779 of file LV2Effect.cpp.

1780{
1781 size_t ndx = mFeatures.size();
1782 mFeatures.resize(1 + ndx);
1783
1784 if (uri)
1785 {
1786 mFeatures[ndx].reset(safenew LV2_Feature);
1787 mFeatures[ndx]->URI = uri;
1788 mFeatures[ndx]->data = data;
1789 }
1790
1791 return mFeatures[ndx].get();
1792}
#define safenew
Definition: MemoryX.h:10
std::vector< std::unique_ptr< LV2_Feature > > mFeatures
Definition: LV2Effect.h:524

References mFeatures, and safenew.

Referenced by InitializePlugin(), and LV2Wrapper::Instantiate().

Here is the caller graph for this function:

◆ AddOption()

size_t LV2Effect::AddOption ( LV2_URID  key,
uint32_t  size,
LV2_URID  type,
const void *  value 
)
private

Definition at line 1759 of file LV2Effect.cpp.

1760{
1761 int ndx = mOptions.size();
1762 mOptions.resize(1 + ndx);
1763
1764 memset(&mOptions[ndx], 0, sizeof(mOptions[ndx]));
1765
1766 if (key != 0)
1767 {
1768 mOptions[ndx].context = LV2_OPTIONS_INSTANCE;
1769 mOptions[ndx].subject = 0;
1770 mOptions[ndx].key = key;
1771 mOptions[ndx].size = size;
1772 mOptions[ndx].type = type;
1773 mOptions[ndx].value = value;
1774 }
1775
1776 return ndx;
1777}
static const AudacityProject::AttachedObjects::RegisteredFactory key
std::vector< LV2_Options_Option > mOptions
Definition: LV2Effect.h:518

References key, mOptions, and size.

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ BuildFancy()

bool LV2Effect::BuildFancy ( )
private

Definition at line 1992 of file LV2Effect.cpp.

1993{
1994 using namespace LV2Symbols;
1995 // Set the native UI type
1996 const char *nativeType =
1997#if defined(__WXGTK3__)
1998 LV2_UI__Gtk3UI;
1999#elif defined(__WXGTK__)
2000 LV2_UI__GtkUI;
2001#elif defined(__WXMSW__)
2002 LV2_UI__WindowsUI;
2003#elif defined(__WXMAC__)
2004 LV2_UI__CocoaUI;
2005#endif
2006
2007 // Determine if the plugin has a supported UI
2008 const LilvUI *ui = NULL;
2009 const LilvNode *uiType = NULL;
2010 LilvUIs *uis = lilv_plugin_get_uis(mPlug);
2011 if (uis)
2012 {
2013 LilvNode *containerType = lilv_new_uri(gWorld, nativeType);
2014 if (containerType)
2015 {
2016 LILV_FOREACH(uis, iter, uis)
2017 {
2018 ui = lilv_uis_get(uis, iter);
2019 if (lilv_ui_is_supported(ui, suil_ui_supported, containerType, &uiType))
2020 {
2021 break;
2022 }
2023 if (lilv_ui_is_a(ui, node_Gtk) || lilv_ui_is_a(ui, node_Gtk3))
2024 {
2025 uiType = node_Gtk;
2026 break;
2027 }
2028
2029 ui = NULL;
2030 }
2031
2032 lilv_node_free(containerType);
2033 }
2034 }
2035
2036 // Check for other supported UIs
2037 if (ui == NULL)
2038 {
2039 LILV_FOREACH(uis, iter, uis)
2040 {
2041 ui = lilv_uis_get(uis, iter);
2042 if (lilv_ui_is_a(ui, node_ExternalUI) || lilv_ui_is_a(ui, node_ExternalUIOld))
2043 {
2044 uiType = node_ExternalUI;
2045 break;
2046 }
2047 ui = NULL;
2048 }
2049 }
2050
2051 // No usable UI found
2052 if (ui == NULL)
2053 {
2054 lilv_uis_free(uis);
2055 return false;
2056 }
2057
2058 const LilvNode *uinode = lilv_ui_get_uri(ui);
2059 lilv_world_load_resource(gWorld, uinode);
2060 if (!ValidateFeatures(uinode))
2061 {
2062 lilv_uis_free(uis);
2063 return false;
2064 }
2065
2066 const char *containerType;
2067
2068 if (uiType == node_ExternalUI)
2069 {
2070 containerType = LV2_EXTERNAL_UI__Widget;
2071 }
2072 else
2073 {
2074 containerType = nativeType;
2075 mParentFeature->data = mParent->GetHandle();
2076
2077#if defined(__WXGTK__)
2078 // Make sure the parent has a window
2079 if (!gtk_widget_get_window(GTK_WIDGET(mParent->m_wxwindow)))
2080 {
2081 gtk_widget_realize(GTK_WIDGET(mParent->m_wxwindow));
2082 }
2083#endif
2084 }
2085
2086 LilvInstance *instance = mMaster->GetInstance();
2087 mInstanceAccessFeature->data = lilv_instance_get_handle(instance);
2088 mExtensionDataFeature.data_access = lilv_instance_get_descriptor(instance)->extension_data;
2089
2090 // Set before creating the UI instance so the initial size (if any) can be captured
2091 mNativeWinInitialSize = wxDefaultSize;
2092 mNativeWinLastSize = wxDefaultSize;
2093
2094 // Create the suil host
2097 NULL,
2098 NULL);
2099 if (!mSuilHost)
2100 {
2101 lilv_uis_free(uis);
2102 return false;
2103 }
2104
2105#if defined(__WXMSW__)
2106 // Plugins may have dependencies that need to be loaded from the same path
2107 // as the main DLL, so add this plugin's path to the DLL search order.
2108 char *libPath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_binary_uri(ui)), NULL);
2109 wxString path = wxPathOnly(libPath);
2110 SetDllDirectory(path.c_str());
2111 lilv_free(libPath);
2112#endif
2113
2114 char *bundlePath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui)), NULL);
2115 char *binaryPath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_binary_uri(ui)), NULL);
2116
2117 mSuilInstance = suil_instance_new(mSuilHost,
2118 this,
2119 containerType,
2120 lilv_node_as_uri(lilv_plugin_get_uri(mPlug)),
2121 lilv_node_as_uri(lilv_ui_get_uri(ui)),
2122 lilv_node_as_uri(uiType),
2123 bundlePath,
2124 binaryPath,
2125 reinterpret_cast<const LV2_Feature * const *>(mFeatures.data()));
2126
2127 lilv_free(binaryPath);
2128 lilv_free(bundlePath);
2129 lilv_uis_free(uis);
2130
2131 // Bail if the instance (no compatible UI) couldn't be created
2132 if (!mSuilInstance)
2133 {
2134#if defined(__WXMSW__)
2135 SetDllDirectory(NULL);
2136#endif
2137
2138 suil_host_free(mSuilHost);
2139 mSuilHost = NULL;
2140
2141 return false;
2142 }
2143
2144 if (uiType == node_ExternalUI)
2145 {
2146 mParent->SetMinSize(wxDefaultSize);
2147
2148 mExternalWidget = (LV2_External_UI_Widget *) suil_instance_get_widget(mSuilInstance);
2149 mTimer.SetOwner(this, ID_TIMER);
2150 mTimer.Start(20);
2151
2153 }
2154 else
2155 {
2156 WXWidget widget = (WXWidget) suil_instance_get_widget(mSuilInstance);
2157
2158#if defined(__WXGTK__)
2159 // Needed by some plugins (e.g., Invada) to ensure the display is fully
2160 // populated.
2161 gtk_widget_show_all(widget);
2162
2163 // See note at size_request()
2164 g_signal_connect(widget, "size-request", G_CALLBACK(LV2Effect::size_request), this);
2165#endif
2166
2168 if ( !uNativeWin->Create(mParent, widget) )
2169 return false;
2170 mNativeWin = uNativeWin.release();
2171
2172 mNativeWin->Bind(wxEVT_SIZE, &LV2Effect::OnSize, this);
2173
2174 // The plugin called the LV2UI_Resize::ui_resize function to set the size before
2175 // the native window was created, so set the size now.
2176 if (mNativeWinInitialSize != wxDefaultSize)
2177 {
2178 mNativeWin->SetMinSize(mNativeWinInitialSize);
2179 }
2180
2181 wxSizerItem *si = NULL;
2182 auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL);
2183 if (vs)
2184 {
2185 auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
2186 if (hs)
2187 {
2188 if (mNoResize)
2189 {
2190 si = hs->Add(mNativeWin, 0, wxCENTER);
2191 vs->Add(hs.release(), 1, wxCENTER);
2192 }
2193 else
2194 {
2195 si = hs->Add(mNativeWin, 1, wxEXPAND);
2196 vs->Add(hs.release(), 1, wxEXPAND);
2197 }
2198 }
2199 }
2200
2201 if (!si)
2202 {
2203 lilv_uis_free(uis);
2204 return false;
2205 }
2206
2207 mParent->SetSizerAndFit(vs.release());
2208 }
2209
2210 mUIIdleInterface = (LV2UI_Idle_Interface *)
2211 suil_instance_extension_data(mSuilInstance, LV2_UI__idleInterface);
2212
2213 mUIShowInterface = (LV2UI_Show_Interface *)
2214 suil_instance_extension_data(mSuilInstance, LV2_UI__showInterface);
2215
2216 if (mUIShowInterface)
2217 {
2218// mUIShowInterface->show(suil_instance_get_handle(mSuilInstance));
2219 }
2220
2222
2223#ifdef __WXMAC__
2224#ifdef __WX_EVTLOOP_BUSY_WAITING__
2225 wxEventLoop::SetBusyWaiting(true);
2226#endif
2227#endif
2228
2229#if defined(__WXMSW__)
2230 SetDllDirectory(NULL);
2231#endif
2232
2233 return true;
2234}
@ ID_TIMER
Definition: LV2Effect.cpp:336
std::unique_ptr< T, Destroyer< T > > Destroy_ptr
a convenience for using Destroyer
Definition: MemoryX.h:162
LV2_Feature * mParentFeature
Definition: LV2Effect.h:527
LV2_Extension_Data_Feature mExtensionDataFeature
Definition: LV2Effect.h:510
wxTimer mTimer
Definition: LV2Effect.h:497
bool TransferDataToWindow()
Definition: LV2Effect.cpp:2547
static void size_request(GtkWidget *widget, GtkRequisition *requisition, LV2Effect *win)
Definition: LV2Effect.cpp:3148
SuilHost * mSuilHost
Definition: LV2Effect.h:532
bool ValidateFeatures(const LilvNode *subject)
Definition: LV2Effect.cpp:1794
void OnSize(wxSizeEvent &evt)
Definition: LV2Effect.cpp:2777
LV2_Feature * mInstanceAccessFeature
Definition: LV2Effect.h:526
wxWindow * mParent
Definition: LV2Effect.h:500
static void suil_port_write_func(SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)
Definition: LV2Effect.cpp:3007
static uint32_t suil_port_index_func(SuilController controller, const char *port_symbol)
Definition: LV2Effect.cpp:3043
LilvInstance * GetInstance()
Definition: LV2Effect.cpp:3298
#define LV2_EXTERNAL_UI_SHOW(ptr)
#define LV2_EXTERNAL_UI__Widget
LilvWorld * gWorld
Definition: LV2Symbols.cpp:31

References LV2Wrapper::GetInstance(), LV2Symbols::gWorld, ID_TIMER, LV2_EXTERNAL_UI__Widget, LV2_EXTERNAL_UI_SHOW, mExtensionDataFeature, mExternalWidget, mFeatures, mInstanceAccessFeature, mMaster, mNativeWin, mNativeWinInitialSize, mNativeWinLastSize, mNoResize, mParent, mParentFeature, mPlug, mSuilHost, mSuilInstance, mTimer, mUIIdleInterface, mUIShowInterface, OnSize(), safenew, size_request(), suil_port_index_func(), suil_port_write_func(), TransferDataToWindow(), and ValidateFeatures().

Referenced by PopulateUI().

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

◆ BuildPlain()

bool LV2Effect::BuildPlain ( EffectSettingsAccess access)
private

Definition at line 2236 of file LV2Effect.cpp.

2237{
2238 int numCols = 5;
2239 wxSizer *innerSizer;
2240
2241 wxASSERT(mParent); // To justify safenew
2242 wxScrolledWindow *const w = safenew
2243 wxScrolledWindow(mParent,
2244 wxID_ANY,
2245 wxDefaultPosition,
2246 wxDefaultSize,
2247 wxVSCROLL | wxTAB_TRAVERSAL);
2248
2249 {
2250 auto outerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
2251 w->SetScrollRate(0, 20);
2252
2253 // This fools NVDA into not saying "Panel" when the dialog gets focus
2254 w->SetName(wxT("\a"));
2255 w->SetLabel(wxT("\a"));
2256
2257 outerSizer->Add(w, 1, wxEXPAND);
2258
2259 {
2260 auto uInnerSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
2261 innerSizer = uInnerSizer.get();
2262
2263 if (GetType() == EffectTypeGenerate)
2264 {
2265 // Add the length control
2266 auto groupSizer = std::make_unique<wxStaticBoxSizer>(wxVERTICAL, w, _("Generator"));
2267
2268 auto sizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
2269
2270 wxWindow *item = safenew wxStaticText(w, 0, _("&Duration:"));
2271 sizer->Add(item, 0, wxALIGN_CENTER | wxALL, 5);
2272 auto &extra = access.Get().extra;
2276 extra.GetDurationFormat(),
2277 extra.GetDuration(),
2280 .AutoPos(true));
2281 mDuration->SetName( XO("Duration") );
2282 sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
2283
2284 groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
2285 innerSizer->Add(groupSizer.release(), 0, wxEXPAND | wxALL, 5);
2286 }
2287
2288 std::sort(mGroups.begin(), mGroups.end(),
2289 [](const TranslatableString &a, const TranslatableString &b){
2290 return a.Translation() < b.Translation(); });
2291
2292 for (size_t i = 0, groupCount = mGroups.size(); i < groupCount; i++)
2293 {
2294 const auto &label = mGroups[i];
2295 auto groupSizer = std::make_unique<wxStaticBoxSizer>(
2296 wxVERTICAL, w, label.Translation());
2297
2298 auto gridSizer = std::make_unique<wxFlexGridSizer>(numCols, 5, 5);
2299 gridSizer->AddGrowableCol(3);
2300
2301 for (auto & p : mGroupMap[mGroups[i]])
2302 {
2303 auto & port = mControlPorts[p];
2304
2305 if (port->mNotOnGui)
2306 {
2307 continue;
2308 }
2309
2310 wxString labelText = port->mName;
2311 if (!port->mUnits.empty())
2312 {
2313 labelText += wxT(" (") + port->mUnits + wxT(")");
2314 }
2315
2316 if (port->mTrigger)
2317 {
2318 gridSizer->Add(1, 1, 0);
2319
2320 wxASSERT(w); // To justify safenew
2321 wxButton *b = safenew wxButton(w, ID_Triggers + p, labelText);
2322 gridSizer->Add(b, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
2323 port->mCtrl.button = b;
2324
2325 gridSizer->Add(1, 1, 0);
2326 gridSizer->Add(1, 1, 0);
2327 gridSizer->Add(1, 1, 0);
2328 continue;
2329 }
2330
2331 wxWindow *item = safenew wxStaticText(w, wxID_ANY, labelText + wxT(":"),
2332 wxDefaultPosition, wxDefaultSize,
2333 wxALIGN_RIGHT);
2334 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
2335
2336 if (port->mToggle)
2337 {
2338 wxCheckBox *c = safenew wxCheckBox(w, ID_Toggles + p, wxT(""));
2339 c->SetName(labelText);
2340 c->SetValue(port->mVal > 0);
2341 gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
2342 port->mCtrl.checkbox = c;
2343
2344 gridSizer->Add(1, 1, 0);
2345 gridSizer->Add(1, 1, 0);
2346 gridSizer->Add(1, 1, 0);
2347 }
2348 else if (port->mEnumeration) // Check before integer
2349 {
2350 int s;
2351 for (s = (int) port->mScaleValues.size() - 1; s >= 0; s--)
2352 {
2353 if (port->mVal >= port->mScaleValues[s])
2354 {
2355 break;
2356 }
2357 }
2358
2359 if (s < 0)
2360 {
2361 s = 0;
2362 }
2363
2364 wxChoice *c = safenew wxChoice(w, ID_Choices + p);
2365 c->SetName(labelText);
2366 c->Append(port->mScaleLabels);
2367 c->SetSelection(s);
2368 gridSizer->Add(c, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
2369 port->mCtrl.choice = c;
2370
2371 gridSizer->Add(1, 1, 0);
2372 gridSizer->Add(1, 1, 0);
2373 gridSizer->Add(1, 1, 0);
2374 }
2375 else if (!port->mIsInput)
2376 {
2377 gridSizer->Add(1, 1, 0);
2378 gridSizer->Add(1, 1, 0);
2379
2381 gridSizer->Add(m, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
2382 port->mCtrl.meter = m;
2383
2384 gridSizer->Add(1, 1, 0);
2385 }
2386 else
2387 {
2388 wxTextCtrl *t = safenew wxTextCtrl(w, ID_Texts + p, wxT(""));
2389 t->SetName(labelText);
2390 gridSizer->Add(t, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
2391 port->mText = t;
2392
2393 float rate = port->mSampleRate ? mSampleRate : 1.0;
2394
2395 port->mLo = port->mMin * rate;
2396 port->mHi = port->mMax * rate;
2397 port->mTmp = port->mVal * rate;
2398
2399 if (port->mInteger)
2400 {
2401 IntegerValidator<float> vld(&port->mTmp);
2402 vld.SetRange(port->mLo, port->mHi);
2403 t->SetValidator(vld);
2404 }
2405 else
2406 {
2407 FloatingPointValidator<float> vld(6, &port->mTmp);
2408 vld.SetRange(port->mLo, port->mHi);
2409
2410 // Set number of decimal places
2411 float range = port->mHi - port->mLo;
2412 auto style = range < 10
2413 ? NumValidatorStyle::THREE_TRAILING_ZEROES
2414 : range < 100
2415 ? NumValidatorStyle::TWO_TRAILING_ZEROES
2416 : NumValidatorStyle::ONE_TRAILING_ZERO;
2417 vld.SetStyle(style);
2418
2419 t->SetValidator(vld);
2420 }
2421
2422 if (port->mHasLo)
2423 {
2424 wxString str;
2425 if (port->mInteger || port->mSampleRate)
2426 {
2427 str.Printf(wxT("%d"), (int) lrintf(port->mLo));
2428 }
2429 else
2430 {
2431 str = Internat::ToDisplayString(port->mLo);
2432 }
2433 item = safenew wxStaticText(w, wxID_ANY, str);
2434 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
2435 }
2436 else
2437 {
2438 gridSizer->Add(1, 1, 0);
2439 }
2440
2441 wxSlider *s = safenew wxSliderWrapper(w, ID_Sliders + p,
2442 0, 0, 1000,
2443 wxDefaultPosition,
2444 wxSize(150, -1));
2445 s->SetName(labelText);
2446 gridSizer->Add(s, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND);
2447 port->mCtrl.slider = s;
2448
2449 if (port->mHasHi)
2450 {
2451 wxString str;
2452 if (port->mInteger || port->mSampleRate)
2453 {
2454 str.Printf(wxT("%d"), (int) lrintf(port->mHi));
2455 }
2456 else
2457 {
2458 str = Internat::ToDisplayString(port->mHi);
2459 }
2460 item = safenew wxStaticText(w, wxID_ANY, str);
2461 gridSizer->Add(item, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT);
2462 }
2463 else
2464 {
2465 gridSizer->Add(1, 1, 0);
2466 }
2467 }
2468 }
2469
2470 groupSizer->Add(gridSizer.release(), 1, wxEXPAND | wxALL, 5);
2471 innerSizer->Add(groupSizer.release(), 0, wxEXPAND | wxALL, 5);
2472 }
2473
2474 innerSizer->Layout();
2475
2476 // Calculate the maximum width of all columns (bypass Generator sizer)
2477 std::vector<int> widths(numCols);
2478
2479 size_t cnt = innerSizer->GetChildren().GetCount();
2480 for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
2481 {
2482 wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
2483 wxFlexGridSizer *gridSizer = (wxFlexGridSizer *) groupSizer->GetItem((size_t) 0)->GetSizer();
2484
2485 size_t items = gridSizer->GetChildren().GetCount();
2486 int cols = gridSizer->GetCols();
2487
2488 for (size_t j = 0; j < items; j++)
2489 {
2490 wxSizerItem *item = gridSizer->GetItem(j);
2491 widths[j % cols] = wxMax(widths[j % cols], item->GetSize().GetWidth());
2492 }
2493 }
2494
2495 // Set each column in all of the groups to the same width.
2496 for (size_t i = (GetType() == EffectTypeGenerate); i < cnt; i++)
2497 {
2498 wxSizer *groupSizer = innerSizer->GetItem(i)->GetSizer();
2499 wxFlexGridSizer *gridSizer = (wxFlexGridSizer *) groupSizer->GetItem((size_t) 0)->GetSizer();
2500
2501 size_t items = gridSizer->GetChildren().GetCount();
2502 int cols = gridSizer->GetCols();
2503
2504 for (size_t j = 0; j < items; j++)
2505 {
2506 wxSizerItem *item = gridSizer->GetItem(j);
2507
2508 int flags = item->GetFlag();
2509 if (flags & wxEXPAND)
2510 {
2511 continue;
2512 }
2513
2514 if (flags & wxALIGN_RIGHT)
2515 {
2516 flags = (flags & ~wxALL) | wxLEFT;
2517 }
2518 else
2519 {
2520 flags = (flags & ~wxALL) | wxRIGHT;
2521 }
2522 item->SetFlag(flags);
2523
2524 item->SetBorder(widths[j % cols] - item->GetMinSize().GetWidth());
2525 }
2526 }
2527
2528 w->SetSizer(uInnerSizer.release());
2529 }
2530
2531 mParent->SetSizer(outerSizer.release());
2532 }
2533
2534 // Try to give the window a sensible default/minimum size
2535 wxSize sz1 = innerSizer->GetMinSize();
2536 wxSize sz2 = mParent->GetMinSize();
2537 w->SetMinSize( { -1, std::min(sz1.y, sz2.y) } );
2538
2539 // And let the parent reduce to the NEW minimum if possible
2540 mParent->SetMinSize(w->GetMinSize());
2541
2543
2544 return true;
2545}
int min(int a, int b)
#define str(a)
@ EffectTypeGenerate
#define XO(s)
Definition: Internat.h:31
#define _(s)
Definition: Internat.h:75
@ ID_Triggers
Definition: LV2Effect.cpp:331
@ ID_Texts
Definition: LV2Effect.cpp:335
@ ID_Duration
Definition: LV2Effect.cpp:330
@ ID_Choices
Definition: LV2Effect.cpp:334
@ ID_Sliders
Definition: LV2Effect.cpp:333
@ ID_Toggles
Definition: LV2Effect.cpp:332
TranslatableString label
Definition: TagsEditor.cpp:163
virtual const EffectSettings & Get()=0
static wxString ToDisplayString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, uses the user's locale's decimal separator.
Definition: Internat.cpp:162
LV2ControlPortArray mControlPorts
Definition: LV2Effect.h:450
std::unordered_map< TranslatableString, std::vector< int > > mGroupMap
Definition: LV2Effect.h:466
EffectType GetType() const override
Type determines how it behaves.
Definition: LV2Effect.cpp:447
TranslatableStrings mGroups
Definition: LV2Effect.h:467
NumericTextCtrl * mDuration
Definition: LV2Effect.h:546
void SetName(const TranslatableString &name)
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
#define lrintf(flt)
Definition: float_cast.h:170
EffectSettingsExtra extra
Options & AutoPos(bool enable)

References _, NumericTextCtrl::Options::AutoPos(), EffectTypeGenerate, EffectSettings::extra, EffectSettingsAccess::Get(), GetType(), ID_Choices, ID_Duration, ID_Sliders, ID_Texts, ID_Toggles, ID_Triggers, label, lrintf, mControlPorts, mDuration, mGroupMap, mGroups, min(), mParent, mSampleRate, safenew, NumericTextCtrl::SetName(), str, NumericConverter::TIME, Internat::ToDisplayString(), TransferDataToWindow(), TranslatableString::Translation(), and XO.

Referenced by PopulateUI().

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

◆ CanExportPresets()

bool LV2Effect::CanExportPresets ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1688 of file LV2Effect.cpp.

1689{
1690 return false;
1691}

◆ CheckFeatures()

bool LV2Effect::CheckFeatures ( const LilvNode *  subject,
const LilvNode *  predicate,
bool  required 
)
private

Definition at line 1804 of file LV2Effect.cpp.

1805{
1806 bool supported = true;
1807
1808 LilvNodes *nodes =
1809 lilv_world_find_nodes(LV2Symbols::gWorld, subject, predicate, nullptr);
1810 if (nodes)
1811 {
1812 LILV_FOREACH(nodes, i, nodes)
1813 {
1814 const LilvNode *node = lilv_nodes_get(nodes, i);
1815 const char *uri = lilv_node_as_string(node);
1816
1817 if ((strcmp(uri, LV2_UI__noUserResize) == 0) ||
1818 (strcmp(uri, LV2_UI__fixedSize) == 0))
1819 {
1820 mNoResize = true;
1821 }
1822 else if (strcmp(uri, LV2_WORKER__schedule) == 0)
1823 {
1824 /* Supported but handled in LV2Wrapper */
1825 }
1826 else
1827 {
1828 supported = false;
1829
1830 for (auto & feature : mFeatures)
1831 {
1832 if (feature && strcmp(feature->URI, uri) == 0)
1833 {
1834 supported = true;
1835 break;
1836 }
1837 }
1838
1839 if (!supported)
1840 {
1841 if (required)
1842 {
1843 wxLogError(wxT("%s requires unsupported feature %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
1844 break;
1845 }
1846 supported = true;
1847 }
1848 }
1849 }
1850
1851 lilv_nodes_free(nodes);
1852 }
1853
1854
1855 return supported;
1856}

References LV2Symbols::gWorld, mFeatures, mNoResize, and mPlug.

Referenced by ValidateFeatures().

Here is the caller graph for this function:

◆ CheckOptions()

bool LV2Effect::CheckOptions ( const LilvNode *  subject,
const LilvNode *  predicate,
bool  required 
)
private

Definition at line 1868 of file LV2Effect.cpp.

1869{
1870 using namespace LV2Symbols;
1871 bool supported = true;
1872
1873 LilvNodes *nodes = lilv_world_find_nodes(gWorld, subject, predicate, NULL);
1874 if (nodes)
1875 {
1876 LILV_FOREACH(nodes, i, nodes)
1877 {
1878 const LilvNode *node = lilv_nodes_get(nodes, i);
1879 const char *uri = lilv_node_as_string(node);
1880 LV2_URID urid = URID_Map(uri);
1881
1882 if (urid == urid_NominalBlockLength)
1883 {
1885 }
1886 else if (urid == urid_SampleRate)
1887 {
1888 mSupportsSampleRate = true;
1889 }
1890 else
1891 {
1892 supported = false;
1893
1894 for (auto & option : mOptions)
1895 {
1896 if (option.key == urid)
1897 {
1898 supported = true;
1899 break;
1900 }
1901 }
1902
1903 if (!supported)
1904 {
1905 if (required)
1906 {
1907 wxLogError(wxT("%s requires unsupported option %s"), lilv_node_as_string(lilv_plugin_get_uri(mPlug)), uri);
1908 break;
1909 }
1910 supported = true;
1911 }
1912 }
1913 }
1914
1915 lilv_nodes_free(nodes);
1916 }
1917
1918 return supported;
1919}
LV2_URID URID_Map(const char *uri)
Definition: LV2Effect.cpp:2859

References LV2Symbols::gWorld, mOptions, mPlug, mSupportsNominalBlockLength, mSupportsSampleRate, and URID_Map().

Referenced by ValidateOptions().

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

◆ CloseUI()

bool LV2Effect::CloseUI ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1543 of file LV2Effect.cpp.

1544{
1545#ifdef __WXMAC__
1546#ifdef __WX_EVTLOOP_BUSY_WAITING__
1547 wxEventLoop::SetBusyWaiting(false);
1548#endif
1549#endif
1550
1551 mParent->RemoveEventHandler(this);
1552
1553 if (mSuilInstance)
1554 {
1555 if (mNativeWin)
1556 {
1557 mNativeWin->Destroy();
1558 mNativeWin = NULL;
1559 }
1560
1561 mUIIdleInterface = NULL;
1562 mUIShowInterface = NULL;
1563 mExternalWidget = NULL;
1564
1565 suil_instance_free(mSuilInstance);
1566 mSuilInstance = NULL;
1567 }
1568
1569 if (mSuilHost)
1570 {
1571 suil_host_free(mSuilHost);
1572 mSuilHost = NULL;
1573 }
1574
1575 if (mMaster)
1576 {
1578 mMaster = NULL;
1579 }
1580
1581 mParent = NULL;
1582 mDialog = NULL;
1583
1584 return true;
1585}
void FreeInstance(LV2Wrapper *wrapper)
Definition: LV2Effect.cpp:1987
wxWeakRef< wxDialog > mDialog
Definition: LV2Effect.h:499

References FreeInstance(), mDialog, mExternalWidget, mMaster, mNativeWin, mParent, mSuilHost, mSuilInstance, mUIIdleInterface, and mUIShowInterface.

Here is the call graph for this function:

◆ DoLoadFactoryPreset()

bool LV2Effect::DoLoadFactoryPreset ( int  id)

Definition at line 1659 of file LV2Effect.cpp.

1660{
1661 using namespace LV2Symbols;
1662 if (id < 0 || id >= (int) mFactoryPresetUris.size())
1663 {
1664 return false;
1665 }
1666
1667 LilvNode *preset = lilv_new_uri(gWorld, mFactoryPresetUris[id].ToUTF8());
1668 if (!preset)
1669 {
1670 return false;
1671 }
1672
1673 LilvState *state = lilv_state_new_from_world(gWorld, &mURIDMapFeature, preset);
1674 if (state)
1675 {
1676 lilv_state_restore(state, mMaster->GetInstance(), set_value_func, this, 0, NULL);
1677
1678 lilv_state_free(state);
1679
1681 }
1682
1683 lilv_node_free(preset);
1684
1685 return state != NULL;
1686}
EffectReverbSettings preset
Definition: Reverb.cpp:46
LV2_URID_Map mURIDMapFeature
Definition: LV2Effect.h:506
wxArrayString mFactoryPresetUris
Definition: LV2Effect.h:551
static void set_value_func(const char *port_symbol, void *user_data, const void *value, uint32_t size, uint32_t type)
Definition: LV2Effect.cpp:3095
std::string ToUTF8(const std::wstring &wstr)

References LV2Wrapper::GetInstance(), LV2Symbols::gWorld, mFactoryPresetUris, mMaster, mURIDMapFeature, preset, set_value_func(), audacity::ToUTF8(), and TransferDataToWindow().

Referenced by LoadFactoryPreset().

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

◆ DoLoadUserPreset()

bool LV2Effect::DoLoadUserPreset ( const RegistryPath name,
EffectSettings settings 
)

Definition at line 1594 of file LV2Effect.cpp.

1596{
1598 {
1599 return false;
1600 }
1601
1602 return TransferDataToWindow();
1603}
const TranslatableString name
Definition: Distortion.cpp:82
static Settings & settings()
Definition: TrackInfo.cpp:87
bool LoadParameters(const RegistryPath &group, EffectSettings &settings)
Definition: LV2Effect.cpp:1725

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

Referenced by LoadUserPreset().

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

◆ DoMakeInstance()

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

Definition at line 908 of file LV2Effect.cpp.

909{
910 int userBlockSize;
911 GetConfig(*this, PluginSettings::Shared, wxT("Settings"),
912 wxT("BufferSize"), userBlockSize, 8192);
913 mUserBlockSize = std::max(1, userBlockSize);
914 GetConfig(*this, PluginSettings::Shared, wxT("Settings"),
915 wxT("UseLatency"), mUseLatency, true);
916 GetConfig(*this, PluginSettings::Shared, wxT("Settings"), wxT("UseGUI"),
917 mUseGUI, true);
918
920
921 lv2_atom_forge_init(&mForge, &mURIDMapFeature);
922
923 return std::make_shared<Instance>(*this);
924}
bool mUseGUI
Definition: LV2Effect.h:502
bool mUseLatency
Definition: LV2Effect.h:474
LV2_Atom_Forge mForge
Definition: LV2Effect.h:516
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)

References PluginSettings::GetConfig(), mBlockSize, mForge, mURIDMapFeature, mUseGUI, mUseLatency, mUserBlockSize, and PluginSettings::Shared.

Referenced by MakeInstance().

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

◆ ExportPresets()

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

Reimplemented from Effect.

Definition at line 1693 of file LV2Effect.cpp.

1694{
1695}

◆ FreeInstance()

void LV2Effect::FreeInstance ( LV2Wrapper wrapper)
private

Definition at line 1987 of file LV2Effect.cpp.

1988{
1989 delete wrapper;
1990}

Referenced by CloseUI(), and ProcessFinalize().

Here is the caller graph for this function:

◆ get_value_func()

const void * LV2Effect::get_value_func ( const char *  port_symbol,
void *  user_data,
uint32_t *  size,
uint32_t *  type 
)
staticprivate

Definition at line 3064 of file LV2Effect.cpp.

3068{
3069 return ((LV2Effect *) user_data)->GetPortValue(port_symbol, size, type);
3070}

References size.

◆ GetAudioInCount()

unsigned LV2Effect::GetAudioInCount ( ) const
overridevirtual

How many input buffers to allocate at once.

If the effect ALWAYS processes channels independently, this can return 1

Reimplemented from Effect.

Definition at line 926 of file LV2Effect.cpp.

927{
928 return mAudioIn;
929}

References mAudioIn.

Referenced by GetType().

Here is the caller graph for this function:

◆ GetAudioOutCount()

unsigned LV2Effect::GetAudioOutCount ( ) const
overridevirtual

How many output buffers to allocate at once.

Reimplemented from Effect.

Definition at line 931 of file LV2Effect.cpp.

932{
933 return mAudioOut;
934}

References mAudioOut.

Referenced by GetType().

Here is the caller graph for this function:

◆ GetBlockSize()

size_t LV2Effect::GetBlockSize ( ) const
overridevirtual

Default implementation returns mEffectBlockSize

Reimplemented from StatefulEffectBase.

Definition at line 987 of file LV2Effect.cpp.

988{
989 return mBlockSize;
990}

References mBlockSize.

◆ GetDescription()

TranslatableString LV2Effect::GetDescription ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 438 of file LV2Effect.cpp.

439{
440 return XO("n/a");
441}

References XO.

◆ GetFactoryPresets()

RegistryPaths LV2Effect::GetFactoryPresets ( ) const
overridevirtual

Report names of factory presets.

Reimplemented from Effect.

Definition at line 1611 of file LV2Effect.cpp.

1612{
1613 using namespace LV2Symbols;
1615 {
1616 return mFactoryPresetNames;
1617 }
1618
1619 LilvNodes *presets = lilv_plugin_get_related(mPlug, node_Preset);
1620 if (presets)
1621 {
1622 LILV_FOREACH(nodes, i, presets)
1623 {
1624 const LilvNode *preset = lilv_nodes_get(presets, i);
1625
1627
1628 lilv_world_load_resource(gWorld, preset);
1629
1630 LilvNodes *labels = lilv_world_find_nodes(gWorld, preset, node_Label, NULL);
1631 if (labels)
1632 {
1633 const LilvNode *label = lilv_nodes_get_first(labels);
1634
1636
1637 lilv_nodes_free(labels);
1638 }
1639 else
1640 {
1641 mFactoryPresetNames.push_back(LilvString(preset).AfterLast(wxT('#')));
1642 }
1643 }
1644
1645 lilv_nodes_free(presets);
1646 }
1647
1648 mFactoryPresetsLoaded = true;
1649
1650 return mFactoryPresetNames;
1651}
wxString LilvString(const LilvNode *node)
Definition: LV2Effect.h:560
bool mFactoryPresetsLoaded
Definition: LV2Effect.h:549
RegistryPaths mFactoryPresetNames
Definition: LV2Effect.h:550

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

Here is the call graph for this function:

◆ GetFamily()

EffectFamilySymbol LV2Effect::GetFamily ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 467 of file LV2Effect.cpp.

468{
469 return LV2EFFECTS_FAMILY;
470}
#define LV2EFFECTS_FAMILY
Definition: LV2Effect.h:60

References LV2EFFECTS_FAMILY.

◆ GetLatency()

sampleCount LV2Effect::GetLatency ( )
overridevirtual

Called for destructive, non-realtime effect computation Default implementation returns zero

Reimplemented from StatefulPerTrackEffect.

Definition at line 992 of file LV2Effect.cpp.

993{
994 if (mUseLatency && mLatencyPort >= 0 && !mLatencyDone)
995 {
996 mLatencyDone = true;
997 return sampleCount(mMaster->GetLatency());
998 }
999
1000 return 0;
1001}
float GetLatency()
Definition: LV2Effect.cpp:3308
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18

References LV2Wrapper::GetLatency(), mLatencyDone, mLatencyPort, mMaster, and mUseLatency.

Here is the call graph for this function:

◆ GetMidiInCount()

int LV2Effect::GetMidiInCount ( ) const
overridevirtual

Function that has not yet found a use.

Reimplemented from EffectInstanceFactory.

Definition at line 936 of file LV2Effect.cpp.

937{
938 return mMidiIn;
939}

References mMidiIn.

◆ GetMidiOutCount()

int LV2Effect::GetMidiOutCount ( ) const
overridevirtual

Function that has not yet found a use.

Reimplemented from EffectInstanceFactory.

Definition at line 941 of file LV2Effect.cpp.

942{
943 return mMidiOut;
944}

References mMidiOut.

◆ GetPath()

PluginPath LV2Effect::GetPath ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 411 of file LV2Effect.cpp.

412{
413 return LilvString(lilv_plugin_get_uri(mPlug));
414}

References LilvString(), and mPlug.

Here is the call graph for this function:

◆ GetPortValue()

const void * LV2Effect::GetPortValue ( const char *  port_symbol,
uint32_t *  size,
uint32_t *  type 
)
private

Definition at line 3072 of file LV2Effect.cpp.

3075{
3076 wxString symbol = wxString::FromUTF8(port_symbol);
3077
3078 for (auto & port : mControlPorts)
3079 {
3080 if (port->mSymbol == symbol)
3081 {
3082 *size = sizeof(float);
3083 *type = LV2Symbols::urid_Float;
3084 return (void *) &port->mVal;
3085 }
3086 }
3087
3088 *size = 0;
3089 *type = 0;
3090
3091 return NULL;
3092}

References mControlPorts, and size.

◆ GetSymbol()

ComponentInterfaceSymbol LV2Effect::GetSymbol ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 416 of file LV2Effect.cpp.

417{
418 return LilvString(lilv_plugin_get_name(mPlug), true);
419}

References LilvString(), and mPlug.

Referenced by LogVPrintf().

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

◆ GetType()

EffectType LV2Effect::GetType ( ) const
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 447 of file LV2Effect.cpp.

448{
449 if (GetAudioInCount() == 0 && GetAudioOutCount() == 0)
450 {
451 return EffectTypeTool;
452 }
453
454 if (GetAudioInCount() == 0)
455 {
456 return EffectTypeGenerate;
457 }
458
459 if (GetAudioOutCount() == 0)
460 {
461 return EffectTypeAnalyze;
462 }
463
464 return EffectTypeProcess;
465}
@ EffectTypeAnalyze
@ EffectTypeTool
@ EffectTypeProcess
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: LV2Effect.cpp:926
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
Definition: LV2Effect.cpp:931

References EffectTypeAnalyze, EffectTypeGenerate, EffectTypeProcess, EffectTypeTool, GetAudioInCount(), and GetAudioOutCount().

Referenced by BuildPlain(), PopulateUI(), ShowClientInterface(), and ValidateUI().

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

◆ GetVendor()

VendorSymbol LV2Effect::GetVendor ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 421 of file LV2Effect.cpp.

422{
423 wxString vendor = LilvString(lilv_plugin_get_author_name(mPlug), true);
424
425 if (vendor.empty())
426 {
427 return XO("n/a");
428 }
429
430 return {vendor};
431}

References LilvString(), mPlug, and XO.

Here is the call graph for this function:

◆ GetVersion()

wxString LV2Effect::GetVersion ( ) const
overridevirtual

Reimplemented from Effect.

Definition at line 433 of file LV2Effect.cpp.

434{
435 return wxT("1.0");
436}

◆ HasOptions()

bool LV2Effect::HasOptions ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1701 of file LV2Effect.cpp.

1702{
1703 return true;
1704}

◆ ImportPresets()

void LV2Effect::ImportPresets ( EffectSettings settings)
overridevirtual

Reimplemented from Effect.

Definition at line 1697 of file LV2Effect.cpp.

1698{
1699}

◆ InitializePlugin()

bool LV2Effect::InitializePlugin ( )

Definition at line 494 of file LV2Effect.cpp.

495{
496 using namespace LV2Symbols;
497
498 AddOption(urid_SequenceSize, sizeof(mSeqSize), urid_Int, &mSeqSize);
499 AddOption(urid_MinBlockLength, sizeof(mMinBlockSize), urid_Int, &mMinBlockSize);
500 AddOption(urid_MaxBlockLength, sizeof(mMaxBlockSize), urid_Int, &mMaxBlockSize);
501
502 mBlockSizeOption = AddOption(urid_NominalBlockLength,
503 sizeof(mBlockSize),
504 urid_Int,
505 &mBlockSize);
506 mSampleRateOption = AddOption(urid_SampleRate,
507 sizeof(mSampleRate),
508 urid_Float,
509 &mSampleRate);
510 AddOption(0, 0, 0, NULL);
511
512 if (!ValidateOptions(lilv_plugin_get_uri(mPlug)))
513 {
514 return false;
515 }
516
517 mUriMapFeature.callback_data = this;
519
520 mURIDMapFeature.handle = this;
522
523 mURIDUnmapFeature.handle = this;
525
526 mUIResizeFeature.handle = this;
528
529 mLogFeature.handle = this;
532
534
535 LilvNode *pluginName = lilv_plugin_get_name(mPlug);
536 mExternalUIHost.plugin_human_id = lilv_node_as_string(pluginName);
537 lilv_node_free(pluginName);
538
539 AddFeature(LV2_UI__noUserResize, NULL);
540 AddFeature(LV2_UI__fixedSize, NULL);
541 AddFeature(LV2_UI__idleInterface, NULL);
543 AddFeature(LV2_BUF_SIZE__boundedBlockLength, NULL);
544 AddFeature(LV2_BUF_SIZE__fixedBlockLength, NULL);
545 AddFeature(LV2_OPTIONS__options, mOptions.data());
546 AddFeature(LV2_URI_MAP_URI, &mUriMapFeature);
547 AddFeature(LV2_URID__map, &mURIDMapFeature);
548 AddFeature(LV2_URID__unmap, &mURIDUnmapFeature);
549 AddFeature(LV2_UI__resize, &mUIResizeFeature);
550 AddFeature(LV2_DATA_ACCESS_URI, &mExtensionDataFeature);
551 AddFeature(LV2_LOG__log, &mLogFeature);
554 // Some plugins specify this as a feature
556
557 mInstanceAccessFeature = AddFeature(LV2_INSTANCE_ACCESS_URI, NULL);
558 mParentFeature = AddFeature(LV2_UI__parent, NULL);
559
560 AddFeature(NULL, NULL);
561
562 if (!ValidateFeatures(lilv_plugin_get_uri(mPlug)))
563 {
564 return false;
565 }
566
567 auto minLength = lilv_world_get(gWorld, lilv_plugin_get_uri(mPlug), node_MinBlockLength, NULL);
568 if (minLength)
569 {
570 if (lilv_node_is_int(minLength))
571 {
572 int val = lilv_node_as_int(minLength);
573 if (mMinBlockSize < val)
574 {
575 mMinBlockSize = val;
576 }
577 }
578 lilv_node_free(minLength);
579 }
580
581 auto maxLength = lilv_world_get(gWorld, lilv_plugin_get_uri(mPlug), node_MaxBlockLength, NULL);
582 if (maxLength)
583 {
584 if (lilv_node_is_int(maxLength))
585 {
586 int val = lilv_node_as_int(maxLength);
587 if (mMaxBlockSize > val)
588 {
589 mMaxBlockSize = val;
590 }
591 }
592 lilv_node_free(maxLength);
593 }
594
596 {
598 }
599
600 auto numPorts = lilv_plugin_get_num_ports(mPlug);
601
602 // Allocate buffers for the port indices and the default control values
603 Floats minimumVals {numPorts};
604 Floats maximumVals {numPorts};
605 Floats defaultVals {numPorts};
606
607 // Retrieve the port ranges for all ports (some values may be NaN)
608 lilv_plugin_get_port_ranges_float(mPlug,
609 minimumVals.get(),
610 maximumVals.get(),
611 defaultVals.get());
612
613 // Get info about all ports
614 for (size_t i = 0; i < numPorts; i++)
615 {
616 const LilvPort *port = lilv_plugin_get_port_by_index(mPlug, i);
617 int index = lilv_port_get_index(mPlug, port);
618
619 // It must be input or output, anything else is bogus
620 bool isInput;
621 if (lilv_port_is_a(mPlug, port, node_InputPort))
622 {
623 isInput = true;
624 }
625 else if (lilv_port_is_a(mPlug, port, node_OutputPort))
626 {
627 isInput = false;
628 }
629 else
630 {
631 assert(false);
632 return false;
633 }
634
635 // Get the port name and symbol
636 wxString symbol = LilvString(lilv_port_get_symbol(mPlug, port));
637 wxString name = LilvString(lilv_port_get_name(mPlug, port), true);
638
639 // Get the group to which this port belongs or default to the main group
640 TranslatableString groupName{};
641 if (auto group = lilv_port_get(mPlug, port, node_Group)) {
642 auto groupMsg = LilvString(lilv_world_get(
643 gWorld, group, node_Label, NULL), true);
644 if (groupMsg.empty())
645 groupMsg = LilvString(lilv_world_get(
646 gWorld, group, node_Name, NULL), true);
647 if (groupMsg.empty())
648 groupMsg = LilvString(group);
649 groupName = Verbatim(groupMsg);
650 lilv_node_free(group);
651 }
652 else
653 groupName = XO("Effect Settings");
654
655 // Get the latency port
656 uint32_t latencyIndex = lilv_plugin_get_latency_port_index(mPlug);
657
658 // Get the ports designation (must be freed)
659 LilvNode *designation = lilv_port_get(mPlug, port, node_Designation);
660
661 // Check for audio ports
662 if (lilv_port_is_a(mPlug, port, node_AudioPort))
663 {
664 mAudioPorts.push_back(std::make_shared<LV2AudioPort>(port, index, isInput, symbol, name, groupName));
665
666 isInput ? mAudioIn++ : mAudioOut++;
667 }
668 // Check for Control ports
669 else if (lilv_port_is_a(mPlug, port, node_ControlPort))
670 {
671 // Add group if not previously done
672 if (mGroupMap.find(groupName) == mGroupMap.end())
673 {
674 mGroups.push_back(groupName);
675 }
676 mGroupMap[groupName].push_back(mControlPorts.size());
677
678 mControlPorts.push_back(std::make_shared<LV2ControlPort>(port, index, isInput, symbol, name, groupName));
679 LV2ControlPortPtr controlPort = mControlPorts.back();
680
681 // Get any unit descriptor
682 LilvNode *unit = lilv_port_get(mPlug, port, node_Unit);
683 if (unit)
684 {
685 // Really should use lilv_world_get_symbol()
686 LilvNode *symbol = lilv_world_get_symbol(gWorld, unit);
687 if (symbol)
688 {
689 controlPort->mUnits = LilvString(symbol);
690 lilv_node_free(symbol);
691 }
692 lilv_node_free(unit);
693 }
694
695 // Get the scale points
696 LilvScalePoints *points = lilv_port_get_scale_points(mPlug, port);
697 LILV_FOREACH(scale_points, j, points)
698 {
699 const LilvScalePoint *point = lilv_scale_points_get(points, j);
700
701 controlPort->mScaleValues.push_back(lilv_node_as_float(lilv_scale_point_get_value(point)));
702 controlPort->mScaleLabels.push_back(LilvString(lilv_scale_point_get_label(point)));
703 }
704 lilv_scale_points_free(points);
705
706 // Collect the value and range info
707 controlPort->mHasLo = !std::isnan(minimumVals[i]);
708 controlPort->mHasHi = !std::isnan(maximumVals[i]);
709 controlPort->mMin = controlPort->mHasLo ? minimumVals[i] : 0.0;
710 controlPort->mMax = controlPort->mHasHi ? maximumVals[i] : 1.0;
711 controlPort->mLo = controlPort->mMin;
712 controlPort->mHi = controlPort->mMax;
713 controlPort->mDef = !std::isnan(defaultVals[i])
714 ? defaultVals[i]
715 : controlPort->mHasLo
716 ? controlPort->mLo
717 : controlPort->mHasHi
718 ? controlPort->mHi
719 : 0.0;
720 controlPort->mVal = controlPort->mDef;
721 controlPort->mLst = controlPort->mVal;
722
723 // Figure out the type of port we have
724 if (isInput)
725 {
726 if (lilv_port_has_property(mPlug, port, node_Toggled))
727 {
728 controlPort->mToggle = true;
729 }
730 else if (lilv_port_has_property(mPlug, port, node_Enumeration))
731 {
732 controlPort->mEnumeration = true;
733 }
734 else if (lilv_port_has_property(mPlug, port, node_Integer))
735 {
736 controlPort->mInteger = true;
737 }
738 else if (lilv_port_has_property(mPlug, port, node_SampleRate))
739 {
740 controlPort->mSampleRate = true;
741 }
742
743 // Trigger properties can be combined with other types, but it
744 // seems mostly to be combined with toggle. So, we turn the
745 // checkbox into a button.
746 if (lilv_port_has_property(mPlug, port, node_Trigger))
747 {
748 controlPort->mTrigger = true;
749 }
750
751 // We'll make the slider logarithmic
752 if (lilv_port_has_property(mPlug, port, node_Logarithmic))
753 {
754 controlPort->mLogarithmic = true;
755 }
756
757 if (lilv_port_has_property(mPlug, port, node_Enumeration))
758 {
759 controlPort->mEnumeration = true;
760 }
761
762 mControlPortMap[controlPort->mIndex] = controlPort;
763 }
764 else
765 {
766 if (controlPort->mIndex == latencyIndex)
767 {
768 mLatencyPort = i;
769 }
770 }
771 }
772 // Check for atom ports
773 else if (lilv_port_is_a(mPlug, port, node_AtomPort))
774 {
775 mAtomPorts.push_back(std::make_shared<LV2AtomPort>(port, index, isInput, symbol, name, groupName));
776 std::shared_ptr<LV2AtomPort> atomPort = mAtomPorts.back();
777
778 atomPort->mMinimumSize = 8192;
779 LilvNode *min = lilv_port_get(mPlug, port, node_MinimumSize);
780 if (min)
781 {
782 if (lilv_node_is_int(min))
783 {
784 uint32_t val = lilv_node_as_int(min);
785 if (atomPort->mMinimumSize < val)
786 {
787 atomPort->mMinimumSize = val;
788 }
789 }
790 lilv_node_free(min);
791 }
792
793 atomPort->mBuffer.resize(atomPort->mMinimumSize);
794 atomPort->mRing = zix_ring_new(atomPort->mMinimumSize);
795 zix_ring_mlock(atomPort->mRing);
796
797 if (lilv_port_supports_event(mPlug, port, node_Position))
798 {
799 atomPort->mWantsPosition = true;
800 }
801
802 if (lilv_port_supports_event(mPlug, port, node_MidiEvent))
803 {
804 atomPort->mIsMidi = true;
805 (isInput ? mMidiIn : mMidiOut) += 1;
806 }
807
808 bool isControl = lilv_node_equals(designation, node_Control);
809 if (isInput)
810 {
811 if (!mControlIn || isControl)
812 {
813 mControlIn = atomPort;
814 }
815 }
816 else
817 {
818 if (!mControlOut || isControl)
819 {
820 mControlOut = atomPort;
821 }
822 }
823 }
824 // Check for CV ports
825 else if (lilv_port_is_a(mPlug, port, node_CVPort))
826 {
827 mCVPorts.push_back(std::make_shared<LV2CVPort>(port, index, isInput, symbol, name, groupName));
828 std::shared_ptr<LV2CVPort> cvPort = mCVPorts.back();
829
830 // Collect the value and range info
831 if (!std::isnan(minimumVals[i]))
832 {
833 cvPort->mHasLo = true;
834 cvPort->mMin = minimumVals[i];
835 }
836
837 if (!std::isnan(maximumVals[i]))
838 {
839 cvPort->mHasHi = true;
840 cvPort->mMax = maximumVals[i];
841 }
842
843 if (!std::isnan(defaultVals[i]))
844 {
845 cvPort->mDef = defaultVals[i];
846 }
847 else if (cvPort->mHasLo)
848 {
849 cvPort->mDef = cvPort->mMin;
850 }
851 else if (cvPort->mHasHi)
852 {
853 cvPort->mDef = cvPort->mMax;
854 }
855 }
856
857 // Free the designation node
858 if (designation)
859 {
860 lilv_node_free(designation);
861 }
862 }
863
864 // Ignore control designation if one of them is missing
865 if ((mControlIn && !mControlOut) || (!mControlIn && mControlOut))
866 {
867 mControlIn.reset();
868 mControlOut.reset();
869 }
870
871 // Determine available extensions
873 mWantsWorkerInterface = false;
874 mWantsStateInterface = false;
875
876 LilvNodes *extdata = lilv_plugin_get_extension_data(mPlug);
877 if (extdata)
878 {
879 LILV_FOREACH(nodes, i, extdata)
880 {
881 const LilvNode *node = lilv_nodes_get(extdata, i);
882 const char *uri = lilv_node_as_string(node);
883
884 if (strcmp(uri, LV2_OPTIONS__interface) == 0)
885 {
887 }
888 else if (strcmp(uri, LV2_WORKER__interface) == 0)
889 {
891 }
892 else if (strcmp(uri, LV2_STATE__interface) == 0)
893 {
895 }
896 }
897 lilv_nodes_free(extdata);
898 }
899
900 return true;
901}
std::shared_ptr< LV2ControlPort > LV2ControlPortPtr
Definition: LV2Effect.h:245
#define LV2_UI__makeResident
Definition: LV2Symbols.h:42
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
LV2AudioPortArray mAudioPorts
Definition: LV2Effect.h:452
static void ui_closed(LV2UI_Controller controller)
Definition: LV2Effect.cpp:2994
size_t mSampleRateOption
Definition: LV2Effect.h:520
LV2AtomPortArray mAtomPorts
Definition: LV2Effect.h:456
bool ValidateOptions(const LilvNode *subject)
Definition: LV2Effect.cpp:1858
size_t AddOption(LV2_URID, uint32_t size, LV2_URID, const void *value)
Definition: LV2Effect.cpp:1759
LV2_URID_Unmap mURIDUnmapFeature
Definition: LV2Effect.h:507
static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char *uri)
Definition: LV2Effect.cpp:2854
LV2CVPortArray mCVPorts
Definition: LV2Effect.h:462
static uint32_t uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char *map, const char *uri)
Definition: LV2Effect.cpp:2846
bool mWantsStateInterface
Definition: LV2Effect.h:470
LV2_URI_Map_Feature mUriMapFeature
Definition: LV2Effect.h:505
static const char * urid_unmap(LV2_URID_Unmap_Handle handle, LV2_URID urid)
Definition: LV2Effect.cpp:2880
LV2UI_Resize mUIResizeFeature
Definition: LV2Effect.h:508
static int ui_resize(LV2UI_Feature_Handle handle, int width, int height)
Definition: LV2Effect.cpp:2970
bool mWantsOptionsInterface
Definition: LV2Effect.h:469
static int log_vprintf(LV2_Log_Handle handle, LV2_URID type, const char *fmt, va_list ap)
Definition: LV2Effect.cpp:2920
std::unordered_map< uint32_t, LV2ControlPortPtr > mControlPortMap
Definition: LV2Effect.h:449
LV2_Feature * AddFeature(const char *uri, void *data)
Definition: LV2Effect.cpp:1779
bool mWantsWorkerInterface
Definition: LV2Effect.h:471
size_t mBlockSizeOption
Definition: LV2Effect.h:519
LV2_Log_Log mLogFeature
Definition: LV2Effect.h:509
static int log_printf(LV2_Log_Handle handle, LV2_URID type, const char *fmt,...)
Definition: LV2Effect.cpp:2907
ZixRing * zix_ring_new(uint32_t size)
Definition: ring.cpp:74
void zix_ring_mlock(ZixRing *ring)
Definition: ring.cpp:93
#define LV2_EXTERNAL_UI_DEPRECATED_URI
#define LV2_EXTERNAL_UI__Host
void(* ui_closed)(LV2UI_Controller controller)

References AddFeature(), AddOption(), LV2Symbols::gWorld, LilvString(), log_printf(), log_vprintf(), LV2_EXTERNAL_UI__Host, LV2_EXTERNAL_UI__Widget, LV2_EXTERNAL_UI_DEPRECATED_URI, LV2_UI__makeResident, mAtomPorts, mAudioIn, mAudioOut, mAudioPorts, mBlockSize, mBlockSizeOption, mControlIn, mControlOut, mControlPortMap, mControlPorts, mCVPorts, mExtensionDataFeature, mExternalUIHost, mGroupMap, mGroups, min(), mInstanceAccessFeature, mLatencyPort, mLogFeature, mMaxBlockSize, mMidiIn, mMidiOut, mMinBlockSize, mOptions, mParentFeature, mPlug, mSampleRate, mSampleRateOption, mSeqSize, mUIResizeFeature, mURIDMapFeature, mURIDUnmapFeature, mUriMapFeature, mWantsOptionsInterface, mWantsStateInterface, mWantsWorkerInterface, name, _LV2_External_UI_Host::plugin_human_id, ui_closed(), _LV2_External_UI_Host::ui_closed, ui_resize(), uri_to_id(), urid_map(), urid_unmap(), ValidateFeatures(), ValidateOptions(), Verbatim(), XO, zix_ring_mlock(), and zix_ring_new().

Referenced by LV2EffectsModule::DiscoverPluginsAtPath().

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

◆ InitInstance()

LV2Wrapper * LV2Effect::InitInstance ( float  sampleRate)
private

Definition at line 1921 of file LV2Effect.cpp.

1922{
1923 LV2Wrapper *wrapper = new LV2Wrapper(this);
1924 if (wrapper == NULL)
1925 {
1926 return NULL;
1927 }
1928
1929 LilvInstance *instance = wrapper->Instantiate(mPlug, sampleRate, mFeatures);
1930 if (!instance)
1931 {
1932 delete wrapper;
1933 return NULL;
1934 }
1935
1936 wrapper->SetBlockSize();
1937 wrapper->SetSampleRate();
1938
1939 // Connect all control ports
1940 for (auto & port : mControlPorts)
1941 {
1942 // If it's not an input port and master has already been created
1943 // then connect the port to a dummy field since slave output port
1944 // values are unwanted as the master values will be used.
1945 //
1946 // Otherwise, connect it to the real value field.
1947 lilv_instance_connect_port(instance,
1948 port->mIndex,
1949 !port->mIsInput && mMaster
1950 ? &port->mDmy
1951 : &port->mVal);
1952 }
1953
1954 // Connect all atom ports
1955 for (auto & port : mAtomPorts)
1956 {
1957 lilv_instance_connect_port(instance, port->mIndex, port->mBuffer.data());
1958 }
1959
1960 // We don't fully support CV ports, so connect them to dummy buffers for now.
1961 for (auto & port : mCVPorts)
1962 {
1963 lilv_instance_connect_port(instance, port->mIndex, port->mBuffer.get());
1964 }
1965
1966 // Give plugin a chance to initialize. The SWH plugins (like AllPass) need
1967 // this before it can be safely deleted.
1968 lilv_instance_activate(instance);
1969 lilv_instance_deactivate(instance);
1970
1971 for (auto & port : mAtomPorts)
1972 {
1973 if (!port->mIsInput)
1974 {
1975 ZixRing *ring = port->mRing;
1976
1977 LV2_ATOM_SEQUENCE_FOREACH(( LV2_Atom_Sequence *) port->mBuffer.data(), ev)
1978 {
1979 zix_ring_write(ring, &ev->body, ev->body.size + sizeof(LV2_Atom));
1980 }
1981 }
1982 }
1983
1984 return wrapper;
1985}
friend class LV2Wrapper
Definition: LV2Effect.h:555
void SetSampleRate()
Definition: LV2Effect.cpp:3318
void SetBlockSize()
Definition: LV2Effect.cpp:3332
LilvInstance * Instantiate(const LilvPlugin *plugin, double sampleRrate, std::vector< std::unique_ptr< LV2_Feature > > &features)
Definition: LV2Effect.cpp:3218
uint32_t zix_ring_write(ZixRing *ring, const void *src, uint32_t size)
Definition: ring.cpp:201

References LV2Wrapper::Instantiate(), LV2Wrapper, mAtomPorts, mControlPorts, mCVPorts, mFeatures, mMaster, mPlug, LV2Wrapper::SetBlockSize(), LV2Wrapper::SetSampleRate(), ZixRingImpl::size, and zix_ring_write().

Referenced by PopulateUI(), ProcessInitialize(), and RealtimeAddProcessor().

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

◆ IsDefault()

bool LV2Effect::IsDefault ( ) const
overridevirtual

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

Reimplemented from Effect.

Definition at line 477 of file LV2Effect.cpp.

478{
479 return false;
480}

◆ IsGraphicalUI()

bool LV2Effect::IsGraphicalUI ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1530 of file LV2Effect.cpp.

1531{
1532 return mUseGUI;
1533}

References mUseGUI.

◆ IsInteractive()

bool LV2Effect::IsInteractive ( ) const
overridevirtual

Whether the effect needs a dialog for entry of settings.

Reimplemented from Effect.

Definition at line 472 of file LV2Effect.cpp.

473{
474 return mControlPorts.size() != 0;
475}

References mControlPorts.

◆ LoadFactoryPreset()

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

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

Reimplemented from Effect.

Definition at line 1653 of file LV2Effect.cpp.

1654{
1655 // To do: externalize state so const_cast isn't needed
1656 return const_cast<LV2Effect*>(this)->DoLoadFactoryPreset(id);
1657}
bool DoLoadFactoryPreset(int id)
Definition: LV2Effect.cpp:1659

References DoLoadFactoryPreset().

Here is the call graph for this function:

◆ LoadParameters()

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

Definition at line 1725 of file LV2Effect.cpp.

1727{
1728 wxString parms;
1729 if (!GetConfig(*this,
1730 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
1731 {
1732 return false;
1733 }
1734
1736 if (!eap.SetParameters(parms))
1737 {
1738 return false;
1739 }
1740
1741 return LoadSettings(eap, settings);
1742}
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the SettingsVis...
bool SetParameters(const wxString &parms)
bool LoadSettings(const CommandParameters &parms, EffectSettings &settings) const override
Restore settings from keys and values.
Definition: LV2Effect.cpp:1440

References PluginSettings::GetConfig(), LoadSettings(), PluginSettings::Private, CommandParameters::SetParameters(), and settings().

Referenced by DoLoadUserPreset().

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

◆ LoadSettings()

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

Restore settings from keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 1440 of file LV2Effect.cpp.

1442{
1443 // First pass validates values
1444 for (auto & port : mControlPorts)
1445 {
1446 if (port->mIsInput)
1447 {
1448 double d = 0.0;
1449 if (!parms.Read(port->mName, &d))
1450 {
1451 return false;
1452 }
1453
1454 // Use unscaled range here
1455 if (d < port->mMin || d > port->mMax)
1456 {
1457 return false;
1458 }
1459 }
1460 }
1461
1462 // Second pass actually sets the values
1463 for (auto & port : mControlPorts)
1464 {
1465 if (port->mIsInput)
1466 {
1467 double d = 0.0;
1468 if (!parms.Read(port->mName, &d))
1469 {
1470 return false;
1471 }
1472
1473 port->mVal = d;
1474 port->mTmp = port->mVal * (port->mSampleRate ? mSampleRate : 1.0);
1475 }
1476 }
1477
1478 return true;
1479}

References mControlPorts, and mSampleRate.

Referenced by LoadParameters().

Here is the caller graph for this function:

◆ LoadUserPreset()

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

Change settings to a user-named preset.

Reimplemented from Effect.

Definition at line 1587 of file LV2Effect.cpp.

1589{
1590 // To do: externalize state so const_cast isn't needed
1591 return const_cast<LV2Effect*>(this)->DoLoadUserPreset(name, settings);
1592}
bool DoLoadUserPreset(const RegistryPath &name, EffectSettings &settings)
Definition: LV2Effect.cpp:1594

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

Here is the call graph for this function:

◆ log_printf()

int LV2Effect::log_printf ( LV2_Log_Handle  handle,
LV2_URID  type,
const char *  fmt,
  ... 
)
staticprivate

Definition at line 2907 of file LV2Effect.cpp.

2908{
2909 va_list ap;
2910 int len;
2911
2912 va_start(ap, fmt);
2913 len = ((LV2Effect *) handle)->LogVPrintf(type, fmt, ap);
2914 va_end(ap);
2915
2916 return len;
2917}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ log_vprintf()

int LV2Effect::log_vprintf ( LV2_Log_Handle  handle,
LV2_URID  type,
const char *  fmt,
va_list  ap 
)
staticprivate

Definition at line 2920 of file LV2Effect.cpp.

2921{
2922 return ((LV2Effect *) handle)->LogVPrintf(type, fmt, ap);
2923}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ LogVPrintf()

int LV2Effect::LogVPrintf ( LV2_URID  type,
const char *  fmt,
va_list  ap 
)
private

Definition at line 2925 of file LV2Effect.cpp.

2926{
2927 using namespace LV2Symbols;
2928 long level = wxLOG_Error;
2929
2930 if (type == urid_Error)
2931 {
2932 level = wxLOG_Error;
2933 }
2934 else if (type == urid_Note)
2935 {
2936 level = wxLOG_Info;
2937 }
2938 else if (type == urid_Trace)
2939 {
2940 level = wxLOG_Trace;
2941 }
2942 else if (type == urid_Warning)
2943 {
2944 level = wxLOG_Warning;
2945 }
2946 else
2947 {
2948 level = wxLOG_Message;
2949 }
2950
2951 char *msg = NULL;
2952 int len = wxCRT_VsnprintfA(msg, 0, fmt, ap);
2953
2954 msg = (char *) malloc(len + 1);
2955 if (msg)
2956 {
2957 wxCRT_VsnprintfA(msg, len, fmt, ap);
2958
2959 wxString text(msg);
2960
2961 wxLogGeneric(level, wxT("%s: %s"), GetSymbol().Msgid().Translation(), text);
2962
2963 free(msg);
2964 }
2965
2966 return len;
2967}
ComponentInterfaceSymbol GetSymbol() const override
Definition: LV2Effect.cpp:416

References GetSymbol().

Here is the call graph for this function:

◆ MakeInstance()

std::shared_ptr< EffectInstance > LV2Effect::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

Implements EffectInstanceFactory.

Definition at line 903 of file LV2Effect.cpp.

904{
905 return const_cast<LV2Effect*>(this)->DoMakeInstance();
906}
std::shared_ptr< EffectInstance > DoMakeInstance()
Definition: LV2Effect.cpp:908

References DoMakeInstance().

Here is the call graph for this function:

◆ OnChoice()

void LV2Effect::OnChoice ( wxCommandEvent &  evt)
private

Definition at line 2649 of file LV2Effect.cpp.

2650{
2651 auto & port = mControlPorts[evt.GetId() - ID_Choices];
2652
2653 port->mVal = port->mScaleValues[evt.GetInt()];
2654}

References ID_Choices, and mControlPorts.

◆ OnIdle()

void LV2Effect::OnIdle ( wxIdleEvent &  evt)
private

Definition at line 2702 of file LV2Effect.cpp.

2703{
2704 evt.Skip();
2705
2706 if (!mSuilInstance)
2707 {
2708 return;
2709 }
2710
2712 {
2713 mExternalUIClosed = false;
2714 mDialog->Close();
2715 return;
2716 }
2717
2718 if (mUIIdleInterface)
2719 {
2720 SuilHandle handle = suil_instance_get_handle(mSuilInstance);
2721 if (mUIIdleInterface->idle(handle))
2722 {
2723 if (mUIShowInterface)
2724 {
2725 mUIShowInterface->hide(handle);
2726 }
2727 mDialog->Close();
2728 return;
2729 }
2730 }
2731
2732 if (mControlOut)
2733 {
2734 ZixRing *ring = mControlOut->mRing;
2735
2736 LV2_Atom *atom = (LV2_Atom *) malloc(mControlOut->mMinimumSize);
2737 if (atom)
2738 {
2739 while (zix_ring_read(ring, atom, sizeof(LV2_Atom)))
2740 {
2741 uint32_t size = lv2_atom_total_size(atom);
2742
2743 if (size < mControlOut->mMinimumSize)
2744 {
2745 zix_ring_read(ring, LV2_ATOM_CONTENTS(LV2_Atom, atom), atom->size);
2746 suil_instance_port_event(mSuilInstance,
2747 mControlOut->mIndex,
2748 size,
2749 LV2Symbols::urid_EventTransfer,
2750 atom);
2751 }
2752 else
2753 {
2754 zix_ring_skip(ring, atom->size);
2755 wxLogError(wxT("LV2 sequence buffer overflow"));
2756 }
2757 }
2758 free(atom);
2759 }
2760 }
2761
2762 for (auto & port : mControlPorts)
2763 {
2764 // Let UI know that a port's value has changed
2765 if (port->mVal != port->mLst)
2766 {
2767 suil_instance_port_event(mSuilInstance,
2768 port->mIndex,
2769 sizeof(port->mVal),
2770 0,
2771 &port->mVal);
2772 port->mLst = port->mVal;
2773 }
2774 }
2775}
uint32_t zix_ring_read(ZixRing *ring, void *dst, uint32_t size)
Definition: ring.cpp:172
uint32_t zix_ring_skip(ZixRing *ring, uint32_t size)
Definition: ring.cpp:187

References mControlOut, mControlPorts, mDialog, mExternalUIClosed, mSuilInstance, mUIIdleInterface, mUIShowInterface, size, ZixRingImpl::size, zix_ring_read(), and zix_ring_skip().

Here is the call graph for this function:

◆ OnSize()

void LV2Effect::OnSize ( wxSizeEvent &  evt)
private

Definition at line 2777 of file LV2Effect.cpp.

2778{
2779 evt.Skip();
2780
2781 // Don't do anything here if we're recursing
2782 if (mResizing)
2783 {
2784 return;
2785 }
2786
2787 // Indicate resizing is occurring
2788 mResizing = true;
2789
2790 // Can only resize AFTER the dialog has been completely created and
2791 // there's no need to resize if we're already at the desired size.
2792 if (mDialog && evt.GetSize() != mNativeWinLastSize)
2793 {
2794 // Save the desired size and set the native window to match
2795 mNativeWinLastSize = evt.GetSize();
2796 mNativeWin->SetMinSize(mNativeWinLastSize);
2797
2798 // Clear the minimum size of the parent window to allow the following
2799 // Fit() to make proper adjustments
2800 mParent->SetMinSize(wxDefaultSize);
2801
2802#if defined(__WXGTK__)
2803 // If the user resized the native window, then we need to also
2804 // clear the dialogs minimum size. If this isn't done, the dialog
2805 // will not resize properly when going from a larger size to a smaller
2806 // size (due to the minimum size constraint).
2807 //
2808 // In this case, mResized has been set by the "size_request()" function
2809 // to indicate that this is a plugin generated resize request.
2810 if (mResized)
2811 {
2812 mDialog->SetMinSize(wxDefaultSize);
2813 }
2814
2815 // Resize dialog
2816 mDialog->Fit();
2817
2818 // Reestablish the minimum (and maximum) now that the dialog
2819 // has is desired size.
2820 if (mResized)
2821 {
2822 mDialog->SetMinSize(mDialog->GetSize());
2823 if (mNoResize)
2824 {
2825 mDialog->SetMaxSize(mDialog->GetSize());
2826 }
2827 }
2828
2829 // Tell size_request() that the native window was just resized.
2830 mResized = true;
2831#else
2832 // Resize the dialog to fit its content.
2833 mDialog->Fit();
2834#endif
2835 }
2836
2837 // No longer resizing
2838 mResizing = false;
2839}

References mDialog, mNativeWin, mNativeWinLastSize, mNoResize, mParent, mResized, and mResizing.

Referenced by BuildFancy().

Here is the caller graph for this function:

◆ OnSizeWindow()

void LV2Effect::OnSizeWindow ( wxCommandEvent &  evt)
private

◆ OnSlider()

void LV2Effect::OnSlider ( wxCommandEvent &  evt)
private

Definition at line 2668 of file LV2Effect.cpp.

2669{
2670 auto & port = mControlPorts[evt.GetId() - ID_Sliders];
2671
2672 float lo = port->mLo;
2673 float hi = port->mHi;
2674
2675 if (port->mLogarithmic)
2676 {
2677 lo = logf(lo);
2678 hi = logf(hi);
2679 }
2680
2681 port->mTmp = (((float) evt.GetInt()) / 1000.0) * (hi - lo) + lo;
2682 port->mTmp = port->mLogarithmic ? expf(port->mTmp) : port->mTmp;
2683
2684 port->mTmp = port->mTmp < port->mLo ? port->mLo : port->mTmp;
2685 port->mTmp = port->mTmp > port->mHi ? port->mHi : port->mTmp;
2686
2687 port->mVal = port->mSampleRate ? port->mTmp / mSampleRate : port->mTmp;
2688
2689 port->mText->GetValidator()->TransferToWindow();
2690}

References ID_Sliders, mControlPorts, and mSampleRate.

◆ OnText()

void LV2Effect::OnText ( wxCommandEvent &  evt)
private

Definition at line 2656 of file LV2Effect.cpp.

2657{
2658 auto & port = mControlPorts[evt.GetId() - ID_Texts];
2659
2660 if (port->mText->GetValidator()->TransferFromWindow())
2661 {
2662 port->mVal = port->mSampleRate ? port->mTmp / mSampleRate : port->mTmp;
2663
2664 SetSlider(port);
2665 }
2666}
void SetSlider(const LV2ControlPortPtr &port)
Definition: LV2Effect.cpp:2619

References ID_Texts, mControlPorts, mSampleRate, and SetSlider().

Here is the call graph for this function:

◆ OnTimer()

void LV2Effect::OnTimer ( wxTimerEvent &  evt)
private

Definition at line 2692 of file LV2Effect.cpp.

2693{
2694 evt.Skip();
2695
2696 if (mExternalWidget)
2697 {
2699 }
2700}
#define LV2_EXTERNAL_UI_RUN(ptr)

References LV2_EXTERNAL_UI_RUN, and mExternalWidget.

◆ OnToggle()

void LV2Effect::OnToggle ( wxCommandEvent &  evt)
private

Definition at line 2642 of file LV2Effect.cpp.

2643{
2644 auto & port = mControlPorts[evt.GetId() - ID_Toggles];
2645
2646 port->mVal = evt.GetInt() ? 1.0 : 0.0;
2647}

References ID_Toggles, and mControlPorts.

◆ OnTrigger()

void LV2Effect::OnTrigger ( wxCommandEvent &  evt)
private

Definition at line 2635 of file LV2Effect.cpp.

2636{
2637 auto & port = mControlPorts[evt.GetId() - ID_Triggers];
2638
2639 port->mVal = port->mDef;
2640}

References ID_Triggers, and mControlPorts.

◆ PopulateUI()

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

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

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

Reimplemented from Effect.

Definition at line 1485 of file LV2Effect.cpp.

1487{
1488 auto parent = S.GetParent();
1489 mParent = parent;
1490
1491 mParent->PushEventHandler(this);
1492
1493 mSuilHost = NULL;
1494 mSuilInstance = NULL;
1495
1497 if (mMaster == NULL)
1498 {
1499 AudacityMessageBox( XO("Couldn't instantiate effect") );
1500 return nullptr;
1501 }
1502
1503 // Determine if the GUI editor is supposed to be used or not
1504 GetConfig(*this, PluginSettings::Shared, wxT("Settings"),
1505 wxT("UseGUI"),
1506 mUseGUI,
1507 true);
1508
1509 // Until I figure out where to put the "Duration" control in the
1510 // graphical editor, force usage of plain editor.
1511 if (GetType() == EffectTypeGenerate)
1512 {
1513 mUseGUI = false;
1514 }
1515
1516 if (mUseGUI)
1517 {
1518 mUseGUI = BuildFancy();
1519 }
1520
1521 if (!mUseGUI)
1522 {
1523 if (!BuildPlain(access))
1524 return nullptr;
1525 }
1526
1527 return std::make_unique<DefaultEffectUIValidator>(*this, access);
1528}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
#define S(N)
Definition: ToChars.cpp:64
LV2Wrapper * InitInstance(float sampleRate)
Definition: LV2Effect.cpp:1921
bool BuildFancy()
Definition: LV2Effect.cpp:1992
bool BuildPlain(EffectSettingsAccess &access)
Definition: LV2Effect.cpp:2236

References AudacityMessageBox(), BuildFancy(), BuildPlain(), EffectTypeGenerate, PluginSettings::GetConfig(), GetType(), InitInstance(), mMaster, mParent, mSampleRate, mSuilHost, mSuilInstance, mUseGUI, S, PluginSettings::Shared, and XO.

Here is the call graph for this function:

◆ ProcessBlock()

size_t LV2Effect::ProcessBlock ( EffectSettings settings,
const float *const *  inBlock,
float *const *  outBlock,
size_t  blockLen 
)
overridevirtual

Called for destructive effect computation.

Reimplemented from StatefulPerTrackEffect.

Definition at line 1036 of file LV2Effect.cpp.

1038{
1039 using namespace LV2Symbols;
1040 wxASSERT(size <= ( size_t) mBlockSize);
1041
1042 LilvInstance *instance = mProcess->GetInstance();
1043
1044 int i = 0;
1045 int o = 0;
1046 for (auto & port : mAudioPorts)
1047 {
1048 lilv_instance_connect_port(instance,
1049 port->mIndex,
1050 const_cast<float*>(port->mIsInput ? inbuf[i++] : outbuf[o++]));
1051 }
1052
1053 // Transfer incoming events from the ring buffer to the event buffer for each
1054 // atom input port. These will be made available to each slave in the chain and
1055 // to the master once all slaves have run.
1056 //
1057 // In addition, reset the output Atom ports.
1058 for (auto & port : mAtomPorts)
1059 {
1060 uint8_t *buf = port->mBuffer.data();
1061
1062 if (port->mIsInput)
1063 {
1064 lv2_atom_forge_set_buffer(&mForge,
1065 buf,
1066 port->mBuffer.size());
1067
1068 LV2_Atom_Forge_Frame seqFrame;
1069 LV2_Atom_Sequence *seq = ( LV2_Atom_Sequence *)
1070 lv2_atom_forge_sequence_head(&mForge, &seqFrame, 0);
1071
1072 if (port->mWantsPosition)
1073 {
1074 lv2_atom_forge_frame_time(&mForge, mPositionFrame);
1075
1076 LV2_Atom_Forge_Frame posFrame;
1077 lv2_atom_forge_object(&mForge, &posFrame, 0, urid_Position);
1078 lv2_atom_forge_key(&mForge, urid_Speed);
1079 lv2_atom_forge_float(&mForge, mPositionSpeed);
1080 lv2_atom_forge_key(&mForge, urid_Frame);
1081 lv2_atom_forge_long(&mForge, mPositionFrame);
1082 lv2_atom_forge_pop(&mForge, &posFrame);
1083 }
1084
1085 ZixRing *ring = port->mRing;
1086 LV2_Atom atom;
1087 while (zix_ring_read(ring, &atom, sizeof(atom)))
1088 {
1089 if (mForge.offset + sizeof(LV2_Atom_Event) + atom.size < mForge.size)
1090 {
1091 lv2_atom_forge_frame_time(&mForge, mPositionFrame);
1092
1093 lv2_atom_forge_write(&mForge, &atom, sizeof(atom));
1094 zix_ring_read(ring, &mForge.buf[mForge.offset], atom.size);
1095 mForge.offset += atom.size;
1096 seq->atom.size += atom.size;
1097 }
1098 else
1099 {
1100 zix_ring_skip(ring, atom.size);
1101 wxLogError(wxT("LV2 sequence buffer overflow"));
1102 }
1103 }
1104
1105 lv2_atom_forge_pop(&mForge, &seqFrame);
1106 }
1107 else
1108 {
1109 port->mBuffer.resize(port->mMinimumSize);
1110 *(( LV2_Atom *) buf) =
1111 {
1112 port->mMinimumSize,
1113 urid_Chunk
1114 };
1115 }
1116 }
1117
1118 lilv_instance_run(instance, size);
1119
1121
1122 for (auto & port : mAtomPorts)
1123 {
1124 if (!port->mIsInput)
1125 {
1126 port->mBuffer.resize(port->mMinimumSize);
1127
1128 LV2_Atom *chunk = ( LV2_Atom *) port->mBuffer.data();
1129 chunk->size = port->mMinimumSize;
1130 chunk->type = urid_Chunk;
1131 }
1132 }
1133
1134 return size;
1135}
void SendResponses()
Definition: LV2Effect.cpp:3370

References LV2Wrapper::GetInstance(), mAtomPorts, mAudioPorts, mBlockSize, mForge, mPositionFrame, mPositionSpeed, mProcess, LV2Wrapper::SendResponses(), size, ZixRingImpl::size, zix_ring_read(), and zix_ring_skip().

Here is the call graph for this function:

◆ ProcessFinalize()

bool LV2Effect::ProcessFinalize ( void  )
overridevirtual

Called at end of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true This may be called during stack unwinding:

Reimplemented from StatefulPerTrackEffect.

Definition at line 1025 of file LV2Effect.cpp.

1026{
1027 if (mProcess)
1028 {
1030 mProcess = NULL;
1031 }
1032
1033 return true;
1034}

References FreeInstance(), and mProcess.

Here is the call graph for this function:

◆ ProcessInitialize()

bool LV2Effect::ProcessInitialize ( EffectSettings settings,
sampleCount  totalLen,
ChannelNames  chanMap 
)
overridevirtual

Called at start of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true

Reimplemented from StatefulPerTrackEffect.

Definition at line 1003 of file LV2Effect.cpp.

1005{
1007 if (!mProcess)
1008 {
1009 return false;
1010 }
1011
1012 for (auto & port : mCVPorts)
1013 {
1014 port->mBuffer.reinit((unsigned) mBlockSize, port->mIsInput);
1015 }
1016
1017 lilv_instance_activate(mProcess->GetInstance());
1018 mActivated = true;
1019
1020 mLatencyDone = false;
1021
1022 return true;
1023}

References LV2Wrapper::GetInstance(), InitInstance(), mActivated, mBlockSize, mCVPorts, mLatencyDone, mProcess, and mSampleRate.

Here is the call graph for this function:

◆ RealtimeAddProcessor()

bool LV2Effect::RealtimeAddProcessor ( EffectSettings settings,
unsigned  numChannels,
float  sampleRate 
)
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 1176 of file LV2Effect.cpp.

1178{
1179 LV2Wrapper *slave = InitInstance(sampleRate);
1180 if (!slave)
1181 {
1182 return false;
1183 }
1184
1185 mSlaves.push_back(slave);
1186
1187 lilv_instance_activate(slave->GetInstance());
1188 mActivated = true;
1189
1190 return true;
1191}
std::vector< LV2Wrapper * > mSlaves
Definition: LV2Effect.h:482

References LV2Wrapper::GetInstance(), InitInstance(), mActivated, and mSlaves.

Here is the call graph for this function:

◆ RealtimeFinalize()

bool LV2Effect::RealtimeFinalize ( EffectSettings settings)
overridevirtualnoexcept

Default implementation does nothing, returns false

Reimplemented from StatefulEffectBase.

Definition at line 1151 of file LV2Effect.cpp.

1152{
1153return GuardedCall<bool>([&]{
1154 for (auto & slave : mSlaves)
1155 {
1156 FreeInstance(slave);
1157 }
1158 mSlaves.clear();
1159
1160 if (mActivated)
1161 {
1162 lilv_instance_deactivate(mMaster->GetInstance());
1163 mActivated = false;
1164 }
1165
1166 for (auto & port : mCVPorts)
1167 {
1168 port->mBuffer.reset();
1169 }
1170
1171 mMasterIn.reset();
1172 return true;
1173});
1174}
FloatBuffers mMasterIn
Definition: LV2Effect.h:484

◆ RealtimeInitialize()

bool LV2Effect::RealtimeInitialize ( EffectSettings settings)
overridevirtual

Default implementation does nothing, returns false

Reimplemented from StatefulEffectBase.

Definition at line 1137 of file LV2Effect.cpp.

1138{
1139 mMasterIn.reinit(mAudioIn, (unsigned int) mBlockSize);
1140 for (auto & port : mCVPorts)
1141 {
1142 port->mBuffer.reinit((unsigned) mBlockSize, port->mIsInput);
1143 }
1144
1145 lilv_instance_activate(mMaster->GetInstance());
1146 mActivated = true;
1147
1148 return true;
1149}
void reinit(Integral count)
Definition: MemoryX.h:109

References LV2Wrapper::GetInstance(), mActivated, mAudioIn, mBlockSize, mCVPorts, mMaster, mMasterIn, and ArraysOf< X >::reinit().

Here is the call graph for this function:

◆ RealtimeProcess()

size_t LV2Effect::RealtimeProcess ( int  group,
EffectSettings settings,
const float *const *  inBuf,
float *const *  outBuf,
size_t  numSamples 
)
overridevirtual

Default implementation does nothing, returns 0

Reimplemented from StatefulEffectBase.

Definition at line 1299 of file LV2Effect.cpp.

1301{
1302 wxASSERT(group >= 0 && group < (int) mSlaves.size());
1303 wxASSERT(numSamples <= (size_t) mBlockSize);
1304
1305 if (group < 0 || group >= (int) mSlaves.size())
1306 {
1307 return 0;
1308 }
1309
1310 LV2Wrapper *slave = mSlaves[group];
1311 LilvInstance *instance = slave->GetInstance();
1312
1313 int i = 0;
1314 int o = 0;
1315 for (auto & port : mAudioPorts)
1316 {
1317 if (port->mIsInput)
1318 {
1319 for (decltype(numSamples) s = 0; s < numSamples; s++)
1320 {
1321 mMasterIn[i][s] += inbuf[i][s];
1322 }
1323 }
1324
1325 lilv_instance_connect_port(instance,
1326 port->mIndex,
1327 const_cast<float*>(port->mIsInput ? inbuf[i++] : outbuf[o++]));
1328 }
1329
1330 mNumSamples = wxMax(numSamples, mNumSamples);
1331
1332 if (mRolling)
1333 {
1334 lilv_instance_run(instance, numSamples);
1335 }
1336 else
1337 {
1338 while (--i >= 0)
1339 {
1340 for (decltype(numSamples) s = 0; s < numSamples; s++)
1341 {
1342 outbuf[i][s] = inbuf[i][s];
1343 }
1344 }
1345 }
1346
1347 slave->SendResponses();
1348
1349 for (auto & port : mAtomPorts)
1350 {
1351 uint8_t *buf = port->mBuffer.data();
1352
1353 if (!port->mIsInput)
1354 {
1355 port->mBuffer.resize(port->mMinimumSize);
1356
1357 LV2_Atom *chunk = ( LV2_Atom *) buf;
1358 chunk->size = port->mMinimumSize;
1359 chunk->type = LV2Symbols::urid_Chunk;
1360 }
1361 }
1362
1363 if (group == 0)
1364 {
1365 mPositionFrame += numSamples;
1366 }
1367
1368 return numSamples;
1369}
size_t mNumSamples
Definition: LV2Effect.h:485

References LV2Wrapper::GetInstance(), mAtomPorts, mAudioPorts, mBlockSize, mMasterIn, mNumSamples, mPositionFrame, mRolling, mSlaves, and LV2Wrapper::SendResponses().

Here is the call graph for this function:

◆ RealtimeProcessEnd()

bool LV2Effect::RealtimeProcessEnd ( EffectSettings settings)
overridevirtualnoexcept

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 1371 of file LV2Effect.cpp.

1372{
1373return GuardedCall<bool>([&]{
1374 // Nothing to do if we did process any samples
1375 if (mNumSamples == 0)
1376 {
1377 return true;
1378 }
1379
1380 for (auto & port : mAtomPorts)
1381 {
1382 if (!port->mIsInput)
1383 {
1384 ZixRing *ring = port->mRing;
1385
1386 LV2_ATOM_SEQUENCE_FOREACH((LV2_Atom_Sequence *) port->mBuffer.data(), ev)
1387 {
1388 zix_ring_write(ring, &ev->body, ev->body.size + sizeof(LV2_Atom));
1389 }
1390 }
1391 }
1392
1393 mNumSamples = 0;
1394
1395 return true;
1396});
1397}

◆ RealtimeProcessStart()

bool LV2Effect::RealtimeProcessStart ( EffectSettings settings)
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 1211 of file LV2Effect.cpp.

1212{
1213 using namespace LV2Symbols;
1214 int i = 0;
1215 for (auto & port : mAudioPorts)
1216 {
1217 if (port->mIsInput)
1218 {
1219 memset(mMasterIn[i++].get(), 0, mBlockSize * sizeof(float));
1220 }
1221 }
1222
1223 mNumSamples = 0;
1224
1225 // Transfer incoming events from the ring buffer to the event buffer for each
1226 // atom input port. These will be made available to each slave in the chain and
1227 // to the master once all slaves have run.
1228 //
1229 // In addition, reset the output Atom ports.
1230 for (auto & port : mAtomPorts)
1231 {
1232 uint8_t *buf = port->mBuffer.data();
1233
1234 if (port->mIsInput)
1235 {
1236 lv2_atom_forge_set_buffer(&mForge,
1237 buf,
1238 port->mBuffer.size());
1239
1240 LV2_Atom_Forge_Frame seqFrame;
1241 LV2_Atom_Sequence *seq = (LV2_Atom_Sequence *)
1242 lv2_atom_forge_sequence_head(&mForge, &seqFrame, 0);
1243
1244 if (port->mWantsPosition)
1245 {
1246 lv2_atom_forge_frame_time(&mForge, mPositionFrame);
1247
1248 LV2_Atom_Forge_Frame posFrame;
1249 lv2_atom_forge_object(&mForge, &posFrame, 0, urid_Position);
1250 lv2_atom_forge_key(&mForge, urid_Speed);
1251 lv2_atom_forge_float(&mForge, mPositionSpeed);
1252 lv2_atom_forge_key(&mForge, urid_Frame);
1253 lv2_atom_forge_long(&mForge, mPositionFrame);
1254 lv2_atom_forge_pop(&mForge, &posFrame);
1255 }
1256
1257 ZixRing *ring = port->mRing;
1258 LV2_Atom atom;
1259 while (zix_ring_read(ring, &atom, sizeof(atom)))
1260 {
1261 if (mForge.offset + sizeof(LV2_Atom_Event) + atom.size < mForge.size)
1262 {
1263 lv2_atom_forge_frame_time(&mForge, mPositionFrame);
1264
1265 lv2_atom_forge_write(&mForge, &atom, sizeof(atom));
1266 zix_ring_read(ring, &mForge.buf[mForge.offset], atom.size);
1267 mForge.offset += atom.size;
1268 seq->atom.size += atom.size;
1269 }
1270 else
1271 {
1272 zix_ring_skip(ring, atom.size);
1273 wxLogError(wxT("LV2 sequence buffer overflow"));
1274 }
1275 }
1276 lv2_atom_forge_pop(&mForge, &seqFrame);
1277#if 0
1278 LV2_ATOM_SEQUENCE_FOREACH(seq, ev)
1279 {
1280 LV2_Atom_Object *o = (LV2_Atom_Object *) &ev->body;
1281 wxLogDebug(wxT("ev = %lld ev.size %d ev.type %d"), ev->time.frames, ev->body.size, ev->body.type);
1282 }
1283#endif
1284 }
1285 else
1286 {
1287 port->mBuffer.resize(port->mMinimumSize);
1288 *((LV2_Atom *) buf) =
1289 {
1290 port->mMinimumSize,
1291 urid_Chunk
1292 };
1293 }
1294 }
1295
1296 return true;
1297}

References mAtomPorts, mAudioPorts, mBlockSize, mForge, mMasterIn, mNumSamples, mPositionFrame, mPositionSpeed, ZixRingImpl::size, zix_ring_read(), and zix_ring_skip().

Here is the call graph for this function:

◆ RealtimeResume()

bool LV2Effect::RealtimeResume ( )
overridevirtualnoexcept

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 1202 of file LV2Effect.cpp.

1203{
1204 mPositionSpeed = 1.0;
1205 mPositionFrame = 0.0;
1206 mRolling = true;
1207
1208 return true;
1209}

References mPositionFrame, mPositionSpeed, and mRolling.

◆ RealtimeSuspend()

bool LV2Effect::RealtimeSuspend ( )
overridevirtual

Default implementation does nothing, returns true

Reimplemented from StatefulEffectBase.

Definition at line 1193 of file LV2Effect.cpp.

1194{
1195 mPositionSpeed = 0.0;
1196 mPositionFrame = 0.0;
1197 mRolling = false;
1198
1199 return true;
1200}

References mPositionFrame, mPositionSpeed, and mRolling.

◆ SaveParameters()

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

Definition at line 1744 of file LV2Effect.cpp.

1746{
1748 if (!SaveSettings(settings, eap))
1749 return false;
1750
1751 wxString parms;
1752 if (!eap.GetParameters(parms))
1753 return false;
1754
1755 return SetConfig(*this,
1756 PluginSettings::Private, group, wxT("Parameters"), parms);
1757}
bool GetParameters(wxString &parms)
bool SaveSettings(const EffectSettings &settings, CommandParameters &parms) const override
Store settings as keys and values.
Definition: LV2Effect.cpp:1423
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)

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

Referenced by SaveUserPreset().

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

◆ SaveSettings()

bool LV2Effect::SaveSettings ( const EffectSettings settings,
CommandParameters parms 
) const
overridevirtual

Store settings as keys and values.

Returns
true on success

Reimplemented from Effect.

Definition at line 1423 of file LV2Effect.cpp.

1425{
1426 for (auto & port : mControlPorts)
1427 {
1428 if (port->mIsInput)
1429 {
1430 if (!parms.Write(port->mName, port->mVal))
1431 {
1432 return false;
1433 }
1434 }
1435 }
1436
1437 return true;
1438}

References mControlPorts.

Referenced by SaveParameters().

Here is the caller graph for this function:

◆ SaveUserPreset()

bool LV2Effect::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 1605 of file LV2Effect.cpp.

1607{
1608 return SaveParameters(name, settings);
1609}
bool SaveParameters(const RegistryPath &group, const EffectSettings &settings) const
Definition: LV2Effect.cpp:1744

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

Here is the call graph for this function:

◆ set_value_func()

void LV2Effect::set_value_func ( const char *  port_symbol,
void *  user_data,
const void *  value,
uint32_t  size,
uint32_t  type 
)
staticprivate

Definition at line 3095 of file LV2Effect.cpp.

3100{
3101 ((LV2Effect *) user_data)->SetPortValue(port_symbol, value, size, type);
3102}

References size.

Referenced by DoLoadFactoryPreset().

Here is the caller graph for this function:

◆ SetBlockSize()

size_t LV2Effect::SetBlockSize ( size_t  maxBlockSize)
overridevirtual

Default implementation assigns mEffectBlockSize, returns it

Reimplemented from StatefulEffectBase.

Definition at line 961 of file LV2Effect.cpp.

962{
964
966 {
968 }
970 {
972 }
973
974 if (mMaster)
975 {
977 }
978
979 for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
980 {
981 mSlaves[i]->SetBlockSize();
982 }
983
984 return mBlockSize;
985}

References mBlockSize, min(), mMaster, mMaxBlockSize, mMinBlockSize, mSlaves, mUserBlockSize, and LV2Wrapper::SetBlockSize().

Here is the call graph for this function:

◆ SetPortValue()

void LV2Effect::SetPortValue ( const char *  port_symbol,
const void *  value,
uint32_t  size,
uint32_t  type 
)
private

Definition at line 3104 of file LV2Effect.cpp.

3108{
3109 wxString symbol = wxString::FromUTF8(port_symbol);
3110
3111 for (auto & port : mControlPorts)
3112 {
3113 using namespace LV2Symbols;
3114 if (port->mSymbol == symbol)
3115 {
3116 if (type == urid_Bool && size == sizeof(bool))
3117 {
3118 port->mVal = (float) (*((const bool *) value)) ? 1.0f : 0.0f;
3119 }
3120 else if (type == urid_Double && size == sizeof(double))
3121 {
3122 port->mVal = (float) (*((const double *) value));
3123 }
3124 else if (type == urid_Float && size == sizeof(float))
3125 {
3126 port->mVal = (float) (*((const float *) value));
3127 }
3128 else if (type == urid_Int && size == sizeof(int32_t))
3129 {
3130 port->mVal = (float) (*((const int32_t *) value));
3131 }
3132 else if (type == urid_Long && size == sizeof(int64_t))
3133 {
3134 port->mVal = (float) (*((const int64_t *) value));
3135 }
3136
3137 break;
3138 }
3139 }
3140}

References mControlPorts, and size.

◆ SetSampleRate()

void LV2Effect::SetSampleRate ( double  rate)
overridevirtual

Default implementation assigns mSampleRate

Reimplemented from StatefulEffectBase.

Definition at line 946 of file LV2Effect.cpp.

947{
948 mSampleRate = (float) rate;
949
950 if (mMaster)
951 {
953 }
954
955 for (size_t i = 0, cnt = mSlaves.size(); i < cnt; i++)
956 {
957 mSlaves[i]->SetSampleRate();
958 }
959}

References mMaster, mSampleRate, mSlaves, and LV2Wrapper::SetSampleRate().

Here is the call graph for this function:

◆ SetSlider()

void LV2Effect::SetSlider ( const LV2ControlPortPtr port)
private

Definition at line 2619 of file LV2Effect.cpp.

2620{
2621 float lo = port->mLo;
2622 float hi = port->mHi;
2623 float val = port->mTmp;
2624
2625 if (port->mLogarithmic)
2626 {
2627 lo = logf(lo);
2628 hi = logf(hi);
2629 val = logf(val);
2630 }
2631
2632 port->mCtrl.slider->SetValue(lrintf((val - lo) / (hi - lo) * 1000.0));
2633}

References lrintf.

Referenced by OnText(), and TransferDataToWindow().

Here is the caller graph for this function:

◆ ShowClientInterface()

int LV2Effect::ShowClientInterface ( wxWindow &  parent,
wxDialog &  dialog,
bool  forceModal 
)
overridevirtual
Returns
0 if destructive effect processing should not proceed (and there may be a non-modal dialog still opened); otherwise, modal dialog return code

Reimplemented from Effect.

Definition at line 1399 of file LV2Effect.cpp.

1401{
1402 // Remember the dialog with a weak pointer, but don't control its lifetime
1403 mDialog = &dialog;
1404
1405 // Try to give the window a sensible default/minimum size
1406 mDialog->Layout();
1407 mDialog->Fit();
1408 mDialog->SetMinSize(mDialog->GetSize());
1409 if (mNoResize)
1410 {
1411 mDialog->SetMaxSize(mDialog->GetSize());
1412 }
1413
1414 if ((SupportsRealtime() || GetType() == EffectTypeAnalyze) && !forceModal)
1415 {
1416 mDialog->Show();
1417 return 0;
1418 }
1419
1420 return mDialog->ShowModal();
1421}
bool SupportsRealtime() const override
Whether the effect supports realtime previewing (while audio is playing).
Definition: LV2Effect.cpp:482

References EffectTypeAnalyze, GetType(), mDialog, mNoResize, and SupportsRealtime().

Here is the call graph for this function:

◆ ShowOptions()

void LV2Effect::ShowOptions ( )
overridevirtual

Reimplemented from Effect.

Definition at line 1706 of file LV2Effect.cpp.

1707{
1708 LV2EffectSettingsDialog dlg(mParent, *this);
1709 if (dlg.ShowModal() == wxID_OK)
1710 {
1711 // Reinitialize configuration settings
1712 int userBlockSize;
1713 GetConfig(*this, PluginSettings::Shared, wxT("Settings"),
1714 wxT("BufferSize"), userBlockSize, DEFAULT_BLOCKSIZE);
1715 mUserBlockSize = std::max(1, userBlockSize);
1716 GetConfig(*this, PluginSettings::Shared, wxT("Settings"),
1717 wxT("UseLatency"), mUseLatency, true);
1718 }
1719}

References DEFAULT_BLOCKSIZE, PluginSettings::GetConfig(), mParent, mUseLatency, mUserBlockSize, and PluginSettings::Shared.

Here is the call graph for this function:

◆ size_request()

void LV2Effect::size_request ( GtkWidget *  widget,
GtkRequisition *  requisition,
LV2Effect win 
)
staticprivate

Definition at line 3148 of file LV2Effect.cpp.

3149{
3150 effect->SizeRequest(widget, requisition);
3151}

References SizeRequest().

Referenced by BuildFancy().

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

◆ SizeRequest()

void LV2Effect::SizeRequest ( GtkWidget *  widget,
GtkRequisition *  requisition 
)
private

Definition at line 3153 of file LV2Effect.cpp.

3154{
3155 // Don't do anything if the OnSize() method is active
3156 if (!mResizing)
3157 {
3158 // If the OnSize() routine has processed an event, mResized will be true,
3159 // so just set the widgets size.
3160 if (mResized)
3161 {
3162 gtk_widget_set_size_request(widget, mNativeWinLastSize.x, mNativeWinLastSize.y);
3163 mResized = false;
3164 }
3165 // Otherwise, the plugin has resized the widget and we need to let WX know
3166 // about it.
3167 else if (mNativeWin)
3168 {
3169 mResized = true;
3170 wxSizeEvent se(wxSize(requisition->width, requisition->height));
3171 se.SetEventObject(mNativeWin);
3172 mNativeWin->GetEventHandler()->AddPendingEvent(se);
3173 }
3174 }
3175}

References mNativeWin, mNativeWinLastSize, mResized, and mResizing.

Referenced by size_request().

Here is the caller graph for this function:

◆ suil_port_index_func()

uint32_t LV2Effect::suil_port_index_func ( SuilController  controller,
const char *  port_symbol 
)
staticprivate

Definition at line 3043 of file LV2Effect.cpp.

3045{
3046 return ((LV2Effect *) controller)->SuilPortIndex(port_symbol);
3047}

Referenced by BuildFancy().

Here is the caller graph for this function:

◆ suil_port_write_func()

void LV2Effect::suil_port_write_func ( SuilController  controller,
uint32_t  port_index,
uint32_t  buffer_size,
uint32_t  protocol,
const void *  buffer 
)
staticprivate

Definition at line 3007 of file LV2Effect.cpp.

3012{
3013 ((LV2Effect *) controller)->SuilPortWrite(port_index, buffer_size, protocol, buffer);
3014}

Referenced by BuildFancy().

Here is the caller graph for this function:

◆ SuilPortIndex()

uint32_t LV2Effect::SuilPortIndex ( const char *  port_symbol)
private

Definition at line 3049 of file LV2Effect.cpp.

3050{
3051 for (size_t i = 0, cnt = lilv_plugin_get_num_ports(mPlug); i < cnt; i++)
3052 {
3053 const LilvPort *port = lilv_plugin_get_port_by_index(mPlug, i);
3054 if (strcmp(port_symbol, lilv_node_as_string(lilv_port_get_symbol(mPlug, port))) == 0)
3055 {
3056 return lilv_port_get_index(mPlug, port);
3057 }
3058 }
3059
3060 return LV2UI_INVALID_PORT_INDEX;
3061}

References mPlug.

◆ SuilPortWrite()

void LV2Effect::SuilPortWrite ( uint32_t  port_index,
uint32_t  buffer_size,
uint32_t  protocol,
const void *  buffer 
)
private

Definition at line 3016 of file LV2Effect.cpp.

3020{
3021 // Handle implicit floats
3022 if (protocol == 0 && buffer_size == sizeof(float))
3023 {
3024 auto it = mControlPortMap.find(port_index);
3025 if (it != mControlPortMap.end())
3026 {
3027 it->second->mVal = *((const float *) buffer);
3028 }
3029 }
3030 // Handle event transfers
3031 else if (protocol == LV2Symbols::urid_EventTransfer)
3032 {
3033 if (mControlIn && port_index == mControlIn->mIndex)
3034 {
3035 zix_ring_write(mControlIn->mRing, buffer, buffer_size);
3036 }
3037 }
3038
3039 return;
3040}

References mControlIn, mControlPortMap, and zix_ring_write().

Here is the call graph for this function:

◆ SupportsAutomation()

bool LV2Effect::SupportsAutomation ( ) const
overridevirtual

Whether the effect has any automatable controls.

Reimplemented from Effect.

Definition at line 489 of file LV2Effect.cpp.

490{
491 return true;
492}

◆ SupportsRealtime()

bool LV2Effect::SupportsRealtime ( ) const
overridevirtual

Whether the effect supports realtime previewing (while audio is playing).

Reimplemented from Effect.

Definition at line 482 of file LV2Effect.cpp.

483{
484 // TODO reenable after achieving statelessness
485 return false;
486// return GetType() == EffectTypeProcess;
487}

Referenced by ShowClientInterface().

Here is the caller graph for this function:

◆ TransferDataToWindow()

bool LV2Effect::TransferDataToWindow ( )
private

Definition at line 2547 of file LV2Effect.cpp.

2548{
2549 if (mUseGUI)
2550 {
2551 if (mSuilInstance)
2552 {
2553 for (auto & port : mControlPorts)
2554 {
2555 if (port->mIsInput)
2556 {
2557 suil_instance_port_event(mSuilInstance,
2558 port->mIndex,
2559 sizeof(float),
2560 0,
2561 &port->mVal);
2562 }
2563 }
2564 }
2565
2566 return true;
2567 }
2568
2569 for (auto & group : mGroups)
2570 {
2571 const auto & params = mGroupMap[group];
2572 for (auto & param : params)
2573 {
2574 auto & port = mControlPorts[param];
2575
2576 if (port->mTrigger)
2577 {
2578 continue;
2579 }
2580
2581 if (port->mToggle)
2582 {
2583 port->mCtrl.checkbox->SetValue(port->mVal > 0);
2584 }
2585 else if (port->mEnumeration) // Check before integer
2586 {
2587 int s;
2588 for (s = (int) port->mScaleValues.size() - 1; s >= 0; s--)
2589 {
2590 if (port->mVal >= port->mScaleValues[s])
2591 {
2592 break;
2593 }
2594 }
2595
2596 if (s < 0)
2597 {
2598 s = 0;
2599 }
2600
2601 port->mCtrl.choice->SetSelection(s);
2602 }
2603 else if (port->mIsInput)
2604 {
2605 port->mTmp = port->mVal * (port->mSampleRate ? mSampleRate : 1.0);
2606 SetSlider(port);
2607 }
2608 }
2609 }
2610
2611 if (mParent && !mParent->TransferDataToWindow())
2612 {
2613 return false;
2614 }
2615
2616 return true;
2617}
EffectDistortion::Params params
Definition: Distortion.cpp:83

References mControlPorts, mGroupMap, mGroups, mParent, mSampleRate, mSuilInstance, mUseGUI, params, and SetSlider().

Referenced by BuildFancy(), BuildPlain(), DoLoadFactoryPreset(), and DoLoadUserPreset().

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

◆ ui_closed()

void LV2Effect::ui_closed ( LV2UI_Controller  controller)
staticprivate

Definition at line 2994 of file LV2Effect.cpp.

2995{
2996 return ((LV2Effect *) controller)->UIClosed();
2997}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ ui_resize()

int LV2Effect::ui_resize ( LV2UI_Feature_Handle  handle,
int  width,
int  height 
)
staticprivate

Definition at line 2970 of file LV2Effect.cpp.

2971{
2972 return ((LV2Effect *) handle)->UIResize(width, height);
2973}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ UIClosed()

void LV2Effect::UIClosed ( )
private

Definition at line 2999 of file LV2Effect.cpp.

3000{
3001 mExternalUIClosed = true;
3002
3003 return;
3004}

References mExternalUIClosed.

◆ UIResize()

int LV2Effect::UIResize ( int  width,
int  height 
)
private

Definition at line 2975 of file LV2Effect.cpp.

2976{
2977 // Queue a wxSizeEvent to resize the plugins UI
2978 if (mNativeWin)
2979 {
2980 wxSizeEvent sw(wxSize(width, height));
2981 sw.SetEventObject(mNativeWin);
2982 mNativeWin->GetEventHandler()->AddPendingEvent(sw);
2983 }
2984 // The window hasn't been created yet, so record the desired size
2985 else
2986 {
2987 mNativeWinInitialSize = wxSize(width, height);
2988 }
2989
2990 return 0;
2991}

References mNativeWin, and mNativeWinInitialSize.

◆ uri_to_id()

uint32_t LV2Effect::uri_to_id ( LV2_URI_Map_Callback_Data  callback_data,
const char *  map,
const char *  uri 
)
staticprivate

Definition at line 2846 of file LV2Effect.cpp.

2849{
2850 return ((LV2Effect *) callback_data)->URID_Map(uri);
2851}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ URID_Map()

LV2_URID LV2Effect::URID_Map ( const char *  uri)
private

Definition at line 2859 of file LV2Effect.cpp.

2860{
2861 using namespace LV2Symbols;
2862 LV2_URID urid;
2863
2864 urid = Lookup_URI(gURIDMap, uri, false);
2865 if (urid > 0)
2866 {
2867 return urid;
2868 }
2869
2870 urid = Lookup_URI(mURIDMap, uri);
2871 if (urid > 0)
2872 {
2873 return urid + gURIDMap.size();
2874 }
2875
2876 return 0;
2877}
LV2Symbols::URIDMap mURIDMap
Definition: LV2Effect.h:437
LV2_URID Lookup_URI(URIDMap &map, const char *uri, bool add)
Definition: LV2Symbols.cpp:76
URIDMap gURIDMap
Declare the global map of positive integers to URIs.
Definition: LV2Symbols.cpp:34

References LV2Symbols::gURIDMap, LV2Symbols::Lookup_URI(), and mURIDMap.

Referenced by CheckOptions().

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

◆ urid_map()

LV2_URID LV2Effect::urid_map ( LV2_URID_Map_Handle  handle,
const char *  uri 
)
staticprivate

Definition at line 2854 of file LV2Effect.cpp.

2855{
2856 return ((LV2Effect *) handle)->URID_Map(uri);
2857}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ URID_Unmap()

const char * LV2Effect::URID_Unmap ( LV2_URID  urid)
private

Definition at line 2885 of file LV2Effect.cpp.

2886{
2887 using namespace LV2Symbols;
2888 if (urid > 0)
2889 {
2890 if (urid <= (LV2_URID) gURIDMap.size())
2891 {
2892 return mURIDMap[urid - 1].get();
2893 }
2894
2895 urid -= gURIDMap.size();
2896
2897 if (urid <= (LV2_URID) mURIDMap.size())
2898 {
2899 return mURIDMap[urid - 1].get();
2900 }
2901 }
2902
2903 return NULL;
2904}

References LV2Symbols::gURIDMap, and mURIDMap.

◆ urid_unmap()

const char * LV2Effect::urid_unmap ( LV2_URID_Unmap_Handle  handle,
LV2_URID  urid 
)
staticprivate

Definition at line 2880 of file LV2Effect.cpp.

2881{
2882 return ((LV2Effect *) handle)->URID_Unmap(urid);
2883}

Referenced by InitializePlugin().

Here is the caller graph for this function:

◆ ValidateFeatures()

bool LV2Effect::ValidateFeatures ( const LilvNode *  subject)
private

Definition at line 1794 of file LV2Effect.cpp.

1795{
1796 if (CheckFeatures(subject, LV2Symbols::node_RequiredFeature, true))
1797 {
1798 return CheckFeatures(subject, LV2Symbols::node_OptionalFeature, false);
1799 }
1800
1801 return false;
1802}
bool CheckFeatures(const LilvNode *subject, const LilvNode *predicate, bool required)
Definition: LV2Effect.cpp:1804

References CheckFeatures().

Referenced by BuildFancy(), and InitializePlugin().

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

◆ ValidateOptions()

bool LV2Effect::ValidateOptions ( const LilvNode *  subject)
private

Definition at line 1858 of file LV2Effect.cpp.

1859{
1860 if (CheckOptions(subject, LV2Symbols::node_RequiredOption, true))
1861 {
1862 return CheckOptions(subject, LV2Symbols::node_SupportedOption, false);
1863 }
1864
1865 return false;
1866}
bool CheckOptions(const LilvNode *subject, const LilvNode *predicate, bool required)
Definition: LV2Effect.cpp:1868

References CheckOptions().

Referenced by InitializePlugin().

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

◆ ValidateUI()

bool LV2Effect::ValidateUI ( EffectSettings settings)
overridevirtual

Reimplemented from Effect.

Definition at line 1535 of file LV2Effect.cpp.

1536{
1537 if (GetType() == EffectTypeGenerate)
1538 settings.extra.SetDuration(mDuration->GetValue());
1539
1540 return true;
1541}

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

Here is the call graph for this function:

Friends And Related Function Documentation

◆ LV2EffectSettingsDialog

friend class LV2EffectSettingsDialog
friend

Definition at line 556 of file LV2Effect.h.

◆ LV2EffectsModule

friend class LV2EffectsModule
friend

Definition at line 557 of file LV2Effect.h.

◆ LV2Wrapper

friend class LV2Wrapper
friend

Definition at line 555 of file LV2Effect.h.

Referenced by InitInstance().

Member Data Documentation

◆ mActivated

bool LV2Effect::mActivated
private

◆ mAtomPorts

LV2AtomPortArray LV2Effect::mAtomPorts
private

◆ mAudioIn

unsigned LV2Effect::mAudioIn
private

Definition at line 453 of file LV2Effect.h.

Referenced by GetAudioInCount(), InitializePlugin(), and RealtimeInitialize().

◆ mAudioOut

unsigned LV2Effect::mAudioOut
private

Definition at line 454 of file LV2Effect.h.

Referenced by GetAudioOutCount(), and InitializePlugin().

◆ mAudioPorts

LV2AudioPortArray LV2Effect::mAudioPorts
private

Definition at line 452 of file LV2Effect.h.

Referenced by InitializePlugin(), ProcessBlock(), RealtimeProcess(), and RealtimeProcessStart().

◆ mBlockSize

int LV2Effect::mBlockSize
private

◆ mBlockSizeOption

size_t LV2Effect::mBlockSizeOption
private

Definition at line 519 of file LV2Effect.h.

Referenced by InitializePlugin(), and LV2Wrapper::SetBlockSize().

◆ mControlIn

LV2AtomPortPtr LV2Effect::mControlIn
private

Definition at line 457 of file LV2Effect.h.

Referenced by InitializePlugin(), and SuilPortWrite().

◆ mControlOut

LV2AtomPortPtr LV2Effect::mControlOut
private

Definition at line 458 of file LV2Effect.h.

Referenced by InitializePlugin(), and OnIdle().

◆ mControlPortMap

std::unordered_map<uint32_t, LV2ControlPortPtr> LV2Effect::mControlPortMap
private

Definition at line 449 of file LV2Effect.h.

Referenced by InitializePlugin(), and SuilPortWrite().

◆ mControlPorts

LV2ControlPortArray LV2Effect::mControlPorts
private

◆ mCVIn

unsigned LV2Effect::mCVIn
private

Definition at line 463 of file LV2Effect.h.

◆ mCVInBuffers

FloatBuffers LV2Effect::mCVInBuffers
private

Definition at line 488 of file LV2Effect.h.

◆ mCVOut

unsigned LV2Effect::mCVOut
private

Definition at line 464 of file LV2Effect.h.

◆ mCVOutBuffers

FloatBuffers LV2Effect::mCVOutBuffers
private

Definition at line 489 of file LV2Effect.h.

◆ mCVPorts

LV2CVPortArray LV2Effect::mCVPorts
private

Definition at line 462 of file LV2Effect.h.

Referenced by InitializePlugin(), InitInstance(), ProcessInitialize(), and RealtimeInitialize().

◆ mDialog

wxWeakRef<wxDialog> LV2Effect::mDialog
private

Definition at line 499 of file LV2Effect.h.

Referenced by CloseUI(), OnIdle(), OnSize(), and ShowClientInterface().

◆ mDuration

NumericTextCtrl* LV2Effect::mDuration
private

Definition at line 546 of file LV2Effect.h.

Referenced by BuildPlain(), and ValidateUI().

◆ mExtensionDataFeature

LV2_Extension_Data_Feature LV2Effect::mExtensionDataFeature
private

Definition at line 510 of file LV2Effect.h.

Referenced by BuildFancy(), and InitializePlugin().

◆ mExternalUIClosed

bool LV2Effect::mExternalUIClosed
private

Definition at line 514 of file LV2Effect.h.

Referenced by OnIdle(), and UIClosed().

◆ mExternalUIHost

LV2_External_UI_Host LV2Effect::mExternalUIHost
private

Definition at line 512 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mExternalWidget

LV2_External_UI_Widget* LV2Effect::mExternalWidget
private

Definition at line 513 of file LV2Effect.h.

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

◆ mFactoryPresetNames

RegistryPaths LV2Effect::mFactoryPresetNames
mutableprivate

Definition at line 550 of file LV2Effect.h.

Referenced by GetFactoryPresets().

◆ mFactoryPresetsLoaded

bool LV2Effect::mFactoryPresetsLoaded { false }
mutableprivate

Definition at line 549 of file LV2Effect.h.

Referenced by GetFactoryPresets().

◆ mFactoryPresetUris

wxArrayString LV2Effect::mFactoryPresetUris
mutableprivate

Definition at line 551 of file LV2Effect.h.

Referenced by DoLoadFactoryPreset(), and GetFactoryPresets().

◆ mFeatures

std::vector<std::unique_ptr<LV2_Feature> > LV2Effect::mFeatures
private

Definition at line 524 of file LV2Effect.h.

Referenced by AddFeature(), BuildFancy(), CheckFeatures(), and InitInstance().

◆ mForge

LV2_Atom_Forge LV2Effect::mForge
private

Definition at line 516 of file LV2Effect.h.

Referenced by DoMakeInstance(), ProcessBlock(), and RealtimeProcessStart().

◆ mFramePos

size_t LV2Effect::mFramePos
private

Definition at line 486 of file LV2Effect.h.

◆ mFreewheeling

bool LV2Effect::mFreewheeling
private

Definition at line 530 of file LV2Effect.h.

◆ mGroupMap

std::unordered_map<TranslatableString, std::vector<int> > LV2Effect::mGroupMap
private

Definition at line 466 of file LV2Effect.h.

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

◆ mGroups

TranslatableStrings LV2Effect::mGroups
private

Definition at line 467 of file LV2Effect.h.

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

◆ mInstanceAccessFeature

LV2_Feature* LV2Effect::mInstanceAccessFeature
private

Definition at line 526 of file LV2Effect.h.

Referenced by BuildFancy(), and InitializePlugin().

◆ mLatencyDone

bool LV2Effect::mLatencyDone
private

Definition at line 476 of file LV2Effect.h.

Referenced by GetLatency(), and ProcessInitialize().

◆ mLatencyPort

int LV2Effect::mLatencyPort
private

Definition at line 475 of file LV2Effect.h.

Referenced by GetLatency(), InitializePlugin(), and LV2Wrapper::Instantiate().

◆ mLength

double LV2Effect::mLength
private

Definition at line 495 of file LV2Effect.h.

◆ mLogFeature

LV2_Log_Log LV2Effect::mLogFeature
private

Definition at line 509 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mMaster

LV2Wrapper* LV2Effect::mMaster
private

◆ mMasterIn

FloatBuffers LV2Effect::mMasterIn
private

Definition at line 484 of file LV2Effect.h.

Referenced by RealtimeInitialize(), RealtimeProcess(), and RealtimeProcessStart().

◆ mMaxBlockSize

int LV2Effect::mMaxBlockSize
private

Definition at line 446 of file LV2Effect.h.

Referenced by InitializePlugin(), and SetBlockSize().

◆ mMidiIn

unsigned LV2Effect::mMidiIn
private

Definition at line 459 of file LV2Effect.h.

Referenced by GetMidiInCount(), and InitializePlugin().

◆ mMidiOut

unsigned LV2Effect::mMidiOut
private

Definition at line 460 of file LV2Effect.h.

Referenced by GetMidiOutCount(), and InitializePlugin().

◆ mMinBlockSize

int LV2Effect::mMinBlockSize
private

Definition at line 445 of file LV2Effect.h.

Referenced by InitializePlugin(), and SetBlockSize().

◆ mNativeWin

NativeWindow* LV2Effect::mNativeWin
private

Definition at line 535 of file LV2Effect.h.

Referenced by BuildFancy(), CloseUI(), OnSize(), SizeRequest(), and UIResize().

◆ mNativeWinInitialSize

wxSize LV2Effect::mNativeWinInitialSize
private

Definition at line 536 of file LV2Effect.h.

Referenced by BuildFancy(), and UIResize().

◆ mNativeWinLastSize

wxSize LV2Effect::mNativeWinLastSize
private

Definition at line 537 of file LV2Effect.h.

Referenced by BuildFancy(), OnSize(), and SizeRequest().

◆ mNoResize

bool LV2Effect::mNoResize
private

Definition at line 472 of file LV2Effect.h.

Referenced by BuildFancy(), CheckFeatures(), OnSize(), and ShowClientInterface().

◆ mNumSamples

size_t LV2Effect::mNumSamples
private

Definition at line 485 of file LV2Effect.h.

Referenced by RealtimeProcess(), and RealtimeProcessStart().

◆ mOptions

std::vector<LV2_Options_Option> LV2Effect::mOptions
private

◆ mParent

wxWindow* LV2Effect::mParent
private

◆ mParentFeature

LV2_Feature* LV2Effect::mParentFeature
private

Definition at line 527 of file LV2Effect.h.

Referenced by BuildFancy(), and InitializePlugin().

◆ mPlug

const LilvPlugin* LV2Effect::mPlug
private

◆ mPositionFrame

float LV2Effect::mPositionFrame
private

◆ mPositionSpeed

float LV2Effect::mPositionSpeed
private

Definition at line 492 of file LV2Effect.h.

Referenced by ProcessBlock(), RealtimeProcessStart(), RealtimeResume(), and RealtimeSuspend().

◆ mProcess

LV2Wrapper* LV2Effect::mProcess
private

Definition at line 481 of file LV2Effect.h.

Referenced by ProcessBlock(), ProcessFinalize(), and ProcessInitialize().

◆ mResized

bool LV2Effect::mResized
private

Definition at line 540 of file LV2Effect.h.

Referenced by OnSize(), and SizeRequest().

◆ mResizing

bool LV2Effect::mResizing
private

Definition at line 538 of file LV2Effect.h.

Referenced by OnSize(), and SizeRequest().

◆ mRolling

bool LV2Effect::mRolling
private

Definition at line 477 of file LV2Effect.h.

Referenced by RealtimeProcess(), RealtimeResume(), and RealtimeSuspend().

◆ mSampleRate

float LV2Effect::mSampleRate
private

◆ mSampleRateOption

size_t LV2Effect::mSampleRateOption
private

Definition at line 520 of file LV2Effect.h.

Referenced by InitializePlugin(), and LV2Wrapper::SetSampleRate().

◆ mSeqSize

int LV2Effect::mSeqSize
private

Definition at line 443 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mSlaves

std::vector<LV2Wrapper *> LV2Effect::mSlaves
private

Definition at line 482 of file LV2Effect.h.

Referenced by RealtimeAddProcessor(), RealtimeProcess(), SetBlockSize(), and SetSampleRate().

◆ mSuilHost

SuilHost* LV2Effect::mSuilHost
private

Definition at line 532 of file LV2Effect.h.

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

◆ mSuilInstance

SuilInstance* LV2Effect::mSuilInstance
private

Definition at line 533 of file LV2Effect.h.

Referenced by BuildFancy(), CloseUI(), OnIdle(), PopulateUI(), and TransferDataToWindow().

◆ mSupportsNominalBlockLength

bool LV2Effect::mSupportsNominalBlockLength
private

Definition at line 521 of file LV2Effect.h.

Referenced by CheckOptions(), and LV2Wrapper::SetBlockSize().

◆ mSupportsSampleRate

bool LV2Effect::mSupportsSampleRate
private

Definition at line 522 of file LV2Effect.h.

Referenced by CheckOptions(), and LV2Wrapper::SetSampleRate().

◆ mTimer

wxTimer LV2Effect::mTimer
private

Definition at line 497 of file LV2Effect.h.

Referenced by BuildFancy().

◆ mUIIdleInterface

LV2UI_Idle_Interface* LV2Effect::mUIIdleInterface
private

Definition at line 543 of file LV2Effect.h.

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

◆ mUIResizeFeature

LV2UI_Resize LV2Effect::mUIResizeFeature
private

Definition at line 508 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mUIShowInterface

LV2UI_Show_Interface* LV2Effect::mUIShowInterface
private

Definition at line 544 of file LV2Effect.h.

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

◆ mURIDMap

LV2Symbols::URIDMap LV2Effect::mURIDMap
private

Definition at line 437 of file LV2Effect.h.

Referenced by URID_Map(), and URID_Unmap().

◆ mURIDMapFeature

LV2_URID_Map LV2Effect::mURIDMapFeature
private

Definition at line 506 of file LV2Effect.h.

Referenced by DoLoadFactoryPreset(), DoMakeInstance(), and InitializePlugin().

◆ mURIDUnmapFeature

LV2_URID_Unmap LV2Effect::mURIDUnmapFeature
private

Definition at line 507 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mUriMapFeature

LV2_URI_Map_Feature LV2Effect::mUriMapFeature
private

Definition at line 505 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mUseGUI

bool LV2Effect::mUseGUI
private

Definition at line 502 of file LV2Effect.h.

Referenced by DoMakeInstance(), IsGraphicalUI(), PopulateUI(), and TransferDataToWindow().

◆ mUseLatency

bool LV2Effect::mUseLatency
private

Definition at line 474 of file LV2Effect.h.

Referenced by DoMakeInstance(), GetLatency(), and ShowOptions().

◆ mUserBlockSize

int LV2Effect::mUserBlockSize
private

Definition at line 447 of file LV2Effect.h.

Referenced by DoMakeInstance(), SetBlockSize(), and ShowOptions().

◆ mWantsOptionsInterface

bool LV2Effect::mWantsOptionsInterface
private

Definition at line 469 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mWantsStateInterface

bool LV2Effect::mWantsStateInterface
private

Definition at line 470 of file LV2Effect.h.

Referenced by InitializePlugin().

◆ mWantsWorkerInterface

bool LV2Effect::mWantsWorkerInterface
private

Definition at line 471 of file LV2Effect.h.

Referenced by InitializePlugin(), and LV2Wrapper::Instantiate().

◆ mWorkerScheduleFeature

LV2_Feature* LV2Effect::mWorkerScheduleFeature
private

Definition at line 528 of file LV2Effect.h.


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