summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-25 04:10:48 +0000
committerDavid Robillard <d@drobilla.net>2013-12-25 04:10:48 +0000
commitbfebcd3221c682375656a3a7a038d514ae94c148 (patch)
tree9d6462d8e74df00dbc0ea588b11ea91dbd15ce68 /src
parent97e5f92f2395622c562e607ddc96d9304a8966e8 (diff)
downloadingen-bfebcd3221c682375656a3a7a038d514ae94c148.tar.gz
ingen-bfebcd3221c682375656a3a7a038d514ae94c148.tar.bz2
ingen-bfebcd3221c682375656a3a7a038d514ae94c148.zip
Implement lv2:connectionOptional (#847).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5197 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/BlockFactory.cpp8
-rw-r--r--src/server/LV2Block.cpp13
2 files changed, 18 insertions, 3 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 56fefd3f..c98de283 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -129,6 +129,9 @@ BlockFactory::load_lv2_plugins()
lilv_node_free));
}
+ LilvNode* lv2_connectionOptional = lilv_new_uri(
+ _world->lilv_world(), LV2_CORE__connectionOptional);
+
const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world());
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i);
@@ -168,7 +171,8 @@ BlockFactory::load_lv2_plugins()
break;
}
}
- if (!supported) {
+ if (!supported &&
+ !lilv_port_has_property(lv2_plug, port, lv2_connectionOptional)) {
_world->log().warn(
fmt("Ignoring <%1%>; unsupported port <%2%>\n")
% uri % lilv_node_as_string(
@@ -186,6 +190,8 @@ BlockFactory::load_lv2_plugins()
_plugins.insert(make_pair(uri, plugin));
}
}
+
+ lilv_node_free(lv2_connectionOptional);
}
} // namespace Server
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 7b1dc3f3..0525a2db 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -211,6 +211,9 @@ LV2Block::instantiate(BufferFactory& bufs)
Ingen::Forge& forge = bufs.forge();
const uint32_t num_ports = lilv_plugin_get_num_ports(plug);
+ LilvNode* lv2_connectionOptional = lilv_new_uri(
+ bufs.engine().world()->lilv_world(), LV2_CORE__connectionOptional);
+
_ports = new Raul::Array<PortImpl*>(num_ports, NULL);
bool ret = true;
@@ -282,8 +285,11 @@ LV2Block::instantiate(BufferFactory& bufs)
lilv_nodes_free(types);
}
+ const bool optional = lilv_port_has_property(
+ plug, id, lv2_connectionOptional);
+
uint32_t port_buffer_size = bufs.default_size(buffer_type);
- if (port_buffer_size == 0) {
+ if (port_buffer_size == 0 && !optional) {
parent_graph()->engine().log().error(
fmt("<%1%> port `%2%' has unknown buffer type\n")
% _lv2_plugin->uri().c_str() % port_sym.c_str());
@@ -334,7 +340,8 @@ LV2Block::instantiate(BufferFactory& bufs)
direction = OUTPUT;
}
- if (port_type == PortType::UNKNOWN || direction == UNKNOWN) {
+ if ((port_type == PortType::UNKNOWN && !optional) ||
+ direction == UNKNOWN) {
parent_graph()->engine().log().error(
fmt("<%1%> port `%2%' has unknown type or direction\n")
% _lv2_plugin->uri().c_str() % port_sym.c_str());
@@ -394,6 +401,8 @@ LV2Block::instantiate(BufferFactory& bufs)
delete[] max_values;
delete[] def_values;
+ lilv_node_free(lv2_connectionOptional);
+
if (!ret) {
delete _ports;
_ports = NULL;