From ee5afc2400013fc6ab6fd0332ec933cc2a14e313 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 30 Aug 2014 03:58:29 +0100 Subject: [PATCH] Fix LV2 UI bridges to work with newer lilv --- source/backend/plugin/CarlaPluginThread.cpp | 5 ++-- source/backend/plugin/Lv2Plugin.cpp | 2 +- source/bridges-ui/CarlaBridgeClient.cpp | 2 +- source/bridges-ui/CarlaBridgeClient.hpp | 2 +- source/bridges-ui/CarlaBridgeUI-LV2.cpp | 28 ++++++++++++++++----- source/bridges-ui/CarlaBridgeUI-VST.cpp | 6 ++--- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/source/backend/plugin/CarlaPluginThread.cpp b/source/backend/plugin/CarlaPluginThread.cpp index 7f1eee196..a052de98f 100644 --- a/source/backend/plugin/CarlaPluginThread.cpp +++ b/source/backend/plugin/CarlaPluginThread.cpp @@ -172,8 +172,9 @@ void CarlaPluginThread::run() case PLUGIN_THREAD_LV2_GUI: /* osc-url */ arguments.add(String(fEngine->getOscServerPathUDP()) + String("/") + String(fPlugin->getId())); - /* URI */ arguments.add(fLabel.buffer()); - /* ui-URI */ arguments.add(fExtra1.buffer()); + /* URI */ arguments.add(fLabel.buffer()); // Plugin URI + /* ui-URI */ arguments.add(fExtra1.buffer()); // UI URI + /* ui-URI */ arguments.add(fExtra2.buffer()); // bundle /* ui-title */ arguments.add(name + String(" (GUI)")); break; diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index b452d5c1c..3d8ae74f9 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -5009,7 +5009,7 @@ public: { carla_stdout("Will use OSC-Bridge UI, binary: \"%s\"", bridgeBinary); fUI.type = UI::TYPE_OSC; - pData->osc.thread.setOscData(bridgeBinary, fDescriptor->URI, fUI.rdfDescriptor->URI); + pData->osc.thread.setOscData(bridgeBinary, fRdfDescriptor->URI, fUI.rdfDescriptor->URI, fUI.rdfDescriptor->Bundle); delete[] bridgeBinary; return; } diff --git a/source/bridges-ui/CarlaBridgeClient.cpp b/source/bridges-ui/CarlaBridgeClient.cpp index 3c0ad0189..8f550e965 100644 --- a/source/bridges-ui/CarlaBridgeClient.cpp +++ b/source/bridges-ui/CarlaBridgeClient.cpp @@ -39,7 +39,7 @@ CarlaBridgeClient::~CarlaBridgeClient() // --------------------------------------------------------------------- // ui initialization -bool CarlaBridgeClient::uiInit(const char* const, const char* const) +bool CarlaBridgeClient::uiInit(const char*, const char* const, const char* const) { carla_debug("CarlaBridgeClient::uiInit()"); diff --git a/source/bridges-ui/CarlaBridgeClient.hpp b/source/bridges-ui/CarlaBridgeClient.hpp index 0a30ad0de..685bc43bb 100644 --- a/source/bridges-ui/CarlaBridgeClient.hpp +++ b/source/bridges-ui/CarlaBridgeClient.hpp @@ -34,7 +34,7 @@ public: // --------------------------------------------------------------------- // ui initialization - virtual bool uiInit(const char* const, const char* const); + virtual bool uiInit(const char*, const char* const, const char* const); virtual void uiIdle() {} virtual void uiClose(); diff --git a/source/bridges-ui/CarlaBridgeUI-LV2.cpp b/source/bridges-ui/CarlaBridgeUI-LV2.cpp index 4da7d9afc..a99a4f3c7 100644 --- a/source/bridges-ui/CarlaBridgeUI-LV2.cpp +++ b/source/bridges-ui/CarlaBridgeUI-LV2.cpp @@ -350,12 +350,27 @@ public: // --------------------------------------------------------------------- // ui initialization - bool uiInit(const char* pluginURI, const char* uiURI) override + bool uiInit(const char* pluginURI, const char* uiURI, const char* uiBundle) override { + // ----------------------------------------------------------------- + // load bundle + + Lv2WorldClass& lv2World(Lv2WorldClass::getInstance()); + + Lilv::Node bundleNode(lv2World.new_file_uri(nullptr, uiBundle)); + CARLA_SAFE_ASSERT_RETURN(bundleNode.is_uri(), false); + + CarlaString sBundle(bundleNode.as_uri()); + + if (! sBundle.endsWith("/")) + sBundle += "/"; + + lv2World.load_bundle(sBundle); + // ----------------------------------------------------------------- // init - CarlaBridgeClient::uiInit(pluginURI, uiURI); + CarlaBridgeClient::uiInit(pluginURI, uiURI, uiBundle); // ----------------------------------------------------------------- // get plugin from lv2_rdf (lilv) @@ -1212,16 +1227,17 @@ int main(int argc, char* argv[]) { CARLA_BRIDGE_USE_NAMESPACE - if (argc != 5) + if (argc != 6) { - carla_stderr("usage: %s ", argv[0]); + carla_stderr("usage: %s ", argv[0]); return 1; } const char* oscUrl = argv[1]; const char* pluginURI = argv[2]; const char* uiURI = argv[3]; - const char* uiTitle = argv[4]; + const char* uiBundle = argv[4]; + const char* uiTitle = argv[5]; const bool useOsc(std::strcmp(oscUrl, "null") != 0); @@ -1242,7 +1258,7 @@ int main(int argc, char* argv[]) // Load UI int ret; - if (client.uiInit(pluginURI, uiURI)) + if (client.uiInit(pluginURI, uiURI, uiBundle)) { client.toolkitExec(!useOsc); ret = 0; diff --git a/source/bridges-ui/CarlaBridgeUI-VST.cpp b/source/bridges-ui/CarlaBridgeUI-VST.cpp index 7aa593365..3972d8201 100644 --- a/source/bridges-ui/CarlaBridgeUI-VST.cpp +++ b/source/bridges-ui/CarlaBridgeUI-VST.cpp @@ -51,12 +51,12 @@ public: // --------------------------------------------------------------------- // ui initialization - bool uiInit(const char* binary, const char*) override + bool uiInit(const char* binary, const char*, const char*) override { // ----------------------------------------------------------------- // init - CarlaBridgeClient::uiInit(binary, nullptr); + CarlaBridgeClient::uiInit(binary, nullptr, nullptr); // ----------------------------------------------------------------- // open DLL @@ -541,7 +541,7 @@ int main(int argc, char* argv[]) // Load UI int ret; - if (client.uiInit(binary, nullptr)) + if (client.uiInit(binary, nullptr, nullptr)) { client.toolkitExec(!useOsc); ret = 0;