From 15e86f09b2c581a5ec4f19b6ee5d60aafc8a7cac Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 31 Jan 2014 00:31:19 +0000 Subject: [PATCH] Misc lv2 fixing --- source/backend/plugin/Lv2Plugin.cpp | 6 +-- .../modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp | 31 ++++++------ source/utils/CarlaLv2Utils.hpp | 50 ++++++++++--------- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index c61c50ec8..4bf4ec707 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -130,7 +130,7 @@ const uint32_t kFeatureIdWorker = 19; const uint32_t kFeatureCountPlugin = 20; const uint32_t kFeatureIdUiDataAccess = 20; const uint32_t kFeatureIdUiInstanceAccess = 21; -const uint32_t kFeatureIdUiIdle = 22; +const uint32_t kFeatureIdUiIdleInterface = 22; const uint32_t kFeatureIdUiFixedSize = 23; const uint32_t kFeatureIdUiMakeResident = 24; const uint32_t kFeatureIdUiNoUserResize = 25; @@ -4658,8 +4658,8 @@ public: fFeatures[kFeatureIdUiInstanceAccess]->URI = LV2_INSTANCE_ACCESS_URI; fFeatures[kFeatureIdUiInstanceAccess]->data = fHandle; - fFeatures[kFeatureIdUiIdle]->URI = LV2_UI__idle; - fFeatures[kFeatureIdUiIdle]->data = nullptr; + fFeatures[kFeatureIdUiIdleInterface]->URI = LV2_UI__idleInterface; + fFeatures[kFeatureIdUiIdleInterface]->data = nullptr; fFeatures[kFeatureIdUiFixedSize]->URI = LV2_UI__fixedSize; fFeatures[kFeatureIdUiFixedSize]->data = nullptr; diff --git a/source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp b/source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp index 3d09ad973..ba9d78fe0 100644 --- a/source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp +++ b/source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp @@ -35,6 +35,9 @@ uri_to_path(const char* uri) { #define LILV_WRAP0(RT, prefix, name) \ inline RT name() { return lilv_ ## prefix ## _ ## name (me); } +#define LILV_WRAP0_CONST(RT, prefix, name) \ + inline RT name() const { return lilv_ ## prefix ## _ ## name (me); } + #define LILV_WRAP0_VOID(prefix, name) \ inline void name() { lilv_ ## prefix ## _ ## name(me); } @@ -74,20 +77,20 @@ struct Node { LILV_WRAP_CONVERSION(LilvNode); - LILV_WRAP0(char*, node, get_turtle_token); - LILV_WRAP0(bool, node, is_uri); - LILV_WRAP0(const char*, node, as_uri); - LILV_WRAP0(bool, node, is_blank); - LILV_WRAP0(const char*, node, as_blank); - LILV_WRAP0(bool, node, is_literal); - LILV_WRAP0(bool, node, is_string); - LILV_WRAP0(const char*, node, as_string); - LILV_WRAP0(bool, node, is_float); - LILV_WRAP0(float, node, as_float); - LILV_WRAP0(bool, node, is_int); - LILV_WRAP0(int, node, as_int); - LILV_WRAP0(bool, node, is_bool); - LILV_WRAP0(bool, node, as_bool); + LILV_WRAP0_CONST(char*, node, get_turtle_token); + LILV_WRAP0_CONST(bool, node, is_uri); + LILV_WRAP0_CONST(const char*, node, as_uri); + LILV_WRAP0_CONST(bool, node, is_blank); + LILV_WRAP0_CONST(const char*, node, as_blank); + LILV_WRAP0_CONST(bool, node, is_literal); + LILV_WRAP0_CONST(bool, node, is_string); + LILV_WRAP0_CONST(const char*, node, as_string); + LILV_WRAP0_CONST(bool, node, is_float); + LILV_WRAP0_CONST(float, node, as_float); + LILV_WRAP0_CONST(bool, node, is_int); + LILV_WRAP0_CONST(int, node, as_int); + LILV_WRAP0_CONST(bool, node, is_bool); + LILV_WRAP0_CONST(bool, node, as_bool); LilvNode* me; }; diff --git a/source/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp index 7afa03cce..f09c1f037 100644 --- a/source/utils/CarlaLv2Utils.hpp +++ b/source/utils/CarlaLv2Utils.hpp @@ -78,7 +78,6 @@ #define LV2_MIDI_LL__MidiPort "http://ll-plugins.nongnu.org/lv2/ext/MidiPort" #define LV2_UI__Qt5UI LV2_UI_PREFIX "Qt5UI" -#define LV2_UI__idle LV2_UI_PREFIX "idle" #define LV2_UI__makeResident LV2_UI_PREFIX "makeResident" // ----------------------------------------------------------------------- @@ -610,32 +609,37 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool /*fillPreset Lilv::Nodes bufferTypeNodes(lilvPort.get_value(lv2World.atom_bufferType)); - if (bufferTypeNodes.contains(lv2World.atom_sequence)) - rdfPort->Types |= LV2_PORT_ATOM_SEQUENCE; - else - carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses an unknown atom buffer type", uri, rdfPort->Name); + for (LilvIter* it = lilv_nodes_begin(bufferTypeNodes.me); ! lilv_nodes_is_end(bufferTypeNodes.me, it); it = lilv_nodes_next(bufferTypeNodes.me, it)) + { + const Lilv::Node node(lilv_nodes_get(bufferTypeNodes.me, it)); + CARLA_SAFE_ASSERT_CONTINUE(node.is_uri()); + + if (node.equals(lv2World.atom_sequence)) + rdfPort->Types |= LV2_PORT_ATOM_SEQUENCE; + else + carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses an unknown atom buffer type '%s'", uri, rdfPort->Name, node.as_uri()); + } Lilv::Nodes supportNodes(lilvPort.get_value(lv2World.atom_supports)); - bool supported = false; - if (supportNodes.contains(lv2World.midi_event)) + for (LilvIter* it = lilv_nodes_begin(supportNodes.me); ! lilv_nodes_is_end(supportNodes.me, it); it = lilv_nodes_next(supportNodes.me, it)) { - rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT; - supported = true; - } - if (supportNodes.contains(lv2World.patch_message)) - { - rdfPort->Types |= LV2_PORT_DATA_PATCH_MESSAGE; - supported = true; - } - if (supportNodes.contains(lv2World.time_position)) - { - rdfPort->Types |= LV2_PORT_DATA_TIME_POSITION; - supported = true; - } + const Lilv::Node node(lilv_nodes_get(supportNodes.me, it)); + CARLA_SAFE_ASSERT_CONTINUE(node.is_uri()); - if (! supported) - carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of atom type but has unsupported data", uri, rdfPort->Name); + if (node.equals(lv2World.midi_event)) + rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT; + + else if (node.equals(lv2World.patch_message)) + rdfPort->Types |= LV2_PORT_DATA_PATCH_MESSAGE; + + else if (node.equals(lv2World.time_position)) + rdfPort->Types |= LV2_PORT_DATA_TIME_POSITION; + + // something new we don't support yet? + else if (std::strstr(node.as_uri(), "lv2plug.in/") != nullptr) + carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of atom type but has unsupported data '%s'", uri, rdfPort->Name, node.as_uri()); + } } else if (lilvPort.is_a(lv2World.port_event)) { @@ -1354,7 +1358,7 @@ bool is_lv2_ui_feature_supported(const LV2_URI uri) #endif if (std::strcmp(uri, LV2_UI__fixedSize) == 0) return true; - if (std::strcmp(uri, LV2_UI__idle) == 0) + if (std::strcmp(uri, LV2_UI__idleInterface) == 0) return true; if (std::strcmp(uri, LV2_UI__makeResident) == 0) return true;