summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/PluginModel.cpp21
-rw-r--r--src/client/PluginUI.cpp79
-rw-r--r--src/client/PluginUI.hpp4
-rw-r--r--src/client/wscript2
-rw-r--r--src/gui/wscript1
-rw-r--r--wscript11
6 files changed, 58 insertions, 60 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 5d35902b..220da5a4 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -18,13 +18,17 @@
#include <sstream>
#include <ctype.h>
#include <boost/optional.hpp>
+
#include "raul/Path.hpp"
#include "raul/Atom.hpp"
-#include "ingen-config.h"
-#include "shared/LV2URIMap.hpp"
-#include "PluginModel.hpp"
+#include "slv2/ui.h"
+
#include "PatchModel.hpp"
+#include "PluginModel.hpp"
#include "PluginUI.hpp"
+#include "shared/LV2URIMap.hpp"
+
+#include "ingen-config.h"
using namespace std;
using namespace Raul;
@@ -191,17 +195,8 @@ PluginModel::port_human_name(uint32_t index) const
bool
PluginModel::has_ui() const
{
- SLV2Value gtk_gui_uri = slv2_value_new_uri(_slv2_world,
- "http://lv2plug.in/ns/extensions/ui#GtkUI");
-
SLV2UIs uis = slv2_plugin_get_uis(_slv2_plugin);
-
- if (slv2_values_size(uis) > 0)
- for (unsigned i=0; i < slv2_uis_size(uis); ++i)
- if (slv2_ui_is_a(slv2_uis_get_at(uis, i), gtk_gui_uri))
- return true;
-
- return false;
+ return (slv2_values_size(uis) > 0);
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 18ff52a1..29ecfa74 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -21,6 +21,8 @@
#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
+#include "slv2/ui.h"
+
#include "shared/LV2Atom.hpp"
#include "shared/LV2URIMap.hpp"
@@ -109,9 +111,7 @@ PluginUI::PluginUI(Ingen::Shared::World* world,
PluginUI::~PluginUI()
{
- if (_instance) {
- slv2_ui_instance_free(_instance);
- }
+ suil_instance_free(_instance);
}
@@ -120,48 +120,52 @@ PluginUI::create(Ingen::Shared::World* world,
SharedPtr<NodeModel> node,
SLV2Plugin plugin)
{
- SharedPtr<PluginUI> ret;
-
- SLV2Value gtk_gui_uri = slv2_value_new_uri(
- world->slv2_world(),
- "http://lv2plug.in/ns/extensions/ui#GtkUI");
-
- SLV2UIs uis = slv2_plugin_get_uis(plugin);
- SLV2UI ui = NULL;
-
- if (slv2_values_size(uis) > 0) {
- for (unsigned i=0; i < slv2_uis_size(uis); ++i) {
- SLV2UI this_ui = slv2_uis_get_at(uis, i);
- if (slv2_ui_is_a(this_ui, gtk_gui_uri)) {
- ui = this_ui;
- break;
- }
+ SharedPtr<PluginUI> ret(new PluginUI(world, node));
+ ret->_features = world->lv2_features()->lv2_features(world, node.get());
+
+ // Build Suil UI set for this plugin
+ const char* const plugin_uri = slv2_value_as_uri(slv2_plugin_get_uri(plugin));
+ SLV2UIs slv2_uis = slv2_plugin_get_uis(plugin);
+ SuilUIs suil_uis = suil_uis_new(plugin_uri);
+ for (unsigned i = 0; i < slv2_uis_size(slv2_uis); ++i) {
+ SLV2UI ui = slv2_uis_get_at(slv2_uis, i);
+ SLV2Values classes = slv2_ui_get_classes(ui);
+ SLV2Value type = slv2_values_get_at(classes, 0); // FIXME?
+ if (!suil_ui_type_supported(slv2_value_as_uri(type))) {
+ warn << "Unsupported LV2 UI type " << slv2_value_as_uri(type) << endl;
+ continue;
}
+
+ suil_uis_add(suil_uis,
+ slv2_value_as_uri(slv2_ui_get_uri(ui)),
+ slv2_value_as_uri(type),
+ slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_bundle_uri(ui))),
+ slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_binary_uri(ui))));
}
- if (ui) {
- info << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl;
- ret = SharedPtr<PluginUI>(new PluginUI(world, node));
- ret->_features = world->lv2_features()->lv2_features(world, node.get());
- SLV2UIInstance inst = slv2_ui_instantiate(
- plugin, ui, lv2_ui_write, ret.get(), ret->_features->array());
-
- if (inst) {
- ret->_instance = inst;
- } else {
- error << "Failed to instantiate Plugin UI" << endl;
- ret = SharedPtr<PluginUI>();
- }
+ // Attempt to instantiate a UI
+ SuilInstance instance = suil_instance_new(
+ suil_uis,
+ "http://lv2plug.in/ns/extensions/ui#GtkUI",
+ NULL,
+ lv2_ui_write,
+ ret.get(),
+ ret->_features->array());
+
+ if (instance) {
+ ret->_instance = instance;
+ } else {
+ error << "Failed to instantiate LV2 UI" << endl;
+ ret.reset();
}
- slv2_value_free(gtk_gui_uri);
return ret;
}
LV2UI_Widget
PluginUI::get_widget()
{
- return (LV2UI_Widget*)slv2_ui_instance_get_widget(_instance);
+ return (LV2UI_Widget*)suil_instance_get_widget(_instance);
}
void
@@ -170,12 +174,7 @@ PluginUI::port_event(uint32_t port_index,
uint32_t format,
const void* buffer)
{
- const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(_instance);
- LV2UI_Handle ui = slv2_ui_instance_get_handle(_instance);
-
- if (ui_desc->port_event) {
- ui_desc->port_event(ui, port_index, buffer_size, 0, buffer);
- }
+ suil_instance_port_event(_instance, port_index, buffer_size, format, buffer);
}
} // namespace Client
diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp
index bf60dcfa..ae1cd12e 100644
--- a/src/client/PluginUI.hpp
+++ b/src/client/PluginUI.hpp
@@ -20,7 +20,7 @@
#include "raul/SharedPtr.hpp"
#include "slv2/slv2.h"
-#include "slv2/ui.h"
+#include "suil/suil.h"
#include "LV2Features.hpp"
@@ -60,7 +60,7 @@ private:
Ingen::Shared::World* _world;
SharedPtr<NodeModel> _node;
- SLV2UIInstance _instance;
+ SuilInstance _instance;
SharedPtr<Shared::LV2Features::FeatureArray> _features;
};
diff --git a/src/client/wscript b/src/client/wscript
index 8a4540d0..38c0a598 100644
--- a/src/client/wscript
+++ b/src/client/wscript
@@ -36,5 +36,5 @@ def build(bld):
obj.target = 'ingen_client'
obj.install_path = '${LIBDIR}'
obj.use = 'libingen_shared'
- autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 RAUL SORD SOUP SIGCPP LIBLO SOUP')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 SUIL RAUL SORD SOUP SIGCPP LIBLO SOUP')
diff --git a/src/gui/wscript b/src/gui/wscript
index 8e6bf344..db9eed38 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -62,6 +62,7 @@ def build(bld):
SIGCPP
LV2CORE
SLV2
+ SUIL
SOUP
''')
diff --git a/wscript b/wscript
index eb9da81a..eda657ce 100644
--- a/wscript
+++ b/wscript
@@ -51,6 +51,8 @@ def configure(conf):
atleast_version='0.120.0', mandatory=False)
autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2',
atleast_version='0.6.0', mandatory=True)
+ autowaf.check_pkg(conf, 'suil', uselib_store='SUIL',
+ atleast_version='0.0.0', mandatory=True)
autowaf.check_pkg(conf, 'raul', uselib_store='RAUL',
atleast_version='0.6.2', mandatory=True)
autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS',
@@ -95,10 +97,10 @@ def configure(conf):
else:
autowaf.define(conf, 'INGEN_DATA_DIR', os.path.join(conf.env['DATADIR'], 'ingen'))
autowaf.define(conf, 'INGEN_MODULE_DIR', conf.env['LIBDIR'])
-
+
if Options.options.log_debug:
autowaf.define(conf, 'RAUL_LOG_DEBUG', 1)
-
+
if Options.options.liblo_bundles:
autowaf.define(conf, 'LIBLO_BUNDLES', 1)
@@ -110,6 +112,7 @@ def configure(conf):
autowaf.display_msg(conf, "OSC", str(conf.env['HAVE_LIBLO'] == 1))
autowaf.display_msg(conf, "HTTP", str(conf.env['HAVE_SOUP'] == 1))
autowaf.display_msg(conf, "LV2", str(conf.env['HAVE_SLV2'] == 1))
+ autowaf.display_msg(conf, "LV2 UI", str(conf.env['HAVE_SUIL'] == 1))
autowaf.display_msg(conf, "GUI", str(conf.env['INGEN_BUILD_GUI'] == 1))
print
@@ -117,7 +120,7 @@ def build(bld):
opts = Options.options
opts.datadir = opts.datadir or bld.env['PREFIX'] + 'share'
opts.moduledir = opts.moduledir or bld.env['PREFIX'] + 'lib/ingen'
-
+
# Headers
bld.install_files('${INCLUDEDIR}/ingen/interface',
bld.path.ant_glob('src/common/interface/*.hpp'))
@@ -140,7 +143,7 @@ def build(bld):
obj.defines = 'VERSION="' + bld.env['INGEN_VERSION'] + '"'
obj.use = 'libingen_module libingen_shared'
obj.install_path = '${BINDIR}'
- autowaf.use_lib(bld, obj, 'GTHREAD GLIBMM SORD RAUL LV2CORE SLV2 INGEN LIBLO SOUP')
+ autowaf.use_lib(bld, obj, 'GTHREAD GLIBMM SORD RAUL LV2CORE SLV2 SUIL INGEN LIBLO SOUP')
bld.install_files('${DATADIR}/applications', 'src/ingen/ingen.desktop')