1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 08:59:28 +02:00

Let's try Effect management once more

As usual, I started out intending to do as little as possible
to this to get it working and wound up going overboard.

However, I believe it does allow easy management of the effects
and this will provide a basis for the full blown plugin manager
dialog.
This commit is contained in:
Leland Lucius 2015-05-22 10:15:47 -05:00
parent 6cb9b7d8fb
commit f9061e3916
15 changed files with 543 additions and 493 deletions

View File

@ -81,9 +81,6 @@ public:
// Whether the effect supports realtime previewing (while audio is playing). // Whether the effect supports realtime previewing (while audio is playing).
virtual bool SupportsRealtime() = 0; virtual bool SupportsRealtime() = 0;
// Whether the effect should be shown in menus right from the start.
virtual bool EnableFromGetGo(){ return false;};
// Can the effect be used without the UI. // Can the effect be used without the UI.
virtual bool SupportsAutomation() = 0; virtual bool SupportsAutomation() = 0;
}; };

2
src/Experimental.h Normal file → Executable file
View File

@ -78,7 +78,7 @@
//#define EFFECT_CATEGORIES //#define EFFECT_CATEGORIES
// JKC Apr 2015, Menu item to manage effects. // JKC Apr 2015, Menu item to manage effects.
//#define EXPERIMENTAL_EFFECT_MANAGEMENT #define EXPERIMENTAL_EFFECT_MANAGEMENT
// Andreas Micheler, 20.Nov 2007: // Andreas Micheler, 20.Nov 2007:
// A spectrumLogF-like view mode with notes quantization. // A spectrumLogF-like view mode with notes quantization.

View File

@ -3226,10 +3226,6 @@ bool AudacityProject::OnEffect(const PluginID & ID, int flags)
mTracks->Add(newTrack); mTracks->Add(newTrack);
newTrack->SetSelected(true); newTrack->SetSelected(true);
} }
else {
wxMessageBox(_("You must select a track first."));
return false;
}
} }
EffectManager & em = EffectManager::Get(); EffectManager & em = EffectManager::Get();
@ -3304,32 +3300,42 @@ void AudacityProject::OnRepeatLastEffect(int WXUNUSED(index))
void AudacityProject::OnManagePluginsMenu(EffectType Type) void AudacityProject::OnManagePluginsMenu(EffectType type)
{ {
//gPrefs->Write( wxT("/Plugins/Rescan"), true); if (PluginManager::Get().ShowManager(this, type))
//gPrefs->Read(wxT("/Plugins/CheckForUpdates"), &doCheck, true); {
PluginManager::Get().CheckForUpdates(Type); for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) {
AudacityProject *p = gAudacityProjects[i];
for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) { p->RebuildMenuBar();
AudacityProject *p = gAudacityProjects[i];
p->RebuildMenuBar();
#if defined(__WXGTK__) #if defined(__WXGTK__)
// Workaround for: // Workaround for:
// //
// http://bugzilla.audacityteam.org/show_bug.cgi?id=458 // http://bugzilla.audacityteam.org/show_bug.cgi?id=458
// //
// This workaround should be removed when Audacity updates to wxWidgets 3.x which has a fix. // This workaround should be removed when Audacity updates to wxWidgets 3.x which has a fix.
wxRect r = p->GetRect(); wxRect r = p->GetRect();
p->SetSize(wxSize(1,1)); p->SetSize(wxSize(1,1));
p->SetSize(r.GetSize()); p->SetSize(r.GetSize());
#endif #endif
}
} }
} }
void AudacityProject::OnManageGenerators(){ OnManagePluginsMenu(EffectTypeGenerate); } void AudacityProject::OnManageGenerators()
void AudacityProject::OnManageEffects(){ OnManagePluginsMenu(EffectTypeProcess); } {
void AudacityProject::OnManageAnalyzers(){ OnManagePluginsMenu(EffectTypeAnalyze); } OnManagePluginsMenu(EffectTypeGenerate);
}
void AudacityProject::OnManageEffects()
{
OnManagePluginsMenu(EffectTypeProcess);
}
void AudacityProject::OnManageAnalyzers()
{
OnManagePluginsMenu(EffectTypeAnalyze);
}

927
src/PluginManager.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -156,13 +156,11 @@ private:
// //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
WX_DECLARE_STRING_HASH_MAP(wxArrayString, ArrayStringMap);
//WX_DECLARE_STRING_HASH_MAP(PluginDescriptor, PluginMap);
typedef std::map<PluginID, PluginDescriptor> PluginMap; typedef std::map<PluginID, PluginDescriptor> PluginMap;
typedef wxArrayString PluginIDList; typedef wxArrayString PluginIDList;
class ProviderMap;
class PluginRegistrationDialog; class PluginRegistrationDialog;
class PluginManager : public PluginManagerInterface class PluginManager : public PluginManagerInterface
@ -256,24 +254,20 @@ public:
wxString GetName(const PluginID & ID); wxString GetName(const PluginID & ID);
IdentInterface *GetInstance(const PluginID & ID); IdentInterface *GetInstance(const PluginID & ID);
void CheckForUpdates(EffectType Type=EffectTypeNone); void CheckForUpdates();
bool ShowManager(wxWindow *parent, EffectType type = EffectTypeNone);
// Here solely for the purpose of Nyquist Workbench until // Here solely for the purpose of Nyquist Workbench until
// a better solution is devised. // a better solution is devised.
const PluginID & RegisterPlugin(EffectIdentInterface *effect); const PluginID & RegisterPlugin(EffectIdentInterface *effect);
public:
bool mbRegisterAndEnable;
private: private:
void Load(); void Load();
void LoadGroup(PluginType type); void LoadGroup(PluginType type);
void Save(); void Save();
void SaveGroup(PluginType type); void SaveGroup(PluginType type);
void DisableMissing();
wxArrayString IsNewOrUpdated(const wxArrayString & paths);
PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type); PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type);
wxFileConfig *GetSettings(); wxFileConfig *GetSettings();

