Support compilation with (old) SLV2, or (new) Lilv and (optionally) Suil.

Fix ticket #0004041.


git-svn-id: svn://localhost/ardour2/branches/3.0@9516 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard
2011-05-15 23:10:13 +00:00
parent 3a855fb69a
commit 1959efd94d
7 changed files with 1237 additions and 25 deletions

View File

@@ -28,10 +28,15 @@
#include "lv2_ui.h"
#include <slv2/slv2.h>
/* Note this file is not compiled without either Suil or SLV2 present,
and if Suil is present then Lilv is also present.
*/
#if defined(HAVE_NEW_SLV2) && defined(HAVE_SUIL)
#ifdef HAVE_SUIL
#include <lilv/lilv.h>
#include <suil/suil.h>
#else
#include <slv2/slv2.h>
#endif
using namespace Gtk;
@@ -40,7 +45,7 @@ using namespace PBD;
#define NS_UI "http://lv2plug.in/ns/extensions/ui#"
#if defined(HAVE_NEW_SLV2) && defined(HAVE_SUIL)
#ifdef HAVE_SUIL
static SuilHost* ui_host = NULL;
#endif
@@ -85,7 +90,7 @@ LV2PluginUI::parameter_update(uint32_t port_index, float val)
}
#ifdef HAVE_SUIL
suil_instance_port_event(_inst, port_index, 4, 0, &val);
suil_instance_port_event((SuilInstance*)_inst, port_index, 4, 0, &val);
#else
SLV2UIInstance inst = (SLV2UIInstance)_inst;
const LV2UI_Descriptor* ui_desc = slv2_ui_instance_get_descriptor(inst);
@@ -184,7 +189,7 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
features_dst = (LV2_Feature**)_lv2->features();
}
#if defined(HAVE_NEW_SLV2) && defined(HAVE_SUIL)
#ifdef HAVE_SUIL
if (!ui_host) {
ui_host = suil_host_new(LV2PluginUI::lv2_ui_write, NULL, NULL, NULL);
}
@@ -192,16 +197,16 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
? NS_UI "external"
: NS_UI "GtkUI";
SLV2UI ui = _lv2->slv2_ui();
LilvUI* ui = (LilvUI*)_lv2->c_ui();
_inst = suil_instance_new(
ui_host,
this,
container_type,
slv2_value_as_uri(slv2_plugin_get_uri(_lv2->slv2_plugin())),
slv2_value_as_uri(slv2_ui_get_uri(ui)),
slv2_value_as_uri(_lv2->ui_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))),
_lv2->uri(),
lilv_node_as_uri(lilv_ui_get_uri(ui)),
lilv_node_as_uri((const LilvNode*)_lv2->c_ui_type()),
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
features_dst);
#else
_inst = slv2_ui_instantiate((SLV2Plugin)_lv2->c_plugin(),
@@ -215,7 +220,7 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
free(features_dst);
}
#if defined(HAVE_NEW_SLV2) && defined(HAVE_SUIL)
#ifdef HAVE_SUIL
#define GET_WIDGET(inst) suil_instance_get_widget((SuilInstance*)inst);
#else
#define GET_WIDGET(inst) slv2_ui_instance_get_widget((SLV2UIInstance)inst);
@@ -268,7 +273,7 @@ LV2PluginUI::~LV2PluginUI ()
}
/* Close and delete GUI. */
#if defined(HAVE_NEW_SLV2) && defined(HAVE_SUIL)
#ifdef HAVE_SUIL
suil_instance_free((SuilInstance*)_inst);
#else
SLV2UIInstance inst = (SLV2UIInstance)_inst;

View File

@@ -317,10 +317,7 @@ PluginUIWindow::app_activated (bool)
bool
PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert)
{
#ifndef LV2_SUPPORT
return false;
#else
#if defined(HAVE_SLV2) || defined(HAVE_SUIL)
boost::shared_ptr<LV2Plugin> vp;
if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (insert->plugin())) == 0) {
@@ -334,6 +331,8 @@ PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert)
}
return true;
#else
return false;
#endif
}

View File

@@ -321,7 +321,10 @@ def build(bld):
obj.cxxflags += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"']
obj.cxxflags += ['-I../libs']
if bld.env['HAVE_SLV2']:
if bld.env['HAVE_SUIL']:
obj.source += [ 'lv2_plugin_ui.cc' ]
obj.uselib += ' SUIL '
elif bld.env['HAVE_SLV2']:
obj.source += [ 'lv2_plugin_ui.cc' ]
obj.uselib += ' SLV2 '

View File

@@ -1,3 +1,4 @@
/*
Copyright (C) 2008-2011 Paul Davis
Author: David Robillard
@@ -68,6 +69,7 @@ class LV2Plugin : public ARDOUR::Plugin
void* c_plugin();
void* c_ui();
void* c_ui_type();
bool is_external_ui () const;

View File

@@ -439,6 +439,12 @@ LV2Plugin::c_ui ()
return _impl->ui;
}
void*
LV2Plugin::c_ui_type ()
{
return _impl->ui_type;
}
int
LV2Plugin::lv2_persist_store_callback(void* host_data,
uint32_t key,

File diff suppressed because it is too large Load Diff

View File

@@ -244,10 +244,12 @@ def configure(conf):
autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', atleast_version='0.4.0')
autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.0')
autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV', atleast_version='0.0.0', mandatory=False)
if conf.env['HAVE_LILV']:
autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL', atleast_version='0.2.0', mandatory=False)
autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2', atleast_version='0.6.4', mandatory=False)
autowaf.check_pkg(conf, 'slv2', uselib_store='NEW_SLV2', atleast_version='0.7.0', mandatory=False)
autowaf.check_pkg(conf, 'suil', uselib_store='SUIL', atleast_version='0.1.0', mandatory=False)
autowaf.check_pkg(conf, 'rasqal', uselib_store='RASQAL', atleast_version='0.9.14', mandatory=False)
if conf.env['HAVE_SLV2']:
autowaf.check_pkg(conf, 'rasqal', uselib_store='RASQAL', atleast_version='0.9.14', mandatory=False)
autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH', mandatory=False)
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
@@ -295,7 +297,7 @@ def configure(conf):
if ogg_supported():
conf.define ('HAVE_OGG', 1)
if conf.env['HAVE_SLV2']:
if conf.env['HAVE_LILV'] or conf.env['HAVE_SLV2']:
conf.define ('LV2_SUPPORT', 1)
conf.write_config_header('libardour-config.h')
@@ -333,11 +335,14 @@ def build(bld):
#obj.uselib += ' SOUNDTOUCH '
#obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
if bld.env['HAVE_SLV2']:
obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc', 'rdff.c' ]
obj.uselib += ' SLV2 ' + ' RASQAL '
if bld.env['HAVE_LILV']:
obj.source += [ 'lv2_plugin_lilv.cc', 'lv2_event_buffer.cc', 'uri_map.cc', 'rdff.c' ]
obj.uselib += ' LILV '
if bld.env['HAVE_SUIL']:
obj.uselib += ' SUIL '
elif bld.env['HAVE_SLV2']:
obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc', 'rdff.c' ]
obj.uselib += ' SLV2 RASQAL '
if bld.env['VST_SUPPORT']:
obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]