mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-09 14:43:57 +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:
@@ -21,18 +21,10 @@ effects.
|
||||
#ifndef __AUDACITY_EFFECTMANAGER__
|
||||
#define __AUDACITY_EFFECTMANAGER__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "audacity/EffectInterface.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "Effect.h"
|
||||
|
||||
#ifdef EFFECT_CATEGORIES
|
||||
#include "EffectCategory.h"
|
||||
#endif
|
||||
|
||||
WX_DEFINE_USER_EXPORTED_ARRAY(Effect *, EffectArray, class AUDACITY_DLL_API);
|
||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(Effect *, EffectMap, class AUDACITY_DLL_API);
|
||||
|
||||
@@ -42,35 +34,26 @@ class EffectRack;
|
||||
|
||||
class AUDACITY_DLL_API EffectManager
|
||||
{
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
friend class EffectRack;
|
||||
#endif
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/** Get the singleton instance of the EffectManager. Probably not safe
|
||||
for multi-thread use. */
|
||||
static EffectManager& Get();
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
// Used by the outside program to register the list of effects and retrieve
|
||||
// them by index number, usually when the user selects one from a menu.
|
||||
//
|
||||
public:
|
||||
static EffectManager & Get();
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
// Used by the outside program to register the list of effects and retrieve
|
||||
// them by index number, usually when the user selects one from a menu.
|
||||
//
|
||||
public:
|
||||
EffectManager();
|
||||
virtual ~EffectManager();
|
||||
|
||||
/** A destructor is needed so we can delete all categories. */
|
||||
~EffectManager();
|
||||
|
||||
/** Register an effect so it will appear in the menu. */
|
||||
void RegisterEffect(Effect *f, int AdditionalFlags=0);
|
||||
void RegisterEffect(ModuleInterface *p, Effect *f, int AdditionalFlags=0);
|
||||
|
||||
/** Unregister all effects. */
|
||||
void UnregisterEffects();
|
||||
/** Register an effect so it can be executed. */
|
||||
// Here solely for the purpose of Nyquist Workbench until
|
||||
// a better solution is devised.
|
||||
void RegisterEffect(Effect *f);
|
||||
|
||||
/** Run an effect given the plugin ID */
|
||||
// Returns true on success. Will only operate on tracks that
|
||||
@@ -78,12 +61,11 @@ class AUDACITY_DLL_API EffectManager
|
||||
// Audacity's standard UI.
|
||||
bool DoEffect(const PluginID & ID,
|
||||
wxWindow *parent,
|
||||
int flags,
|
||||
double projectRate,
|
||||
TrackList *list,
|
||||
TrackFactory *factory,
|
||||
SelectedRegion *selectedRegion,
|
||||
wxString params);
|
||||
bool shouldPrompt = true);
|
||||
|
||||
wxString GetEffectName(const PluginID & ID);
|
||||
wxString GetEffectIdentifier(const PluginID & ID);
|
||||
@@ -95,7 +77,6 @@ class AUDACITY_DLL_API EffectManager
|
||||
bool SetEffectParameters(const PluginID & ID, const wxString & params);
|
||||
bool PromptUser(const PluginID & ID, wxWindow *parent);
|
||||
|
||||
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
||||
// Realtime effect processing
|
||||
bool RealtimeIsActive();
|
||||
bool RealtimeIsSuspended();
|
||||
@@ -111,7 +92,6 @@ class AUDACITY_DLL_API EffectManager
|
||||
sampleCount RealtimeProcess(int group, int chans, float **buffers, sampleCount numSamples);
|
||||
void RealtimeProcessEnd();
|
||||
int GetRealtimeLatency();
|
||||
#endif
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
void ShowRack();
|
||||
@@ -119,37 +99,7 @@ class AUDACITY_DLL_API EffectManager
|
||||
|
||||
const PluginID & GetEffectByIdentifier(const wxString & strTarget);
|
||||
|
||||
#ifdef EFFECT_CATEGORIES
|
||||
|
||||
/** Add a new effect category with the given URI and name and
|
||||
return a pointer to it. If a category with this URI already
|
||||
exists, return that instead. */
|
||||
EffectCategory* AddCategory(const wxString& URI,
|
||||
const wxString& name);
|
||||
|
||||
/** Return a pointer to the effect category with the given URI
|
||||
or 0 if no such category has been added. */
|
||||
EffectCategory* LookupCategory(const wxString& URI);
|
||||
|
||||
/** Make one category the parent of another category. Both categories
|
||||
must have been returned from AddCategory() or LookupCategory().
|
||||
If the new parent-child relationship would create any loops
|
||||
in the graph of categories false will be returned and the graph
|
||||
will not be modified, otherwise the function will return true. */
|
||||
bool AddCategoryParent(EffectCategory* child, EffectCategory* parent);
|
||||
|
||||
/** Freeze the subcategory relations between all categories added so far. */
|
||||
void FreezeCategories();
|
||||
|
||||
/** Return the set of all root categories, i.e. the ones without parents. */
|
||||
const CategorySet& GetRootCategories() const;
|
||||
|
||||
/** Return the set of all uncategorised effects. */
|
||||
EffectSet GetUnsortedEffects(int flags = ALL_EFFECTS) const;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Return an effect by its ID. */
|
||||
Effect *GetEffect(const PluginID & ID);
|
||||
|
||||
@@ -159,14 +109,10 @@ class AUDACITY_DLL_API EffectManager
|
||||
|
||||
private:
|
||||
EffectMap mEffects;
|
||||
EffectMap mHostEffects;
|
||||
|
||||
int mNumEffects;
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
EffectRack *mRack;
|
||||
#endif
|
||||
|
||||
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
||||
wxCriticalSection mRealtimeLock;
|
||||
EffectArray mRealtimeEffects;
|
||||
int mRealtimeLatency;
|
||||
@@ -174,20 +120,11 @@ private:
|
||||
bool mRealtimeActive;
|
||||
wxArrayInt mRealtimeChans;
|
||||
wxArrayDouble mRealtimeRates;
|
||||
#endif
|
||||
|
||||
#ifdef EFFECT_CATEGORIES
|
||||
// This maps URIs to EffectCategory pointers for all added categories.
|
||||
// It is needed for fast lookup and easy deletion.
|
||||
typedef std::map<wxString, EffectCategory*> CategoryMap;
|
||||
CategoryMap *mCategories;
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
EffectRack *mRack;
|
||||
|
||||
// These are the root categories, i.e. the ones without parents.
|
||||
CategorySet *mRootCategories;
|
||||
|
||||
// Special category that all effects with unknown category URIs
|
||||
// are placed in.
|
||||
EffectSet *mUnsorted;
|
||||
friend class EffectRack;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user