From 1e51708bfe2c15429e0da59fd2bf934c261eb0aa Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 20 Oct 2019 04:02:44 +0100 Subject: [PATCH] Add CV and inline-display plugin filters, and related fixes Fixes #936 --- resources/ui/carla_database.ui | 128 +++++++++++++---------- source/backend/plugin/CarlaPluginLV2.cpp | 18 +++- source/backend/utils/CachedPlugins.cpp | 8 +- source/carla.kdev4 | 2 +- source/frontend/carla_database.py | 18 +++- source/utils/CarlaLv2Utils.hpp | 2 + 6 files changed, 115 insertions(+), 61 deletions(-) diff --git a/resources/ui/carla_database.ui b/resources/ui/carla_database.ui index 689612326..7fdd04582 100644 --- a/resources/ui/carla_database.ui +++ b/resources/ui/carla_database.ui @@ -61,17 +61,10 @@ QFrame::Sunken - - - - Stereo only - - - - - + + - LADSPA + VST2 @@ -82,24 +75,30 @@ - - + + - VST2 + Other/Misc - - + + + + + 75 + true + + - With GUI Only + Requirements - - + + - Sound Kits + LADSPA @@ -116,16 +115,10 @@ - - - - - 75 - true - - + + - Plugin format + Instruments @@ -136,8 +129,8 @@ - - + + 75 @@ -145,19 +138,12 @@ - Category - - - - - - - DSSI + Plugin format - - + + 75 @@ -165,14 +151,7 @@ - Requirements - - - - - - - Other/Misc + Category @@ -190,10 +169,24 @@ - - + + - Instruments + Sound Kits + + + + + + + DSSI + + + + + + + Stereo only @@ -211,17 +204,17 @@ - - + + - MIDI Plugins + Internal - - + + - Internal + MIDI Plugins @@ -239,6 +232,27 @@ + + + + With Inline Display + + + + + + + With CV Ports + + + + + + + With Custom GUI + + + diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index fdc8ee2dc..58dc93561 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -4722,7 +4722,23 @@ public: else if (std::strcmp(extension, LV2_INLINEDISPLAY__interface) == 0) pData->hints |= PLUGIN_HAS_EXTENSION_INLINE_DISPLAY; else - carla_stdout("Plugin has non-supported extension: '%s'", extension); + carla_stdout("Plugin '%s' has non-supported extension: '%s'", fRdfDescriptor->URI, extension); + } + + // Fix for broken plugins, nasty! + for (uint32_t i=0; i < fRdfDescriptor->FeatureCount; ++i) + { + const LV2_RDF_Feature& feature(fRdfDescriptor->Features[i]); + + if (std::strcmp(feature.URI, LV2_INLINEDISPLAY__queue_draw) == 0) + { + if (pData->hints & PLUGIN_HAS_EXTENSION_INLINE_DISPLAY) + break; + + carla_stdout("Plugin '%s' uses inline-display but does not set extension data, nasty!", fRdfDescriptor->URI); + pData->hints |= PLUGIN_HAS_EXTENSION_INLINE_DISPLAY; + break; + } } if (fDescriptor->extension_data != nullptr) diff --git a/source/backend/utils/CachedPlugins.cpp b/source/backend/utils/CachedPlugins.cpp index 202de1bc0..37f42b3aa 100644 --- a/source/backend/utils/CachedPlugins.cpp +++ b/source/backend/utils/CachedPlugins.cpp @@ -111,6 +111,8 @@ static const CarlaCachedPluginInfo* get_cached_plugin_internal(const NativePlugi info.hints |= CB::PLUGIN_IS_SYNTH; if (desc.hints & NATIVE_PLUGIN_HAS_UI) info.hints |= CB::PLUGIN_HAS_CUSTOM_UI; + if (desc.hints & NATIVE_PLUGIN_HAS_INLINE_DISPLAY) + info.hints |= CB::PLUGIN_HAS_INLINE_DISPLAY; if (desc.hints & NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS) info.hints |= CB::PLUGIN_NEEDS_FIXED_BUFFERS; if (desc.hints & NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD) @@ -229,10 +231,14 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl const char* const featureURI(lilvFeatureNode.as_uri()); CARLA_SAFE_ASSERT_CONTINUE(featureURI != nullptr); - if (std::strcmp(featureURI, LV2_CORE__hardRTCapable) == 0) + /**/ if (std::strcmp(featureURI, LV2_CORE__hardRTCapable) == 0) { info.hints |= CB::PLUGIN_IS_RTSAFE; } + else if (std::strcmp(featureURI, LV2_INLINEDISPLAY__queue_draw) == 0) + { + info.hints |= CB::PLUGIN_HAS_INLINE_DISPLAY; + } else if (std::strcmp(featureURI, LV2_DATA_ACCESS_URI) == 0 || std::strcmp(featureURI, LV2_INSTANCE_ACCESS_URI) == 0) { diff --git a/source/carla.kdev4 b/source/carla.kdev4 index f1fca3b1f..0f18b4198 100644 --- a/source/carla.kdev4 +++ b/source/carla.kdev4 @@ -3,7 +3,7 @@ Manager=KDevGenericManager Name=Carla [Filters] -Excludes=*/.*,*/*~,*/*.pyc,*/ui_*.py,*/__pycache__/,external +Excludes=*/.*,*/*~,*/*.pyc,*/ui_*.py,*/__pycache__/,external,juce_* [Project] VersionControlSupport=kdevgit diff --git a/source/frontend/carla_database.py b/source/frontend/carla_database.py index ec5247855..67e726f12 100755 --- a/source/frontend/carla_database.py +++ b/source/frontend/carla_database.py @@ -133,7 +133,7 @@ def findFilenames(filePath, stype): # --------------------------------------------------------------------------------------------------------------------- # Plugin Query -PLUGIN_QUERY_API_VERSION = 9 +PLUGIN_QUERY_API_VERSION = 10 PyPluginInfo = { 'API': PLUGIN_QUERY_API_VERSION, @@ -1469,7 +1469,9 @@ class PluginDatabaseW(QDialog): self.ui.ch_bridged.clicked.connect(self.slot_checkFilters) self.ui.ch_bridged_wine.clicked.connect(self.slot_checkFilters) self.ui.ch_rtsafe.clicked.connect(self.slot_checkFilters) + self.ui.ch_cv.clicked.connect(self.slot_checkFilters) self.ui.ch_gui.clicked.connect(self.slot_checkFilters) + self.ui.ch_inline_display.clicked.connect(self.slot_checkFilters) self.ui.ch_stereo.clicked.connect(self.slot_checkFilters) # ---------------------------------------------------------------------------------------------------- @@ -1531,7 +1533,9 @@ class PluginDatabaseW(QDialog): settings.setValue("PluginDatabase/ShowBridged", self.ui.ch_bridged.isChecked()) settings.setValue("PluginDatabase/ShowBridgedWine", self.ui.ch_bridged_wine.isChecked()) settings.setValue("PluginDatabase/ShowRtSafe", self.ui.ch_rtsafe.isChecked()) + settings.setValue("PluginDatabase/ShowHasCV", self.ui.ch_cv.isChecked()) settings.setValue("PluginDatabase/ShowHasGUI", self.ui.ch_gui.isChecked()) + settings.setValue("PluginDatabase/ShowHasInlineDisplay", self.ui.ch_inline_display.isChecked()) settings.setValue("PluginDatabase/ShowStereoOnly", self.ui.ch_stereo.isChecked()) settings.setValue("PluginDatabase/SearchText", self.ui.lineEdit.text()) @@ -1556,7 +1560,9 @@ class PluginDatabaseW(QDialog): self.ui.ch_bridged.setChecked(settings.value("PluginDatabase/ShowBridged", True, type=bool)) self.ui.ch_bridged_wine.setChecked(settings.value("PluginDatabase/ShowBridgedWine", True, type=bool)) self.ui.ch_rtsafe.setChecked(settings.value("PluginDatabase/ShowRtSafe", False, type=bool)) + self.ui.ch_cv.setChecked(settings.value("PluginDatabase/ShowHasCV", False, type=bool)) self.ui.ch_gui.setChecked(settings.value("PluginDatabase/ShowHasGUI", False, type=bool)) + self.ui.ch_inline_display.setChecked(settings.value("PluginDatabase/ShowHasInlineDisplay", False, type=bool)) self.ui.ch_stereo.setChecked(settings.value("PluginDatabase/ShowStereoOnly", False, type=bool)) self.ui.lineEdit.setText(settings.value("PluginDatabase/SearchText", "", type=str)) @@ -1592,7 +1598,9 @@ class PluginDatabaseW(QDialog): hideBridgedWine = not self.ui.ch_bridged_wine.isChecked() hideNonRtSafe = self.ui.ch_rtsafe.isChecked() + hideNonCV = self.ui.ch_cv.isChecked() hideNonGui = self.ui.ch_gui.isChecked() + hideNonIDisp = self.ui.ch_inline_display.isChecked() hideNonStereo = self.ui.ch_stereo.isChecked() if HAIKU or LINUX or MACOS: @@ -1611,6 +1619,8 @@ class PluginDatabaseW(QDialog): plugin = self.ui.tableWidget.item(i, 0).data(Qt.UserRole) aIns = plugin['audio.ins'] aOuts = plugin['audio.outs'] + cvIns = plugin['cv.ins'] + cvOuts = plugin['cv.outs'] mIns = plugin['midi.ins'] mOuts = plugin['midi.outs'] ptype = self.ui.tableWidget.item(i, 12).text() @@ -1622,7 +1632,9 @@ class PluginDatabaseW(QDialog): isNative = bool(plugin['build'] == BINARY_NATIVE) isRtSafe = bool(plugin['hints'] & PLUGIN_IS_RTSAFE) isStereo = bool(aIns == 2 and aOuts == 2) or (isSynth and aOuts == 2) + hasCV = bool(cvIns + cvOuts > 0) hasGui = bool(plugin['hints'] & PLUGIN_HAS_CUSTOM_UI) + hasIDisp = bool(plugin['hints'] & PLUGIN_HAS_INLINE_DISPLAY) isBridged = bool(not isNative and plugin['build'] in nativeBins) isBridgedWine = bool(not isNative and plugin['build'] in wineBins) @@ -1659,8 +1671,12 @@ class PluginDatabaseW(QDialog): self.ui.tableWidget.hideRow(i) elif hideNonRtSafe and not isRtSafe: self.ui.tableWidget.hideRow(i) + elif hideNonCV and not hasCV: + self.ui.tableWidget.hideRow(i) elif hideNonGui and not hasGui: self.ui.tableWidget.hideRow(i) + elif hideNonIDisp and not hasIDisp: + self.ui.tableWidget.hideRow(i) elif hideNonStereo and not isStereo: self.ui.tableWidget.hideRow(i) elif (text and not ( diff --git a/source/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp index 645af0cb2..7f0de9fbd 100644 --- a/source/utils/CarlaLv2Utils.hpp +++ b/source/utils/CarlaLv2Utils.hpp @@ -2943,6 +2943,8 @@ bool is_lv2_feature_supported(const LV2_URI uri) noexcept return true; if (std::strcmp(uri, LV2_EVENT_URI) == 0) return true; + if (std::strcmp(uri, LV2_INLINEDISPLAY__queue_draw) == 0) + return true; if (std::strcmp(uri, LV2_LOG__log) == 0) return true; if (std::strcmp(uri, LV2_OPTIONS__options) == 0)