[SCM] calf/master: More work on external UI.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:39:59 UTC 2013


The following commit has been merged in the master branch:
commit a4d34c237b43d74fb86ded3aaaa47b7466f6a834
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Apr 3 16:30:41 2010 +0100

    More work on external UI.
    
    Modify the build system to build the executable file if either LV2 GUI or DSSI
    GUI is requested. Put the executable into the LV2 bundle. Run the executable
    from the LV2 GUI .so file. Still unimplemented: passing proper arguments,
    IPC between the executable and the LV2 GUI.

diff --git a/configure.ac b/configure.ac
index d1a5737..6ddda9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,12 +38,17 @@ AC_CHECK_HEADERS([jack/jack.h], have_jack_header=yes, have_jack_header=no)
 PKG_CHECK_MODULES(GLIB_DEPS, glib-2.0 >= 2.0.0, true, AC_MSG_ERROR([glib-2.0 library not found]))
 PKG_CHECK_MODULES(FLUIDSYNTH_DEPS, fluidsynth >= 1.0.7, true, AC_MSG_ERROR([fluidsynth library not found]))
 
+EXEC_GUI_ENABLED="no"
+DSSI_GUI_ENABLED="no"
+LV2_GUI_ENABLED="no"
+JACK_FOUND="no"
+JACK_ENABLED="no"
+OLD_JACK="no"
+GUI_ENABLED="no"
+
 if test "$have_jack_header" = "yes"; then
   PKG_CHECK_MODULES(JACK_DEPS, jack >= 0.103.0,
-    AC_CHECK_LIB([jack], [jack_port_register], JACK_FOUND="yes", JACK_FOUND="no"),
-    JACK_FOUND="no")
-else
-  JACK_FOUND="no"
+    AC_CHECK_LIB([jack], [jack_port_register], JACK_FOUND="yes", ),)
 fi
 
 if test "$JACK_FOUND" = "yes"; then
@@ -70,6 +75,7 @@ else
 fi
 PKG_CHECK_MODULES(SLV2_HACK, slv2 <= 0.6.1, SLV2_UNSUPPORTED="yes", SLV2_UNSUPPORTED="no")
 
+# Look for settings and installed libraries to determine what to compile/install/use
 if test "$LADSPA_FOUND" = "yes"; then
   AC_MSG_CHECKING([whether to allow LADSPA])
   AC_ARG_WITH(ladspa,
@@ -99,26 +105,20 @@ if test "$JACK_FOUND" = "yes" -o "$DSSI_FOUND" = "yes" -o "$LV2_ENABLED" = "yes"
     GUI_ENABLED="yes",
     GUI_ENABLED="no (GTK+ 2.8, cairo 1.2 and libglade 2.4.0 or newer required)"
   )
-else
-  GUI_ENABLED="no"
 fi
 
 if test "$GUI_ENABLED" = "yes" -a "$JACK_FOUND" = "yes"; then
   JACK_ENABLED="yes"
-else
-  JACK_ENABLED="no"
 fi
 
 if test "$GUI_ENABLED" = "yes" -a "$DSSI_FOUND" = "yes"; then
   DSSI_GUI_ENABLED="yes"
-else
-  DSSI_GUI_ENABLED="no"
+  EXEC_GUI_ENABLED="yes"
 fi
 
 if test "$GUI_ENABLED" = "yes" -a "$LV2_ENABLED" = "yes"; then
   LV2_GUI_ENABLED="yes"
-else
-  LV2_GUI_ENABLED="no"
+  EXEC_GUI_ENABLED="yes"
 fi
 
 AC_MSG_CHECKING([whether to enable experimental/unfinished features])
@@ -141,31 +141,29 @@ else
   CXXFLAGS="$CXXFLAGS -O3 -finline-functions -finline-functions-called-once -Wall"
 fi
 
