1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-09 14:43:57 +01:00

The fabled realtime effects...

I've made it where you can enable and disable via experimentals:

EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK

You will notice that, as of now, the only effects currently set up for
realtime are VSTs.  Now that this is in, I will start converting the
rest.

As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects.  This isolates the effects from changes in Audacity and makes
it much easier to add new ones.

Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too.  There are quite a few VSTs for Linux if
you search for them.

The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me.  I'm not really sure it should
stay in as-is.  I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects.  It should probably
revert back to that idea.

You may notice that this DOES include the API work I did.  The realtime effects
were too tied to it and I didn't want to redo the whole thing.  As I mentioned
elsewhere, the API stuff may or may not be very future proof.

So, let the critter complaints commence.  I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly.  ;-))
This commit is contained in:
lllucius
2014-10-26 03:24:10 +00:00
parent 789824617c
commit 1eeb4d979a
85 changed files with 14177 additions and 7350 deletions

View File

@@ -18,12 +18,15 @@ 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
@@ -32,8 +35,15 @@ effects.
WX_DEFINE_USER_EXPORTED_ARRAY(Effect *, EffectArray, class AUDACITY_DLL_API);
#if defined(EXPERIMENTAL_EFFECTS_RACK)
class EffectRack;
#endif
class AUDACITY_DLL_API EffectManager {
class AUDACITY_DLL_API EffectManager
{
#if defined(EXPERIMENTAL_EFFECTS_RACK)
friend class EffectRack;
#endif
public:
@@ -60,18 +70,45 @@ class AUDACITY_DLL_API EffectManager {
/** Unregister all effects. */
void UnregisterEffects();
/** Return an effect by its numerical ID. */
Effect *GetEffect(int ID);
/** Run an effect given the plugin ID */
// Returns true on success. Will only operate on tracks that
// have the "selected" flag set to true, which is consistent with
// Audacity's standard UI.
bool DoEffect(const PluginID & ID,
wxWindow *parent,
int flags,
double projectRate,
TrackList *list,
TrackFactory *factory,
SelectedRegion *selectedRegion,
wxString params);
Effect* GetEffectByIdentifier(const wxString strTarget, const int kFlags = ALL_EFFECTS);
wxString GetEffectName(const PluginID & ID);
wxString GetEffectIdentifier(const PluginID & ID);
wxString GetEffectDescription(const PluginID & ID);
/** Return the number of registered effects. */
int GetNumEffects();
/** Support for batch commands */
wxString GetEffectParameters(const PluginID & ID);
bool SetEffectParameters(const PluginID & ID, const wxString & params);
bool PromptUser(const PluginID & ID, wxWindow *parent);
/** Returns a sorted array of effects, which may be filtered
using the flags parameter. The caller should dispose
of the array when done. */
EffectArray *GetEffects(int flags = ALL_EFFECTS);
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
// Realtime effect processing
void RealtimeInitialize(int numChannels, float sampleRate);
void RealtimeFinalize();
void RealtimeSuspend();
void RealtimeResume();
void RealtimeProcessMono(float *buffer, sampleCount numSamples);
void RealtimeProcessStereo(float *buffer, sampleCount numSamples);
void SetRealtime(const EffectArray & mActive);
int GetRealtimeLatency();
#endif
#if defined(EXPERIMENTAL_EFFECTS_RACK)
void ShowRack();
#endif
const PluginID & GetEffectByIdentifier(const wxString & strTarget);
#ifdef EFFECT_CATEGORIES
@@ -104,10 +141,31 @@ class AUDACITY_DLL_API EffectManager {
#endif
private:
/** Return an effect by its ID. */
Effect *GetEffect(const PluginID & ID);
#if defined(EXPERIMENTAL_EFFECTS_RACK)
EffectRack *GetRack();
#endif
private:
wxArrayString mEffectPlugins;
EffectArray mEffects;
int mNumEffects;
#if defined(EXPERIMENTAL_EFFECTS_RACK)
EffectRack *mRack;
#endif
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
wxMutex mRealtimeMutex;
Effect **mRealtimeEffects;
int mRealtimeCount;
int mRealtimeLatency;
bool mRealtimeActive;
bool mRealtimeSuspended;
#endif
#ifdef EFFECT_CATEGORIES
// This maps URIs to EffectCategory pointers for all added categories.
// It is needed for fast lookup and easy deletion.
@@ -121,7 +179,6 @@ class AUDACITY_DLL_API EffectManager {
// are placed in.
EffectSet *mUnsorted;
#endif
};