From 77d22f06129e91f51e37c09c71c0917a0136dd7d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 28 Apr 2011 22:14:04 +0000 Subject: Switch to Lilv from SLV2. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3220 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/NodeModel.cpp | 22 +++---- src/client/PluginModel.cpp | 142 ++++++++++++++++++++++----------------------- src/client/PluginModel.hpp | 30 +++++----- src/client/PluginUI.cpp | 32 +++++----- src/client/PluginUI.hpp | 4 +- src/client/wscript | 2 +- 6 files changed, 116 insertions(+), 116 deletions(-) (limited to 'src/client') diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 34c70765..f7321472 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -169,14 +169,14 @@ NodeModel::default_port_value_range(SharedPtr port, float& min, float max = 1.0; // Get range from client-side LV2 data -#ifdef HAVE_SLV2 +#ifdef HAVE_LILV if (_plugin && _plugin->type() == PluginModel::LV2) { if (!_min_values) { - _num_values = slv2_plugin_get_num_ports(_plugin->slv2_plugin()); + _num_values = lilv_plugin_get_num_ports(_plugin->lilv_plugin()); _min_values = new float[_num_values]; _max_values = new float[_num_values]; - slv2_plugin_get_port_ranges_float(_plugin->slv2_plugin(), + lilv_plugin_get_port_ranges_float(_plugin->lilv_plugin(), _min_values, _max_values, 0); } @@ -215,16 +215,16 @@ NodeModel::port_label(SharedPtr port) const return name.get_string(); } -#ifdef HAVE_SLV2 +#ifdef HAVE_LILV if (_plugin && _plugin->type() == PluginModel::LV2) { - SLV2World c_world = _plugin->slv2_world(); - SLV2Plugin c_plugin = _plugin->slv2_plugin(); - SLV2Value c_sym = slv2_value_new_string(c_world, port->symbol().c_str()); - SLV2Port c_port = slv2_plugin_get_port_by_symbol(c_plugin, c_sym); + LilvWorld c_world = _plugin->lilv_world(); + LilvPlugin c_plugin = _plugin->lilv_plugin(); + LilvValue c_sym = lilv_value_new_string(c_world, port->symbol().c_str()); + LilvPort c_port = lilv_plugin_get_port_by_symbol(c_plugin, c_sym); if (c_port) { - SLV2Value c_name = slv2_port_get_name(c_plugin, c_port); - if (c_name && slv2_value_is_string(c_name)) { - return slv2_value_as_string(c_name); + LilvValue c_name = lilv_port_get_name(c_plugin, c_port); + if (c_name && lilv_value_is_string(c_name)) { + return lilv_value_as_string(c_name); } } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 77b3e4c9..dd22549b 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -35,9 +35,9 @@ using namespace Raul; namespace Ingen { namespace Client { -#ifdef HAVE_SLV2 -SLV2World PluginModel::_slv2_world = NULL; -SLV2Plugins PluginModel::_slv2_plugins = NULL; +#ifdef HAVE_LILV +LilvWorld PluginModel::_lilv_world = NULL; +LilvPlugins PluginModel::_lilv_plugins = NULL; #endif Sord::World* PluginModel::_rdf_world = NULL; @@ -51,10 +51,10 @@ PluginModel::PluginModel(Shared::LV2URIMap& uris, assert(_rdf_world); add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", this->type_uri()); -#ifdef HAVE_SLV2 - SLV2Value plugin_uri = slv2_value_new_uri(_slv2_world, uri.c_str()); - _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, plugin_uri); - slv2_value_free(plugin_uri); +#ifdef HAVE_LILV + LilvValue plugin_uri = lilv_value_new_uri(_lilv_world, uri.c_str()); + _lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri); + lilv_value_free(plugin_uri); #endif if (_type == Internal) set_property("http://usefulinc.com/ns/doap#name", @@ -97,29 +97,29 @@ PluginModel::get_property(const URI& key) const return get_property(key); } -#ifdef HAVE_SLV2 - if (_slv2_plugin) { +#ifdef HAVE_LILV + if (_lilv_plugin) { boost::optional ret; - SLV2Value lv2_pred = slv2_value_new_uri(_slv2_world, key.str().c_str()); - SLV2Values values = slv2_plugin_get_value(_slv2_plugin, lv2_pred); - slv2_value_free(lv2_pred); - SLV2_FOREACH(values, i, values) { - SLV2Value val = slv2_values_get(values, i); - if (slv2_value_is_uri(val)) { - ret = set_property(key, Atom(Atom::URI, slv2_value_as_uri(val))); + LilvValue lv2_pred = lilv_value_new_uri(_lilv_world, key.str().c_str()); + LilvValues values = lilv_plugin_get_value(_lilv_plugin, lv2_pred); + lilv_value_free(lv2_pred); + LILV_FOREACH(values, i, values) { + LilvValue val = lilv_values_get(values, i); + if (lilv_value_is_uri(val)) { + ret = set_property(key, Atom(Atom::URI, lilv_value_as_uri(val))); break; - } else if (slv2_value_is_string(val)) { - ret = set_property(key, slv2_value_as_string(val)); + } else if (lilv_value_is_string(val)) { + ret = set_property(key, lilv_value_as_string(val)); break; - } else if (slv2_value_is_float(val)) { - ret = set_property(key, Atom(slv2_value_as_float(val))); + } else if (lilv_value_is_float(val)) { + ret = set_property(key, Atom(lilv_value_as_float(val))); break; - } else if (slv2_value_is_int(val)) { - ret = set_property(key, Atom(slv2_value_as_int(val))); + } else if (lilv_value_is_int(val)) { + ret = set_property(key, Atom(lilv_value_as_int(val))); break; } } - slv2_values_free(values); + lilv_values_free(values); if (ret) return *ret; @@ -134,10 +134,10 @@ PluginModel::set(SharedPtr p) { _type = p->_type; -#ifdef HAVE_SLV2 +#ifdef HAVE_LILV _icon_path = p->_icon_path; - if (p->_slv2_plugin) - _slv2_plugin = p->_slv2_plugin; + if (p->_lilv_plugin) + _lilv_plugin = p->_lilv_plugin; #endif for (Properties::const_iterator v = p->properties().begin(); v != p->properties().end(); ++v) { @@ -171,24 +171,24 @@ PluginModel::human_name() string PluginModel::port_human_name(uint32_t index) const { -#ifdef HAVE_SLV2 - if (_slv2_plugin) { - SLV2Port port = slv2_plugin_get_port_by_index(_slv2_plugin, index); - SLV2Value name = slv2_port_get_name(_slv2_plugin, port); - string ret = slv2_value_as_string(name); - slv2_value_free(name); +#ifdef HAVE_LILV + if (_lilv_plugin) { + LilvPort port = lilv_plugin_get_port_by_index(_lilv_plugin, index); + LilvValue name = lilv_port_get_name(_lilv_plugin, port); + string ret = lilv_value_as_string(name); + lilv_value_free(name); return ret; } #endif return ""; } -#ifdef HAVE_SLV2 +#ifdef HAVE_LILV bool PluginModel::has_ui() const { - SLV2UIs uis = slv2_plugin_get_uis(_slv2_plugin); - return (slv2_values_size(uis) > 0); + LilvUIs uis = lilv_plugin_get_uis(_lilv_plugin); + return (lilv_values_size(uis) > 0); } SharedPtr @@ -197,7 +197,7 @@ PluginModel::ui(Ingen::Shared::World* world, SharedPtr node) const if (_type != LV2) return SharedPtr(); - SharedPtr ret = PluginUI::create(world, node, _slv2_plugin); + SharedPtr ret = PluginUI::create(world, node, _lilv_plugin); return ret; } @@ -205,7 +205,7 @@ const string& PluginModel::icon_path() const { if (_icon_path.empty() && _type == LV2) { - _icon_path = get_lv2_icon_path(_slv2_plugin); + _icon_path = get_lv2_icon_path(_lilv_plugin); } return _icon_path; @@ -213,22 +213,22 @@ PluginModel::icon_path() const /** RDF world mutex must be held by the caller */ string -PluginModel::get_lv2_icon_path(SLV2Plugin plugin) +PluginModel::get_lv2_icon_path(LilvPlugin plugin) { string result; - SLV2Value svg_icon_pred = slv2_value_new_uri(_slv2_world, + LilvValue svg_icon_pred = lilv_value_new_uri(_lilv_world, "http://ll-plugins.nongnu.org/lv2/namespace#svgIcon"); - SLV2Values paths = slv2_plugin_get_value(plugin, svg_icon_pred); + LilvValues paths = lilv_plugin_get_value(plugin, svg_icon_pred); - if (slv2_values_size(paths) > 0) { - SLV2Value value = slv2_values_get_first(paths); - if (slv2_value_is_uri(value)) - result = slv2_uri_to_path(slv2_value_as_string(value)); - slv2_values_free(paths); + if (lilv_values_size(paths) > 0) { + LilvValue value = lilv_values_get_first(paths); + if (lilv_value_is_uri(value)) + result = lilv_uri_to_path(lilv_value_as_string(value)); + lilv_values_free(paths); } - slv2_value_free(svg_icon_pred); + lilv_value_free(svg_icon_pred); return result; } #endif @@ -237,23 +237,23 @@ std::string PluginModel::documentation() const { std::string doc; - #ifdef HAVE_SLV2 - if (!_slv2_plugin) + #ifdef HAVE_LILV + if (!_lilv_plugin) return doc; - //SLV2Value lv2_documentation = slv2_value_new_uri( - // _slv2_world, SLV2_NAMESPACE_LV2 "documentation"); - SLV2Value rdfs_comment = slv2_value_new_uri( - _slv2_world, "http://www.w3.org/2000/01/rdf-schema#comment"); + //LilvValue lv2_documentation = lilv_value_new_uri( + // _lilv_world, LILV_NAMESPACE_LV2 "documentation"); + LilvValue rdfs_comment = lilv_value_new_uri( + _lilv_world, "http://www.w3.org/2000/01/rdf-schema#comment"); - SLV2Values vals = slv2_plugin_get_value(_slv2_plugin, + LilvValues vals = lilv_plugin_get_value(_lilv_plugin, rdfs_comment); - SLV2Value val = slv2_values_get_first(vals); - if (slv2_value_is_string(val)) { - doc += slv2_value_as_string(val); + LilvValue val = lilv_values_get_first(vals); + if (lilv_value_is_string(val)) { + doc += lilv_value_as_string(val); } - slv2_value_free(rdfs_comment); - slv2_values_free(vals); + lilv_value_free(rdfs_comment); + lilv_values_free(vals); #endif return doc; } @@ -262,26 +262,26 @@ std::string PluginModel::port_documentation(uint32_t index) const { std::string doc; - #ifdef HAVE_SLV2 - if (!_slv2_plugin) + #ifdef HAVE_LILV + if (!_lilv_plugin) return doc; - SLV2Port port = slv2_plugin_get_port_by_index(_slv2_plugin, index); + LilvPort port = lilv_plugin_get_port_by_index(_lilv_plugin, index); - //SLV2Value lv2_documentation = slv2_value_new_uri( - // _slv2_world, SLV2_NAMESPACE_LV2 "documentation"); - SLV2Value rdfs_comment = slv2_value_new_uri( - _slv2_world, "http://www.w3.org/2000/01/rdf-schema#comment"); + //LilvValue lv2_documentation = lilv_value_new_uri( + // _lilv_world, LILV_NAMESPACE_LV2 "documentation"); + LilvValue rdfs_comment = lilv_value_new_uri( + _lilv_world, "http://www.w3.org/2000/01/rdf-schema#comment"); - SLV2Values vals = slv2_port_get_value(_slv2_plugin, + LilvValues vals = lilv_port_get_value(_lilv_plugin, port, rdfs_comment); - SLV2Value val = slv2_values_get_first(vals); - if (slv2_value_is_string(val)) { - doc += slv2_value_as_string(val); + LilvValue val = lilv_values_get_first(vals); + if (lilv_value_is_string(val)) { + doc += lilv_value_as_string(val); } - slv2_value_free(rdfs_comment); - slv2_values_free(vals); + lilv_value_free(rdfs_comment); + lilv_values_free(vals); #endif return doc; } diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index 0d72af12..e7076ff2 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -27,8 +27,8 @@ #include "ingen-config.h" -#ifdef HAVE_SLV2 -#include "slv2/slv2.h" +#ifdef HAVE_LILV +#include "lilv/lilv.h" #endif #include "ingen/ServerInterface.hpp" #include "ingen/Plugin.hpp" @@ -67,17 +67,17 @@ public: std::string human_name(); std::string port_human_name(uint32_t index) const; -#ifdef HAVE_SLV2 - static SLV2World slv2_world() { return _slv2_world; } - SLV2Plugin slv2_plugin() const { return _slv2_plugin; } +#ifdef HAVE_LILV + static LilvWorld lilv_world() { return _lilv_world; } + LilvPlugin lilv_plugin() const { return _lilv_plugin; } - SLV2Port slv2_port(uint32_t index) { - return slv2_plugin_get_port_by_index(_slv2_plugin, index); + LilvPort lilv_port(uint32_t index) { + return lilv_plugin_get_port_by_index(_lilv_plugin, index); } - static void set_slv2_world(SLV2World world) { - _slv2_world = world; - _slv2_plugins = slv2_world_get_all_plugins(_slv2_world); + static void set_lilv_world(LilvWorld world) { + _lilv_world = world; + _lilv_plugins = lilv_world_get_all_plugins(_lilv_world); } bool has_ui() const; @@ -86,7 +86,7 @@ public: SharedPtr node) const; const std::string& icon_path() const; - static std::string get_lv2_icon_path(SLV2Plugin plugin); + static std::string get_lv2_icon_path(LilvPlugin plugin); #endif std::string documentation() const; @@ -109,11 +109,11 @@ protected: private: Type _type; -#ifdef HAVE_SLV2 - static SLV2World _slv2_world; - static SLV2Plugins _slv2_plugins; +#ifdef HAVE_LILV + static LilvWorld _lilv_world; + static LilvPlugins _lilv_plugins; - SLV2Plugin _slv2_plugin; + LilvPlugin _lilv_plugin; mutable std::string _icon_path; #endif diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index f8232426..437e0f27 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -117,7 +117,7 @@ PluginUI::~PluginUI() SharedPtr PluginUI::create(Ingen::Shared::World* world, SharedPtr node, - SLV2Plugin plugin) + LilvPlugin plugin) { if (!PluginUI::ui_host) { PluginUI::ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL); @@ -125,14 +125,14 @@ PluginUI::create(Ingen::Shared::World* world, static const char* gtk_ui_uri = "http://lv2plug.in/ns/extensions/ui#GtkUI"; - SLV2Value gtk_ui = slv2_value_new_uri(world->slv2_world(), gtk_ui_uri); + LilvValue gtk_ui = lilv_value_new_uri(world->lilv_world(), gtk_ui_uri); - SLV2UIs uis = slv2_plugin_get_uis(plugin); - SLV2UI ui = NULL; - SLV2Value ui_type = NULL; - SLV2_FOREACH(uis, u, uis) { - SLV2UI this_ui = slv2_uis_get(uis, u); - if (slv2_ui_is_supported(this_ui, + LilvUIs uis = lilv_plugin_get_uis(plugin); + LilvUI ui = NULL; + LilvValue ui_type = NULL; + LILV_FOREACH(uis, u, uis) { + LilvUI this_ui = lilv_uis_get(uis, u); + if (lilv_ui_is_supported(this_ui, suil_ui_supported, gtk_ui, &ui_type)) { @@ -143,7 +143,7 @@ PluginUI::create(Ingen::Shared::World* world, } if (!ui) { - slv2_value_free(gtk_ui); + lilv_value_free(gtk_ui); return SharedPtr(); } @@ -153,15 +153,15 @@ PluginUI::create(Ingen::Shared::World* world, SuilInstance* instance = suil_instance_new( PluginUI::ui_host, ret.get(), - slv2_value_as_uri(gtk_ui), - slv2_value_as_uri(slv2_plugin_get_uri(plugin)), - slv2_value_as_uri(slv2_ui_get_uri(ui)), - slv2_value_as_uri(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))), + lilv_value_as_uri(gtk_ui), + lilv_value_as_uri(lilv_plugin_get_uri(plugin)), + lilv_value_as_uri(lilv_ui_get_uri(ui)), + lilv_value_as_uri(ui_type), + lilv_uri_to_path(lilv_value_as_uri(lilv_ui_get_bundle_uri(ui))), + lilv_uri_to_path(lilv_value_as_uri(lilv_ui_get_binary_uri(ui))), ret->_features->array()); - slv2_value_free(gtk_ui); + lilv_value_free(gtk_ui); if (instance) { ret->_instance = instance; diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp index d2e13d9d..fd8d14f4 100644 --- a/src/client/PluginUI.hpp +++ b/src/client/PluginUI.hpp @@ -20,7 +20,7 @@ #include "raul/SharedPtr.hpp" -#include "slv2/slv2.h" +#include "lilv/lilv.h" #include "suil/suil.h" @@ -46,7 +46,7 @@ public: static SharedPtr create(Ingen::Shared::World* world, SharedPtr node, - SLV2Plugin plugin); + LilvPlugin plugin); SuilWidget get_widget(); diff --git a/src/client/wscript b/src/client/wscript index be1e64f1..99b1c1b6 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -36,4 +36,4 @@ def build(bld): obj.target = 'ingen_client' obj.install_path = '${LIBDIR}' obj.use = 'libingen_shared' - autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 SUIL RAUL SORD SOUP SIGCPP LIBLO SOUP') + autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE LILV SUIL RAUL SORD SOUP SIGCPP LIBLO SOUP') -- cgit v1.2.1