+# Create automake conditional symbols
 AM_CONDITIONAL(USE_DSSI, test "$DSSI_FOUND" = "yes")
 AM_CONDITIONAL(USE_LADSPA, test "$LADSPA_FOUND" = "yes")
 AM_CONDITIONAL(USE_JACK, test "$JACK_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LV2, test "$LV2_ENABLED" = "yes")
 AM_CONDITIONAL(USE_GUI, test "$GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_DSSI_GUI, test "$DSSI_GUI_ENABLED" = "yes")
+AM_CONDITIONAL(USE_EXEC_GUI, test "$EXEC_GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LV2_GUI, test "$LV2_GUI_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LASH, test "$LASH_ENABLED" = "yes")
 AM_CONDITIONAL(USE_LASH_0_6, test "$LASH_0_6_ENABLED" = "yes")
 AM_CONDITIONAL(USE_DEBUG, test "$set_enable_debug" = "yes")
+
+# Create autoconf symbols
 if test "$LADSPA_FOUND" = "yes"; then
   AC_DEFINE([USE_LADSPA], [1], [LADSPA wrapper will be built])
 fi
 if test "$DSSI_FOUND" = "yes"; then
   AC_DEFINE(USE_DSSI, 1, [DSSI wrapper will be built])
 fi
-if test "$DSSI_GUI_ENABLED" = "yes"; then
-  AC_DEFINE(USE_DSSI_GUI, 1, [GTK+ GUI for DSSI  will be built])
-fi
 if test "$LV2_ENABLED" = "yes"; then
   AC_DEFINE(USE_LV2, 1, [LV2 wrapper will be built])
 fi
-if test "$LV2_GUI_ENABLED" = "yes"; then
-  AC_DEFINE(USE_LV2_GUI, 1, [GTK+ GUI for LV2 plugins will be built])
-fi
 if test "$JACK_ENABLED" = "yes"; then
   AC_DEFINE(USE_JACK, 1, [JACK I/O will be used])
 fi
@@ -178,6 +176,15 @@ if test "$LASH_ENABLED" = "yes"; then
     AC_DEFINE(USE_LASH_0_6, 1, "Unstable LASH API is enabled")
   fi
 fi
+if test "$EXEC_GUI_ENABLED" = "yes"; then
+  AC_DEFINE(USE_EXEC_GUI, 1, [Out-of-process GTK+ GUI for LV2/DSSI will be built])
+fi
+if test "$DSSI_GUI_ENABLED" = "yes"; then
+  AC_DEFINE(USE_DSSI_GUI, 1, [GTK+ GUI executable will be used for DSSI])
+fi
+if test "$LV2_GUI_ENABLED" = "yes"; then
+  AC_DEFINE(USE_LV2_GUI, 1, [GTK+ GUI executable will be used for LV2])
+fi
 if test "$set_enable_experimental" = "yes"; then
   AC_DEFINE([ENABLE_EXPERIMENTAL], [1], "Experimental features are enabled")
 fi
@@ -243,22 +250,23 @@ AC_CONFIG_FILES([Makefile
 AC_MSG_RESULT([
     Calf configured
 
-    Debug mode:             $set_enable_debug
-    Experimental plugins:   $set_enable_experimental
-    LADSPA enabled:         $LADSPA_FOUND
-    Common GUI code:        $GUI_ENABLED
-    DSSI enabled:           $DSSI_FOUND
-    DSSI GUI enabled:       $DSSI_GUI_ENABLED
-    LV2 enabled:            $LV2_ENABLED
-    LV2 GUI enabled:        $LV2_GUI_ENABLED
-    JACK host enabled:      $JACK_ENABLED
-    LASH enabled:           $LASH_ENABLED])
+    Debug mode:              $set_enable_debug
+    Experimental plugins:    $set_enable_experimental
+    LADSPA enabled:          $LADSPA_FOUND
+    Common GUI code:         $GUI_ENABLED
+    Out-of-process GUI code: $EXEC_GUI_ENABLED
+    DSSI enabled:            $DSSI_FOUND
+    DSSI GUI enabled:        $DSSI_GUI_ENABLED
+    LV2 enabled:             $LV2_ENABLED
+    LV2 GUI enabled:         $LV2_GUI_ENABLED
+    JACK host enabled:       $JACK_ENABLED
+    LASH enabled:            $LASH_ENABLED])
 if test "$LASH_ENABLED" = "yes"; then
-  AC_MSG_RESULT([    Unstable LASH API:      $LASH_0_6_ENABLED])
+  AC_MSG_RESULT([    Unstable LASH API:       $LASH_0_6_ENABLED])
 fi
-AC_MSG_RESULT([    Old-style JACK MIDI:    $OLD_JACK
+AC_MSG_RESULT([    Old-style JACK MIDI:     $OLD_JACK
     
-    Installation prefix:    $prefix
+    Installation prefix:     $prefix
 ])
 
 if test "$SLV2_UNSUPPORTED" == "yes" -a "$LV2_ENABLED" == "yes"; then 
diff --git a/src/Makefile.am b/src/Makefile.am
index b19e3ec..1f7ca74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ INCLUDES = -I$(top_srcdir) -I$(srcdir)
 SUBDIRS = calf
 
 ladspadir = $(with_ladspa_dir)
-lv2dir = $(with_lv2_dir)
+lv2dir = $(with_lv2_dir)/calf.lv2
 
 bin_PROGRAMS = 
 
@@ -17,6 +17,7 @@ dssi_PROGRAMS = calf_gtk
 endif
 if USE_LV2_GUI
 noinst_LTLIBRARIES += calflv2gui.la
+lv2_PROGRAMS = calf_gtk
 endif
 
 AM_CXXFLAGS = -ffast-math -finline-limit=80 $(FLUIDSYNTH_DEPS_CFLAGS)
@@ -44,7 +45,7 @@ calfmakerdf_LDADD = libcalfstatic.la
 calfbenchmark_SOURCES = benchmark.cpp
 calfbenchmark_LDADD = $(GLIB_DEPS_LIBS) libcalfstatic.la
 
-if USE_DSSI_GUI
+if USE_EXEC_GUI
 calf_gtk_SOURCES = dssigui.cpp
 calf_gtk_LDADD = libcalfstatic.la libcalfgui.la $(GLIB_DEPS_LIBS) $(GUI_DEPS_LIBS)
 calfbenchmark_CXXFLAGS = $(AM_CXXFLAGS) -DTEST_OSC
@@ -97,24 +98,25 @@ if USE_DSSI
 	install -c -m 755 $(top_builddir)/src/.libs/calf.so $(DESTDIR)$(with_dssi_dir)/calf.so
 endif
 if USE_LV2
-	install -d -m 755 $(DESTDIR)$(with_lv2_dir)/calf.lv2
-	install -c -m 755 $(top_builddir)/src/.libs/calf.so $(DESTDIR)$(with_lv2_dir)/calf.lv2/calf.so
+	install -d -m 755 $(DESTDIR)$(lv2dir)
+	install -c -m 755 $(top_builddir)/src/.libs/calf.so $(DESTDIR)$(lv2dir)/calf.so
 if USE_LV2_GUI
-	install -c -m 755 $(top_builddir)/src/.libs/calflv2gui.so $(DESTDIR)$(with_lv2_dir)/calf.lv2/calflv2gui.so
+	install -c -m 755 $(top_builddir)/src/.libs/calflv2gui.so $(DESTDIR)$(lv2dir)/calflv2gui.so
 endif
-	rm -f $(DESTDIR)$(with_lv2_dir)/calf.lv2/*.ttl
-	$(top_builddir)/src/calfmakerdf -m ttl -p $(DESTDIR)$(with_lv2_dir)/calf.lv2/
+	rm -f $(DESTDIR)$(lv2dir)/*.ttl
+	$(top_builddir)/src/calfmakerdf -m ttl -p $(DESTDIR)$(lv2dir)/
 endif
 
 #remove calf.so, calf.rdf and - if empty - ladspa dir in usr/share
 uninstall-hook:
 if USE_LV2
 if USE_LV2_GUI
-	rm -f $(DESTDIR)$(with_lv2_dir)/calf.lv2/calflv2gui.so
+	rm -f $(DESTDIR)$(lv2dir)/calflv2gui.so
+	rm -f $(DESTDIR)$(lv2dir)/calf_gtk
 endif
-	rm -f $(DESTDIR)$(with_lv2_dir)/calf.lv2/calf.so
-	rm -f $(DESTDIR)$(with_lv2_dir)/calf.lv2/*.ttl
-	rmdir -p $(DESTDIR)$(with_lv2_dir)/calf.lv2 || true
+	rm -f $(DESTDIR)$(lv2dir)/calf.so
+	rm -f $(DESTDIR)$(lv2dir)/*.ttl
+	rmdir -p $(DESTDIR)$(lv2dir) || true
 endif
 if USE_JACK
 	rm -f $(DESTDIR)$(pkgdatadir)/calf.glade 
diff --git a/src/lv2gui.cpp b/src/lv2gui.cpp
index 1d951f2..eca03f7 100644
--- a/src/lv2gui.cpp
+++ b/src/lv2gui.cpp
@@ -22,6 +22,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <config.h>
+#include <sys/wait.h>
 #include <calf/giface.h>
 #include <calf/gui.h>
 #include <calf/main_win.h>
@@ -286,31 +287,61 @@ class ext_plugin_gui: public lv2_external_ui
 public:
     LV2UI_Write_Function write_function;
     LV2UI_Controller controller;
+    const LV2_Feature* const* features;
+    lv2_external_ui_host *host;
+    GPid child_pid;
 
-    ext_plugin_gui(LV2UI_Write_Function wf, LV2UI_Controller c);
+    ext_plugin_gui(LV2UI_Write_Function wf, LV2UI_Controller c, const LV2_Feature* const* f);
+
+    bool initialise();
 
     void show_impl() { printf("show\n"); }
     void hide_impl() { printf("hide\n"); }
-    void run_impl()  { printf("run\n"); }
+    void run_impl();
 
     virtual ~ext_plugin_gui() {}
         
-    static void show_(lv2_external_ui *h) { (static_cast<ext_plugin_gui *>(h))->show_impl(); }
-    static void hide_(lv2_external_ui *h) { (static_cast<ext_plugin_gui *>(h))->hide_impl(); }
-    static void run_(lv2_external_ui *h) { (static_cast<ext_plugin_gui *>(h))->run_impl(); }
+    static void show_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->show_impl(); }
+    static void hide_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->hide_impl(); }
+    static void run_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->run_impl(); }
     
 };
 
-ext_plugin_gui::ext_plugin_gui(LV2UI_Write_Function wf, LV2UI_Controller c)
+ext_plugin_gui::ext_plugin_gui(LV2UI_Write_Function wf, LV2UI_Controller c, const LV2_Feature* const* f)
 {
     write_function = wf;
     controller = c;
+    features = f;
+    host = NULL;
     
     show = show_;
     hide = hide_;
     run = run_;
 }
 
+bool ext_plugin_gui::initialise()
+{
+    for(const LV2_Feature* const* i = features; *i; i++)
+    {
+        if (!strcmp((*i)->URI, LV2_EXTERNAL_UI_URI))
+        {
+            host = (lv2_external_ui_host *)(*i)->data;
+            break;
+        }
+    }
+    return (host != NULL);
+}
+
+void ext_plugin_gui::run_impl()
+{
+    int status = 0;
+    if (waitpid(child_pid, &status, WNOHANG) != 0)
+    {
+        host->ui_closed(controller);
+    }
+}
+
+
 LV2UI_Handle extgui_instantiate(const struct _LV2UI_Descriptor* descriptor,
                           const char*                     plugin_uri,
                           const char*                     bundle_path,
@@ -319,23 +350,39 @@ LV2UI_Handle extgui_instantiate(const struct _LV2UI_Descriptor* descriptor,
                           LV2UI_Widget*                   widget,
                           const LV2_Feature* const*       features)
 {
-    ext_plugin_gui *ui = new ext_plugin_gui(write_function, controller);
-    *widget = (LV2UI_Widget)ui;
-    return (LV2UI_Handle)ui;
+    ext_plugin_gui *ui = new ext_plugin_gui(write_function, controller, features);
+    if (!ui->initialise())
+        return NULL;
+    
+    const gchar *argv[] = { "./calf_gtk", "url", "calf.so", plugin_uri, (ui->host->plugin_human_id ? ui->host->plugin_human_id : "Unknown"), NULL };
+    GError *error = NULL;
+    if (g_spawn_async(bundle_path, (gchar **)argv, NULL, (GSpawnFlags)0, NULL, NULL, &ui->child_pid, &error))
+    {
+        *(lv2_external_ui **)widget = ui;
+        return (LV2UI_Handle)ui;
+    }
+    else
+    {
+        g_warning("%s\n", error->message);
+        return NULL;
+    }
 }
 
 void extgui_cleanup(LV2UI_Handle handle)
 {
     ext_plugin_gui *gui = (ext_plugin_gui *)handle;
     delete gui;
+    printf("cleanup\n");
 }
 
 void extgui_port_event(LV2UI_Handle handle, uint32_t port, uint32_t buffer_size, uint32_t format, const void *buffer)
 {
+    printf("port event %d\n", port);
 }
 
 const void *extgui_extension(const char *uri)
 {
+    printf("extgui_extension %s\n", uri);
     return NULL;
 }
 
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 6ddf9b9..b1988fd 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -334,12 +334,18 @@ void make_ttl(string path_prefix)
     string gui_header;
     
 #if USE_LV2_GUI
-    string gui_uri = "<http://calf.sourceforge.net/plugins/gui/gtk2-gui>";
-    gui_header = gui_uri + "\n"
+    string gtkgui_uri = "<http://calf.sourceforge.net/plugins/gui/gtk2-gui>";
+    gui_header = gtkgui_uri + "\n"
         "    a uiext:GtkUI ;\n"
         "    uiext:binary <calflv2gui.so> ;\n"
         "    uiext:requiredFeature uiext:makeResident .\n"
-        "    \n"
+        "\n"
+    ;
+    string extgui_uri = "<http://calf.sourceforge.net/plugins/gui/ext-gui>";
+    gui_header += extgui_uri + "\n"
+        "    a uiext:external ;\n"
+        "    uiext:binary <calflv2gui.so> .\n"
+        "\n"
     ;
 #endif
     
@@ -358,7 +364,11 @@ void make_ttl(string path_prefix)
         {
             parameter_properties &props = *pi->get_param_props(j);
             if (props.flags & PF_PROP_OUTPUT)
-                ttl += gui_uri + " uiext:portNotification [\n    uiext:plugin " + uri + " ;\n    uiext:portIndex " + i2s(j) + "\n] .\n\n";
+            {
+                string portnot = " uiext:portNotification [\n    uiext:plugin " + uri + " ;\n    uiext:portIndex " + i2s(j) + "\n] .\n\n";
+                ttl += gtkgui_uri + portnot;
+                ttl += extgui_uri + portnot;
+            }
         }
 #endif
         
@@ -373,6 +383,7 @@ void make_ttl(string path_prefix)
 
 #if USE_LV2_GUI
         ttl += "    uiext:ui <http://calf.sourceforge.net/plugins/gui/gtk2-gui> ;\n";
+        ttl += "    uiext:ui <http://calf.sourceforge.net/plugins/gui/ext-gui> ;\n";
         ttl += "    lv2:optionalFeature <http://lv2plug.in/ns/ext/instance-access> ;\n";
         ttl += "    lv2:optionalFeature <http://lv2plug.in/ns/ext/data-access> ;\n";
 #endif

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list