1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 07:58:05 +02:00
audacity/src/effects/ladspa/LadspaEffect.h
Paul Licameli 56586770e0 EffectClientInterface::SetSampleRate takes double...
... All the overrides (except Ladspa) were casting it to floating poing anyway
2016-08-21 09:51:32 -04:00

243 lines
6.3 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
LadspaEffect.h
Dominic Mazzoni
**********************************************************************/
class wxSlider;
class wxStaticText;
class wxTextCtrl;
class wxCheckBox;
#include <wx/dialog.h>
#include "audacity/EffectInterface.h"
#include "audacity/ModuleInterface.h"
#include "audacity/PluginInterface.h"
#include "../../widgets/NumericTextCtrl.h"
#include "ladspa.h"
#define LADSPAEFFECTS_VERSION wxT("1.0.0.0")
#define LADSPAEFFECTS_FAMILY wxT("LADSPA")
///////////////////////////////////////////////////////////////////////////////
//
// LadspaEffect
//
///////////////////////////////////////////////////////////////////////////////
WX_DEFINE_ARRAY_PTR(LADSPA_Handle, LadspaSlaveArray);
class LadspaEffectMeter;
class LadspaEffect final : public wxEvtHandler,
public EffectClientInterface,
public EffectUIClientInterface
{
public:
LadspaEffect(const wxString & path, int index);
virtual ~LadspaEffect();
// IdentInterface implementation
wxString GetPath() override;
wxString GetSymbol() override;
wxString GetName() override;
wxString GetVendor() override;
wxString GetVersion() override;
wxString GetDescription() override;
// EffectIdentInterface implementation
EffectType GetType() override;
wxString GetFamily() override;
bool IsInteractive() override;
bool IsDefault() override;
bool IsLegacy() override;
bool SupportsRealtime() override;
bool SupportsAutomation() override;
// EffectClientInterface implementation
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
bool LoadUserPreset(const wxString & name) override;
bool SaveUserPreset(const wxString & name) override;
wxArrayString GetFactoryPresets() override;
bool LoadFactoryPreset(int id) override;
bool LoadFactoryDefaults() override;
// EffectUIClientInterface implementation
void SetHostUI(EffectUIHostInterface *host) override;
bool PopulateUI(wxWindow *parent) override;
bool IsGraphicalUI() override;
bool ValidateUI() override;
bool HideUI() override;
bool CloseUI() override;
bool CanExportPresets() override;
void ExportPresets() override;
void ImportPresets() override;
bool HasOptions() override;
void ShowOptions() override;
// LadspaEffect implementation
private:
bool Load();
void Unload();
bool LoadParameters(const wxString & group);
bool SaveParameters(const wxString & group);
LADSPA_Handle InitInstance(float sampleRate);
void FreeInstance(LADSPA_Handle handle);
void OnCheckBox(wxCommandEvent & evt);
void OnSlider(wxCommandEvent & evt);
void OnTextCtrl(wxCommandEvent & evt);
void RefreshControls(bool outputOnly = false);
private:
wxString mPath;
int mIndex;
EffectHostInterface *mHost;
wxDynamicLibrary mLib;
const LADSPA_Descriptor *mData;
wxString pluginName;
bool mReady;
LADSPA_Handle mMaster;
sampleCount mSampleRate;
sampleCount mBlockSize;
sampleCount mUserBlockSize;
bool mInteractive;
int mAudioIns;
unsigned long *mInputPorts;
int mAudioOuts;
unsigned long *mOutputPorts;
int mNumInputControls;
float *mInputControls;
int mNumOutputControls;
float *mOutputControls;
bool mUseLatency;
int mLatencyPort;
bool mLatencyDone;
// Realtime processing
LadspaSlaveArray mSlaves;
EffectUIHostInterface *mUIHost;
NumericTextCtrl *mDuration;
wxDialog *mDialog;
wxWindow *mParent;
wxSlider **mSliders;
wxTextCtrl **mFields;
wxStaticText **mLabels;
wxCheckBox **mToggles;
LadspaEffectMeter **mMeters;
DECLARE_EVENT_TABLE();
friend class LadspaEffectsModule;
};
///////////////////////////////////////////////////////////////////////////////
//
// LadspaEffectsModule
//
///////////////////////////////////////////////////////////////////////////////
class LadspaEffectsModule final : public ModuleInterface
{
public:
LadspaEffectsModule(ModuleManagerInterface *moduleManager, const wxString *path);
virtual ~LadspaEffectsModule();
// IdentInterface implementatino
wxString GetPath() override;
wxString GetSymbol() override;
wxString GetName() override;
wxString GetVendor() override;
wxString GetVersion() override;
wxString GetDescription() override;
// ModuleInterface implementation
bool Initialize() override;
void Terminate() override;
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;
// LadspaEffectModule implementation
wxArrayString GetSearchPaths();
private:
ModuleManagerInterface *mModMan;
wxString mPath;
};