diff --git a/include/ConfigManager.h b/include/ConfigManager.h index f6239c29783..3cba834e198 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -230,6 +230,7 @@ class LMMS_EXPORT ConfigManager : public QObject QString defaultVersion() const; + static bool enableBlockedPlugins(); static QStringList availableVstEmbedMethods(); QString vstEmbedMethod() const; diff --git a/include/Engine.h b/include/Engine.h index ed4cbd93cbc..7e19e2e8483 100644 --- a/include/Engine.h +++ b/include/Engine.h @@ -81,8 +81,6 @@ class LMMS_EXPORT Engine : public QObject return s_projectJournal; } - static bool ignorePluginBlacklist(); - #ifdef LMMS_HAVE_LV2 static class Lv2Manager * getLv2Manager() { diff --git a/include/Lv2Manager.h b/include/Lv2Manager.h index 58126a0a448..8a9f5168448 100644 --- a/include/Lv2Manager.h +++ b/include/Lv2Manager.h @@ -1,7 +1,7 @@ /* * Lv2Manager.h - Implementation of Lv2Manager class * - * Copyright (c) 2018-2023 Johannes Lorenz + * Copyright (c) 2018-2024 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -131,14 +131,23 @@ class Lv2Manager AutoLilvNodes findNodes(const LilvNode *subject, const LilvNode *predicate, const LilvNode *object); - static const std::set& getPluginBlacklist() + static bool pluginIsUnstable(const char* pluginUri) { - return pluginBlacklist; + return unstablePlugins.find(pluginUri) != unstablePlugins.end(); } - static const std::set& getPluginBlacklistBuffersizeLessThan32() + static bool pluginIsOnlyUsefulWithUi(const char* pluginUri) { - return pluginBlacklistBuffersizeLessThan32; + return pluginsOnlyUsefulWithUi.find(pluginUri) != pluginsOnlyUsefulWithUi.end(); } + static bool pluginIsUnstableWithBuffersizeLessEqual32(const char* pluginUri) + { + return unstablePluginsBuffersizeLessEqual32.find(pluginUri) != + unstablePluginsBuffersizeLessEqual32.end(); + } + + //! Whether the user generally wants a UI (and we generally support that) + //! Since we do not generally support UI right now, this will always return false... + static bool wantUi(); private: // general data @@ -154,8 +163,9 @@ class Lv2Manager Lv2UridCache m_uridCache; // static - static const std::set - pluginBlacklist, pluginBlacklistBuffersizeLessThan32; + static const std::set unstablePlugins; + static const std::set pluginsOnlyUsefulWithUi; + static const std::set unstablePluginsBuffersizeLessEqual32; // functions bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr); diff --git a/include/PluginIssue.h b/include/PluginIssue.h index 01a4268ecc9..b0b9b194612 100644 --- a/include/PluginIssue.h +++ b/include/PluginIssue.h @@ -57,7 +57,7 @@ enum class PluginIssueType FeatureNotSupported, //!< plugin requires functionality LMMS can't offer // misc BadPortType, //!< port type not supported - Blacklisted, + Blocked, NoIssue }; diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 19ce80ddb70..d3c973020bf 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -188,6 +188,12 @@ QString ConfigManager::defaultVersion() const return LMMS_VERSION; } +bool ConfigManager::enableBlockedPlugins() +{ + const char* envVar = getenv("LMMS_ENABLE_BLOCKED_PLUGINS"); + return (envVar && *envVar); +} + QStringList ConfigManager::availableVstEmbedMethods() { QStringList methods; @@ -512,7 +518,7 @@ void ConfigManager::loadConfigFile(const QString & configFile) cfg_file.close(); } - // Plugins are searched recursively, blacklist problematic locations + // Plugins are searched recursively, block problematic locations if( m_vstDir.isEmpty() || m_vstDir == QDir::separator() || m_vstDir == "/" || m_vstDir == ensureTrailingSlash( QDir::homePath() ) || !QDir( m_vstDir ).exists() ) diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp index c1f609120e3..9435eb69c06 100644 --- a/src/core/Engine.cpp +++ b/src/core/Engine.cpp @@ -126,15 +126,6 @@ void Engine::destroy() -bool Engine::ignorePluginBlacklist() -{ - const char* envVar = getenv("LMMS_IGNORE_BLACKLIST"); - return (envVar && *envVar); -} - - - - float Engine::framesPerTick(sample_rate_t sampleRate) { return sampleRate * 60.0f * 4 / @@ -171,4 +162,4 @@ void *Engine::pickDndPluginKey() Engine * Engine::s_instanceOfMe = nullptr; -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/src/core/PluginIssue.cpp b/src/core/PluginIssue.cpp index c9cf3400faa..b40c4723ba4 100644 --- a/src/core/PluginIssue.cpp +++ b/src/core/PluginIssue.cpp @@ -1,7 +1,7 @@ /* - * PluginIssue.h - PluginIssue class + * PluginIssue.cpp - PluginIssue class implementation * - * Copyright (c) 2019 Johannes Lorenz + * Copyright (c) 2019-2024 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -68,8 +68,8 @@ const char *PluginIssue::msgFor(const PluginIssueType &it) return "required feature not supported"; case PluginIssueType::BadPortType: return "unsupported port type"; - case PluginIssueType::Blacklisted: - return "blacklisted plugin"; + case PluginIssueType::Blocked: + return "blocked plugin"; case PluginIssueType::NoIssue: return nullptr; } diff --git a/src/core/lv2/Lv2Manager.cpp b/src/core/lv2/Lv2Manager.cpp index 1633b862616..9807379e44c 100644 --- a/src/core/lv2/Lv2Manager.cpp +++ b/src/core/lv2/Lv2Manager.cpp @@ -1,7 +1,7 @@ /* * Lv2Manager.cpp - Implementation of Lv2Manager class * - * Copyright (c) 2018-2023 Johannes Lorenz + * Copyright (c) 2018-2024 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -36,6 +36,7 @@ #include #include "AudioEngine.h" +#include "ConfigManager.h" #include "Engine.h" #include "Plugin.h" #include "Lv2ControlBase.h" @@ -47,7 +48,7 @@ namespace lmms { -const std::set Lv2Manager::pluginBlacklist = +const std::set Lv2Manager::unstablePlugins = { // github.com/calf-studio-gear/calf, #278 "http://calf.sourceforge.net/plugins/Analyzer", @@ -67,7 +68,13 @@ const std::set Lv2Manager::pluginBlacklist = "http://drobilla.net/plugins/blop/square", "http://drobilla.net/plugins/blop/triangle", - // Visualization, meters, and scopes etc., won't work until we have gui support + // unstable + "urn:juced:DrumSynth" +}; + +const std::set Lv2Manager::pluginsOnlyUsefulWithUi = +{ + // Visualization, meters, and scopes etc., won't work if UI is disabled "http://distrho.sf.net/plugins/ProM", "http://distrho.sf.net/plugins/glBars", "http://gareus.org/oss/lv2/meters#spectr30mono", @@ -132,13 +139,10 @@ const std::set Lv2Manager::pluginBlacklist = "urn:juce:TalFilter2", "urn:juce:Vex", "http://zynaddsubfx.sourceforge.net", - "http://geontime.com/geonkick/single", - - // unstable - "urn:juced:DrumSynth" + "http://geontime.com/geonkick/single" }; -const std::set Lv2Manager::pluginBlacklistBuffersizeLessThan32 = +const std::set Lv2Manager::unstablePluginsBuffersizeLessEqual32 = { "http://moddevices.com/plugins/mod-devel/2Voices", "http://moddevices.com/plugins/mod-devel/Capo", @@ -237,7 +241,7 @@ void Lv2Manager::initPlugins() QElapsedTimer timer; timer.start(); - unsigned blacklisted = 0; + unsigned blocked = 0; LILV_FOREACH(plugins, itr, plugins) { const LilvPlugin* curPlug = lilv_plugins_get(plugins, itr); @@ -266,9 +270,9 @@ void Lv2Manager::initPlugins() { if(std::any_of(issues.begin(), issues.end(), [](const PluginIssue& iss) { - return iss.type() == PluginIssueType::Blacklisted; })) + return iss.type() == PluginIssueType::Blocked; })) { - ++blacklisted; + ++blocked; } } ++pluginCount; @@ -295,19 +299,19 @@ void Lv2Manager::initPlugins() } // TODO: might be better in the LMMS core - if(Engine::ignorePluginBlacklist()) + if(ConfigManager::enableBlockedPlugins()) { qWarning() << - "WARNING! Plugin blacklist disabled! If you want to use the blacklist,\n" - " please set environment variable \"LMMS_IGNORE_BLACKLIST\" to empty or\n" + "WARNING! Blocked plugins enabled! If you want to disable them,\n" + " please set environment variable \"LMMS_ENABLE_BLOCKED_PLUGINS\" to empty or\n" " do not set it."; } - else if(blacklisted > 0) + else if(blocked > 0) { qDebug() << - "Lv2 Plugins blacklisted:" << blacklisted << "of" << pluginCount << "\n" - " If you want to ignore the blacklist (dangerous!), please set\n" - " environment variable \"LMMS_IGNORE_BLACKLIST\" to nonempty."; + "Blocked Lv2 Plugins:" << blocked << "of" << pluginCount << "\n" + " If you want to enable them (dangerous!), please set\n" + " environment variable \"LMMS_ENABLE_BLOCKED_PLUGINS\" to nonempty."; } } @@ -331,6 +335,14 @@ AutoLilvNodes Lv2Manager::findNodes(const LilvNode *subject, +bool Lv2Manager::wantUi() +{ + return false; +} + + + + // unused + untested yet bool Lv2Manager::isSubclassOf(const LilvPluginClass* clvss, const char* uriStr) { diff --git a/src/core/lv2/Lv2Proc.cpp b/src/core/lv2/Lv2Proc.cpp index 27d18ef27eb..7cd9d3a509b 100644 --- a/src/core/lv2/Lv2Proc.cpp +++ b/src/core/lv2/Lv2Proc.cpp @@ -1,7 +1,7 @@ /* * Lv2Proc.cpp - Lv2 processor class * - * Copyright (c) 2019-2022 Johannes Lorenz + * Copyright (c) 2019-2024 Johannes Lorenz * * This file is part of LMMS - https://lmms.io * @@ -38,6 +38,7 @@ #include "AudioEngine.h" #include "AutomatableModel.h" #include "ComboBoxModel.h" +#include "ConfigManager.h" #include "Engine.h" #include "Lv2Features.h" #include "Lv2Manager.h" @@ -74,21 +75,21 @@ Plugin::Type Lv2Proc::check(const LilvPlugin *plugin, const char* pluginUri = lilv_node_as_uri(lilv_plugin_get_uri(plugin)); //qDebug() << "Checking plugin" << pluginUri << "..."; - // TODO: manage a global blacklist outside of the code + // TODO: manage a global list of blocked plugins outside of the code // for now, this will help // this is only a fix for the meantime - if (!Engine::ignorePluginBlacklist()) + if (!ConfigManager::enableBlockedPlugins()) { - const auto& pluginBlacklist = Lv2Manager::getPluginBlacklist(); - const auto& pluginBlacklist32 = Lv2Manager::getPluginBlacklistBuffersizeLessThan32(); - if(pluginBlacklist.find(pluginUri) != pluginBlacklist.end()) + if( // plugin unstable? + Lv2Manager::pluginIsUnstable(pluginUri) || + // plugins only useful with UI? + (!Lv2Manager::wantUi() && + Lv2Manager::pluginIsOnlyUsefulWithUi(pluginUri)) || + // plugin unstable with 32 or less fpp? + (Engine::audioEngine()->framesPerPeriod() <= 32 && + Lv2Manager::pluginIsUnstableWithBuffersizeLessEqual32(pluginUri)) ) { - issues.emplace_back(PluginIssueType::Blacklisted); - } - else if(Engine::audioEngine()->framesPerPeriod() <= 32 && - pluginBlacklist32.find(pluginUri) != pluginBlacklist32.end()) - { - issues.emplace_back(PluginIssueType::Blacklisted); // currently no special blacklist category + issues.emplace_back(PluginIssueType::Blocked); } }