1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-02 14:50:17 +01:00

Migrating the remaining effects

This brings the builtin, LV2, and VAMP effects inline with the
Audio Units, LADSPA, and VST effects.  All effects now share
a common UI.

This gives all effects (though not implemented for all):

User and factory preset capability
Preset import/export capability
Shared or private configuration options

Builtin effects can now be migrated to RTP, depending on algorithm.
LV2 effects now support graphical interfaces if the plugin supplies one.
Nyquist prompt enhanced to provide some features of the Nyquist Workbench.

It may not look like it, but this was a LOT of work, so trust me, there
WILL be problems and everything effect related should be suspect.  Keep
a sharp eye (or two) open.
This commit is contained in:
Leland Lucius
2015-04-16 22:53:42 -05:00
parent 40e6bcc56a
commit 8fbfa460c4
140 changed files with 17288 additions and 20367 deletions

View File

@@ -48,13 +48,14 @@
class EffectAutomationParameters : public wxFileConfig
{
public:
EffectAutomationParameters()
EffectAutomationParameters(const wxString & parms = wxEmptyString)
: wxFileConfig(wxEmptyString,
wxEmptyString,
wxEmptyString,
wxEmptyString,
0)
{
SetParameters(parms);
}
virtual ~EffectAutomationParameters()
@@ -81,19 +82,40 @@ public:
return wxFileConfig::DoWriteLong(NormalizeName(key), lValue);
}
bool ReadFloat(const wxString & key, float *pf) const
{
double d = *pf;
bool success = Read(key, &d);
if (success)
{
*pf = (float) d;
}
return success;
}
bool ReadFloat(const wxString & key, float *pf, float defVal) const
{
if (!ReadFloat(key, pf))
{
*pf = defVal;
}
return true;
}
bool WriteFloat(const wxString & key, float f)
{
return Write(key, f);
}
bool ReadEnum(const wxString & key, int *pi, const wxArrayString & choices) const
{
wxString s;
if (wxFileConfig::Read(key, &s))
if (!wxFileConfig::Read(key, &s))
{
int i = choices.Index(s);
if (i != wxNOT_FOUND)
{
*pi = i;
return true;
}
return false;
}
return false;
*pi = choices.Index(s);
return true;
}
bool ReadEnum(const wxString & key, int *pi, int defVal, const wxArrayString & choices) const
@@ -105,6 +127,15 @@ public:
return true;
}
bool ReadEnum(const wxString & key, int *pi, const wxString & defVal, const wxArrayString & choices) const
{
if (!ReadEnum(key, pi, choices))
{
*pi = choices.Index(defVal);
}
return true;
}
bool WriteEnum(const wxString & key, int value, const wxArrayString & choices)
{
if (value < 0 || value >= (int) choices.GetCount())
@@ -115,6 +146,54 @@ public:
return wxFileConfig::Write(key, choices[value]);
}
bool ReadAndVerify(const wxString & key, float *val, float defVal, float min, float max) const
{
ReadFloat(key, val, defVal);
return (*val >= min && *val <= max);
}
bool ReadAndVerify(const wxString & key, double *val, double defVal, double min, double max) const
{
Read(key, val, defVal);
return (*val >= min && *val <= max);
}
bool ReadAndVerify(const wxString & key, int *val, int defVal, int min, int max) const
{
Read(key, val, defVal);
return (*val >= min && *val <= max);
}
bool ReadAndVerify(const wxString & key, long *val, long defVal, long min, long max) const
{
Read(key, val, defVal);
return (*val >= min && *val <= max);
}
bool ReadAndVerify(const wxString & key, bool *val, bool defVal) const
{
Read(key, val, defVal);
return true;
}
bool ReadAndVerify(const wxString & key, wxString *val, const wxString & defVal) const
{
Read(key, val, defVal);
return true;
}
bool ReadAndVerify(const wxString & key, int *val, int defVal, const wxArrayString & choices) const
{
ReadEnum(key, val, defVal, choices);
return (*val != wxNOT_FOUND);
}
bool ReadAndVerify(const wxString & key, int *val, const wxString & defVal, const wxArrayString & choices) const
{
ReadEnum(key, val, defVal, choices);
return (*val != wxNOT_FOUND);
}
wxString NormalizeName(const wxString & name) const
{
wxString cleaned = name;
@@ -145,7 +224,7 @@ public:
return false;
}
str += key + wxT("=\"") + val + wxT("\" ");
str += key + wxT("=\"") + Escape(val) + wxT("\" ");
res = wxFileConfig::GetNextEntry(key, ndx);
}
@@ -167,7 +246,7 @@ public:
wxString key = parsed[i].BeforeFirst(wxT('=')).Trim(false).Trim(true);
wxString val = parsed[i].AfterFirst(wxT('=')).Trim(false).Trim(true);
if (!wxFileConfig::Write(key, val))
if (!wxFileConfig::Write(key, Unescape(val)))
{
return false;
}
@@ -175,6 +254,22 @@ public:
return true;
}
wxString Escape(wxString val)
{
val.Replace(wxT("\\"), wxT("\\\\"), true);
val.Replace(wxT("\""), wxT("\\\""), true);
return val;
}
wxString Unescape(wxString val)
{
val.Replace(wxT("\\\""), wxT("\""), true);
val.Replace(wxT("\\\\"), wxT("\\"), true);
return val;
}
};
#endif

