On 18.09.24 16:05, ichthyo wrote:
The Thread in Yoshimi code is attempting to load the GUI-Plugin, but
trapped there in a safety loop I had added to ensure the Core plugin is up
and initialised before the GUI plugin can attach.

...and the fix is quite obvious: seemingly I was to defensive in assuming
that the core plugin will be activated before the GUI-Plugin can be loaded.

Yoshimi is using a non-standard extension and a native-gui-scheme, which is
not much documented in LV2 (quite contrary to the core standard and the
official way to build GUIs). Thus I am somewhat poking in the dark what
is the expected procedure for LV2-hosts to bring up a GUI.

Anyway, we can set the isReady flag earlier, at the point where the SynthEngine
has been booted up and we are about to return the LV2_Handle from instantiate()

A quick test shows the Yoshimi GUI comes up now in Reaper, Carla and QTractor.


I have attached the patch.
As usual, you can directly apply it as Git-commit (including my explanation)
by stepping into the Yoshimi dir and then

git am Bugfix-LV2-start-up-synchronisation-Yoshimi-UI.patch


Hopefully this has resolved the problem....

-- Hermann

From 99f518018f0b073ecc4d04dd1404d14726349dc4 Mon Sep 17 00:00:00 2001
From: Ichthyostega <p...@ichthyostega.de>
Date: Wed, 18 Sep 2024 16:27:18 +0200
Subject: [PATCH] Bugfix-LV2: start-up synchronisation Yoshimi-UI

with the GuiConnect branch, a synchronisation was introduced to
ensure the Yoshimi-LV2-core plugin is loaded completely before the
GUI-plugin will attempt to attach to the running SynthEngine.

The isReady-Flag was set in the activate() callback, which turned out
to be too late for the Reaper-DAW; this fix will set the isReady flag
a the point when the SynthEngine was booted and the instantiate() callback
is about to return the LV2_Handle to the host.
---
 src/LV2_Plugin/YoshimiLV2Plugin.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/LV2_Plugin/YoshimiLV2Plugin.cpp b/src/LV2_Plugin/YoshimiLV2Plugin.cpp
index 173fc3a0..0c1ad088 100644
--- a/src/LV2_Plugin/YoshimiLV2Plugin.cpp
+++ b/src/LV2_Plugin/YoshimiLV2Plugin.cpp
@@ -391,16 +391,19 @@ YoshimiLV2Plugin::YoshimiLV2Plugin(SynthEngine& _synth
 /** create a new distinct Yoshimi plugin instance; `activate()` will be called prior to `run()`. */
 LV2_Handle YoshimiLV2Plugin::instantiate(LV2_Descriptor const* desc, double sample_rate, const char *bundle_path, LV2_Feature const *const *features)
 {
-    LV2_Handle pluginHandle{};
+    YoshimiLV2Plugin* instance;
     auto instantiatePlugin = [&](SynthEngine& synth) -> MusicIO*
                                 {
-                                    auto instance = new YoshimiLV2Plugin(synth, sample_rate, bundle_path, features, *desc);
-                                    pluginHandle = static_cast<LV2_Handle>(instance);
+                                    instance = new YoshimiLV2Plugin(synth, sample_rate, bundle_path, features, *desc);
                                     return instance;  // note: will be stored/managed in MusicClient
                                 };
 
     if (Config::instances().startPluginInstance(instantiatePlugin))
-        return pluginHandle;
+    {
+        assert(instance);
+        instance->isReady.store(true, std::memory_order_release); // after this point, GUI-plugin may attach
+        return static_cast<LV2_Handle>(instance);
+    }
     else
         return nullptr;
 }
@@ -408,7 +411,6 @@ LV2_Handle YoshimiLV2Plugin::instantiate(LV2_Descriptor const* desc, double samp
 /** Initialise the plugin instance and activate it for use. */
 void YoshimiLV2Plugin::activate(LV2_Handle h)
 {
-    self(h).isReady.store(true, std::memory_order_release);
     self(h).runtime().Log("Yoshimi LV2 plugin activated");
 }
 
-- 
2.20.1

_______________________________________________
Yoshimi-devel mailing list
Yoshimi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/yoshimi-devel

Reply via email to