summaryrefslogtreecommitdiffstats
path: root/src/server/LV2Block.cpp
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/server/LV2Block.cpp
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/server/LV2Block.cpp')
-rw-r--r--src/server/LV2Block.cpp13
1 files changed, 11 insertions, 2 deletions
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;