View File

@@ -87,12 +87,12 @@ public:
class EffectUIHostInterface;
class EffectUIClientInterface;
class AUDACITY_DLL_API EffectHostInterface : public EffectIdentInterface,
public ConfigClientInterface
class AUDACITY_DLL_API EffectHostInterface : public ConfigClientInterface
{
public:
virtual ~EffectHostInterface() {};
virtual double GetDefaultDuration() = 0;
virtual double GetDuration() = 0;
virtual bool SetDuration(double seconds) = 0;
@@ -108,7 +108,7 @@ public:
virtual wxString GetFactoryDefaultsGroup() = 0;
};
class EffectClientInterface : public EffectIdentInterface
class AUDACITY_DLL_API EffectClientInterface : public EffectIdentInterface
{
public:
virtual ~EffectClientInterface() {};
@@ -122,15 +122,15 @@ public:
virtual int GetMidiOutCount() = 0;
virtual void SetSampleRate(sampleCount rate) = 0;
virtual sampleCount GetBlockSize(sampleCount maxBlockSize) = 0;
virtual sampleCount SetBlockSize(sampleCount maxBlockSize) = 0;
virtual sampleCount GetLatency() = 0;
virtual sampleCount GetTailSize() = 0;
virtual bool IsReady() = 0;
virtual bool ProcessInitialize() = 0;
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) = 0;
virtual bool ProcessFinalize() = 0;
virtual sampleCount ProcessBlock(float **inbuf, float **outbuf, sampleCount size) = 0;
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) = 0;
virtual bool RealtimeInitialize() = 0;
virtual bool RealtimeAddProcessor(int numChannels, float sampleRate) = 0;
@@ -138,41 +138,41 @@ public:
virtual bool RealtimeSuspend() = 0;
virtual bool RealtimeResume() = 0;
virtual bool RealtimeProcessStart() = 0;
virtual sampleCount RealtimeProcess(int group, float **inbuf, float **outbuf, sampleCount numSamples) = 0;
virtual sampleCount RealtimeProcess(int group, float **inBuf, float **outBuf, sampleCount numSamples) = 0;
virtual bool RealtimeProcessEnd() = 0;
virtual bool ShowInterface(wxWindow *parent, bool forceModal = false) = 0;
virtual bool GetAutomationParameters(EffectAutomationParameters & parms) = 0;
virtual bool SetAutomationParameters(EffectAutomationParameters & parms) = 0;
virtual bool LoadUserPreset(const wxString & name) = 0;
virtual bool SaveUserPreset(const wxString & name) = 0;
virtual wxArrayString GetFactoryPresets() = 0;
virtual bool LoadFactoryPreset(int id) = 0;
virtual bool LoadFactoryDefaults() = 0;
};
class EffectUIHostInterface
class AUDACITY_DLL_API EffectUIHostInterface
{
public:
virtual ~EffectUIHostInterface() {};
};
class EffectUIClientInterface
class AUDACITY_DLL_API EffectUIClientInterface
{
public:
virtual ~EffectUIClientInterface() {};
virtual void SetUIHost(EffectUIHostInterface *host) = 0;
virtual bool PopulateUI(wxWindow *parent) = 0;
virtual void SetHostUI(EffectUIHostInterface *host) = 0;
virtual bool IsGraphicalUI() = 0;
virtual bool PopulateUI(wxWindow *parent) = 0;
virtual bool ValidateUI() = 0;
virtual bool HideUI() = 0;
virtual bool CloseUI() = 0;
virtual void LoadUserPreset(const wxString & name) = 0;
virtual void SaveUserPreset(const wxString & name) = 0;
virtual wxArrayString GetFactoryPresets() = 0;
virtual void LoadFactoryPreset(int id) = 0;
virtual void LoadFactoryDefaults() = 0;
virtual bool CanExport() = 0;
virtual bool CanExportPresets() = 0;
virtual void ExportPresets() = 0;
virtual void ImportPresets() = 0;
@@ -180,7 +180,7 @@ public:
virtual void ShowOptions() = 0;
};
class EffectManagerInterface
class AUDACITY_DLL_API EffectManagerInterface
{
public:
virtual ~EffectManagerInterface() {};

View File

@@ -56,9 +56,9 @@ class PluginManagerInterface
public:
virtual ~PluginManagerInterface() {};
virtual const PluginID & RegisterModulePlugin(ModuleInterface *module) = 0;
virtual const PluginID & RegisterEffectPlugin(ModuleInterface *provider, EffectIdentInterface *effect) = 0;
virtual const PluginID & RegisterImporterPlugin(ModuleInterface *provider, ImporterInterface *importer) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *module) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, ImporterInterface *importer) = 0;
virtual void FindFilesInPathList(const wxString & pattern,
const wxArrayString & pathList,

View File

@@ -120,7 +120,7 @@ typedef enum
ChannelNameBottomFrontCenter,
ChannelNameBottomFrontLeft,
ChannelNameBottomFrontRight,
} ChannelName;
} ChannelName, *ChannelNames;
// LLL FIXME: Until a complete API is devised, we have to use
// AUDACITY_DLL_API when defining API classes. This