View File

@ -44,7 +44,6 @@ public:
// EffectIdentInterface implementation // EffectIdentInterface implementation
virtual EffectType GetType(); virtual EffectType GetType();
//virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -79,7 +79,6 @@ class AUDACITY_DLL_API Effect : public wxEvtHandler,
virtual bool IsLegacy(); virtual bool IsLegacy();
virtual bool SupportsRealtime(); virtual bool SupportsRealtime();
virtual bool SupportsAutomation(); virtual bool SupportsAutomation();
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -34,7 +34,6 @@ public:
// EffectIdentInterface implementation // EffectIdentInterface implementation
virtual EffectType GetType(); virtual EffectType GetType();
//virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -128,14 +128,18 @@
EFFECT( TRUNCATESILENCE, EffectTruncSilence() ) \ EFFECT( TRUNCATESILENCE, EffectTruncSilence() ) \
EFFECT( WAHWAH, EffectWahwah() ) \ EFFECT( WAHWAH, EffectWahwah() ) \
EFFECT( FINDCLIPPING, EffectFindClipping() ) \ EFFECT( FINDCLIPPING, EffectFindClipping() ) \
NOISEREDUCTION_EFFECT \
SOUNDTOUCH_EFFECTS
//
// Define the list of effects that do not get autoregistered
//
#define EXCLUDE_LIST \
EFFECT( AUTODUCK, EffectAutoDuck() ) \ EFFECT( AUTODUCK, EffectAutoDuck() ) \
EFFECT( LEVELLER, EffectLeveller() ) \ EFFECT( LEVELLER, EffectLeveller() ) \
EFFECT( PAULSTRETCH, EffectPaulstretch() ) \ EFFECT( PAULSTRETCH, EffectPaulstretch() ) \
CLASSICFILTER_EFFECT \ CLASSICFILTER_EFFECT \
SBSMS_EFFECTS \ SBSMS_EFFECTS
NOISEREDUCTION_EFFECT \
SOUNDTOUCH_EFFECTS
// //
// Define the EFFECT() macro to generate enum names // Define the EFFECT() macro to generate enum names
@ -148,6 +152,7 @@
enum enum
{ {
EFFECT_LIST EFFECT_LIST
EXCLUDE_LIST
}; };
// //
@ -164,6 +169,13 @@ static const wxChar *kEffectNames[] =
EFFECT_LIST EFFECT_LIST
}; };
//
// Create the effect name array of excluded effects
//
static const wxChar *kExcludedNames[] =
{
EXCLUDE_LIST
};
// //
// Redefine EFFECT() to generate a case statement for the lookup switch // Redefine EFFECT() to generate a case statement for the lookup switch
@ -257,6 +269,12 @@ bool BuiltinEffectsModule::Initialize()
{ {
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]); mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
} }
for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kExcludedNames[i]);
}
return true; return true;
} }
@ -331,6 +349,7 @@ Effect *BuiltinEffectsModule::Instantiate(const wxString & path)
switch (mNames.Index(path)) switch (mNames.Index(path))
{ {
EFFECT_LIST; EFFECT_LIST;
EXCLUDE_LIST;
} }
return NULL; return NULL;

View File

@ -33,7 +33,6 @@ public:
// EffectIdentInterface implementation // EffectIdentInterface implementation
virtual EffectType GetType(); virtual EffectType GetType();
//virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -28,8 +28,6 @@ public:
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd, void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd,
SlideType rateSlideType, SlideType pitchSlideType, SlideType rateSlideType, SlideType pitchSlideType,
bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput); bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput);
//virtual bool EnableFromGetGo(){ return false;};
private: private:
bool ProcessLabelTrack(Track *track); bool ProcessLabelTrack(Track *track);

View File

@ -47,7 +47,6 @@ public:
// EffectIdentInterface implementation // EffectIdentInterface implementation
virtual EffectType GetType(); virtual EffectType GetType();
//virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -117,7 +117,6 @@ public:
virtual bool IsLegacy(); virtual bool IsLegacy();
virtual bool SupportsRealtime(); virtual bool SupportsRealtime();
virtual bool SupportsAutomation(); virtual bool SupportsAutomation();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -84,7 +84,6 @@ public:
virtual wxString GetFamily(); virtual wxString GetFamily();
virtual bool IsInteractive(); virtual bool IsInteractive();
virtual bool IsDefault(); virtual bool IsDefault();
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation // EffectClientInterface implementation

View File

@ -56,8 +56,6 @@ public:
virtual wxString GetFamily(); virtual wxString GetFamily();
virtual bool IsInteractive(); virtual bool IsInteractive();
virtual bool IsDefault(); virtual bool IsDefault();
// May 21015: There aren't many analyse effects, so let us show them all (for now).
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation // EffectClientInterface implementation