diff --git a/include/audacity/ModuleInterface.h b/include/audacity/ModuleInterface.h index f89d8c26c..7d6a319bd 100644 --- a/include/audacity/ModuleInterface.h +++ b/include/audacity/ModuleInterface.h @@ -91,7 +91,7 @@ public: // For modules providing an interface to other dynamically loaded plugins, // the module returns true if the plugin is still valid, otherwise false. - virtual bool IsPluginValid(const wxString & path) = 0; + virtual bool IsPluginValid(const wxString & path, bool bFast) = 0; // When appropriate, CreateInstance() will be called to instantiate the plugin. virtual IdentInterface *CreateInstance(const wxString & path) = 0; diff --git a/src/ModuleManager.cpp b/src/ModuleManager.cpp index 2f4d0aa91..2afbf5b0e 100755 --- a/src/ModuleManager.cpp +++ b/src/ModuleManager.cpp @@ -601,13 +601,14 @@ bool ModuleManager::IsProviderValid(const PluginID & WXUNUSED(providerID), } bool ModuleManager::IsPluginValid(const PluginID & providerID, - const wxString & path) + const wxString & path, + bool bFast) { if (mDynModules.find(providerID) == mDynModules.end()) { return false; } - return mDynModules[providerID]->IsPluginValid(path); + return mDynModules[providerID]->IsPluginValid(path, bFast); } diff --git a/src/ModuleManager.h b/src/ModuleManager.h index 62ef5c870..fd7629ccb 100644 --- a/src/ModuleManager.h +++ b/src/ModuleManager.h @@ -104,7 +104,7 @@ public: void DeleteInstance(const PluginID & provider, IdentInterface *instance); bool IsProviderValid(const PluginID & provider, const wxString & path); - bool IsPluginValid(const PluginID & provider, const wxString & path); + bool IsPluginValid(const PluginID & provider, const wxString & path, bool bFast); private: // I'm a singleton class diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 90f374a9c..7a65ec809 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1697,6 +1697,9 @@ void PluginManager::Initialize() // And finally check for updates #ifndef EXPERIMENTAL_EFFECT_MANAGEMENT CheckForUpdates(); +#else + const bool kFast = true; + CheckForUpdates( kFast ); #endif } @@ -2105,7 +2108,10 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type) return; } -void PluginManager::CheckForUpdates() +// If bFast is true, do not do a full check. Just check the ones +// that are quick to check. Currently (Feb 2017) just Nyquist +// and built-ins. +void PluginManager::CheckForUpdates(bool bFast) { // Get ModuleManager reference ModuleManager & mm = ModuleManager::Get(); @@ -2148,9 +2154,13 @@ void PluginManager::CheckForUpdates() continue; } - if (plugType == PluginTypeModule) + if ( (plugType == PluginTypeModule) ) { - if (!mm.IsProviderValid(plugID, plugPath)) + if( bFast ) + { + // Skip modules, when doing a fast refresh/check. + } + else if (!mm.IsProviderValid(plugID, plugPath)) { plug.SetEnabled(false); plug.SetValid(false); @@ -2178,7 +2188,7 @@ void PluginManager::CheckForUpdates() } else if (plugType != PluginTypeNone && plugType != PluginTypeStub) { - plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath)); + plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath, bFast)); if (!plug.IsValid()) { plug.SetEnabled(false); diff --git a/src/PluginManager.h b/src/PluginManager.h index cf07c9d23..1e93f0a67 100644 --- a/src/PluginManager.h +++ b/src/PluginManager.h @@ -254,7 +254,7 @@ public: wxString GetName(const PluginID & ID); IdentInterface *GetInstance(const PluginID & ID); - void CheckForUpdates(); + void CheckForUpdates(bool bFast = false); bool ShowManager(wxWindow *parent, EffectType type = EffectTypeNone); diff --git a/src/effects/LoadEffects.cpp b/src/effects/LoadEffects.cpp index d05bf8420..ab137567a 100644 --- a/src/effects/LoadEffects.cpp +++ b/src/effects/LoadEffects.cpp @@ -321,8 +321,10 @@ bool BuiltinEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxS return false; } -bool BuiltinEffectsModule::IsPluginValid(const wxString & path) +bool BuiltinEffectsModule::IsPluginValid(const wxString & path, bool bFast) { + // bFast is unused as checking in the list is fast. + bFast; return mNames.Index(path) != wxNOT_FOUND; } diff --git a/src/effects/LoadEffects.h b/src/effects/LoadEffects.h index 566983095..cc748288f 100644 --- a/src/effects/LoadEffects.h +++ b/src/effects/LoadEffects.h @@ -45,7 +45,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override; diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 6fd87e9c8..597940ced 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -616,8 +616,10 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin return valid; } -bool VSTEffectsModule::IsPluginValid(const wxString & path) +bool VSTEffectsModule::IsPluginValid(const wxString & path, bool bFast) { + if( bFast ) + return true; wxString realPath = path.BeforeFirst(wxT(';')); return wxFileName::FileExists(realPath) || wxFileName::DirExists(realPath); } diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index af4f8fdee..0a8d0d171 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -389,7 +389,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override; diff --git a/src/effects/ladspa/LadspaEffect.cpp b/src/effects/ladspa/LadspaEffect.cpp index 4d3e8d860..77ac643d8 100644 --- a/src/effects/ladspa/LadspaEffect.cpp +++ b/src/effects/ladspa/LadspaEffect.cpp @@ -255,8 +255,10 @@ bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxSt return index > 0; } -bool LadspaEffectsModule::IsPluginValid(const wxString & path) +bool LadspaEffectsModule::IsPluginValid(const wxString & path, bool bFast) { + if( bFast ) + return true; wxString realPath = path.BeforeFirst(wxT(';')); return wxFileName::FileExists(realPath); } diff --git a/src/effects/ladspa/LadspaEffect.h b/src/effects/ladspa/LadspaEffect.h index 7e2aeb5bd..f6f4c1d86 100644 --- a/src/effects/ladspa/LadspaEffect.h +++ b/src/effects/ladspa/LadspaEffect.h @@ -226,7 +226,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override; diff --git a/src/effects/lv2/LoadLV2.cpp b/src/effects/lv2/LoadLV2.cpp index fe2c98d1c..c346e7183 100644 --- a/src/effects/lv2/LoadLV2.cpp +++ b/src/effects/lv2/LoadLV2.cpp @@ -260,8 +260,10 @@ bool LV2EffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin return true; } -bool LV2EffectsModule::IsPluginValid(const wxString & path) +bool LV2EffectsModule::IsPluginValid(const wxString & path, bool bFast) { + if( bFast ) + return true; return GetPlugin(path) != NULL; } diff --git a/src/effects/lv2/LoadLV2.h b/src/effects/lv2/LoadLV2.h index 141b00c84..5c239a3e8 100644 --- a/src/effects/lv2/LoadLV2.h +++ b/src/effects/lv2/LoadLV2.h @@ -92,7 +92,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override; diff --git a/src/effects/nyquist/LoadNyquist.cpp b/src/effects/nyquist/LoadNyquist.cpp index 3adece934..bfff7558d 100644 --- a/src/effects/nyquist/LoadNyquist.cpp +++ b/src/effects/nyquist/LoadNyquist.cpp @@ -216,8 +216,11 @@ bool NyquistEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxS return false; } -bool NyquistEffectsModule::IsPluginValid(const wxString & path) +bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast) { + // Ignores bFast parameter, since checking file exists is fast enough for + // the small number of Nyquist plug-ins that we have. + bFast; if (path == NYQUIST_PROMPT_ID) { return true; diff --git a/src/effects/nyquist/LoadNyquist.h b/src/effects/nyquist/LoadNyquist.h index 759a4daf9..7abf7d42a 100644 --- a/src/effects/nyquist/LoadNyquist.h +++ b/src/effects/nyquist/LoadNyquist.h @@ -42,7 +42,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override; diff --git a/src/effects/vamp/LoadVamp.cpp b/src/effects/vamp/LoadVamp.cpp index 090a62401..326c31f69 100644 --- a/src/effects/vamp/LoadVamp.cpp +++ b/src/effects/vamp/LoadVamp.cpp @@ -216,10 +216,12 @@ bool VampEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStri return false; } -bool VampEffectsModule::IsPluginValid(const wxString & path) +bool VampEffectsModule::IsPluginValid(const wxString & path, bool bFast) { int output; bool hasParameters; + if( bFast ) + return true; auto vp = FindPlugin(path, output, hasParameters); return bool(vp); diff --git a/src/effects/vamp/LoadVamp.h b/src/effects/vamp/LoadVamp.h index 490f2bf5f..445fc960d 100644 --- a/src/effects/vamp/LoadVamp.h +++ b/src/effects/vamp/LoadVamp.h @@ -46,7 +46,7 @@ public: wxArrayString FindPlugins(PluginManagerInterface & pm) override; bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override; - bool IsPluginValid(const wxString & path) override; + bool IsPluginValid(const wxString & path, bool bFast) override; IdentInterface *CreateInstance(const wxString & path) override; void DeleteInstance(IdentInterface *instance) override;