summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--lilv/lilv.h3
-rw-r--r--src/plugin.c16
3 files changed, 17 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index e531815..32b8d95 100644
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,10 @@ lilv (0.16.1) unstable;
for restoring port values via a callback only
* Fix unlikely memory leak in lilv_plugin_instantiate()
* Support denoting latency ports with lv2:designation lv2:latency
+ * Allow passing NULL port_class to lilv_plugin_get_port_by_designation.
* lilvmm.hpp: Add wrappers for UI API
- -- David Robillard <d@drobilla.net> Sun, 25 Aug 2013 11:15:19 -0400
+ -- David Robillard <d@drobilla.net> Sun, 25 Aug 2013 11:38:16 -0400
lilv (0.16.0) stable;
diff --git a/lilv/lilv.h b/lilv/lilv.h
index d349fb1..5abe867 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -958,7 +958,8 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* plugin,
role of the port, e.g. "left channel" or "gain". If found, the port with
matching @a port_class and @a designation is be returned, otherwise NULL is
returned. The @a port_class can be used to distinguish the input and output
- ports for a particular designation.
+ ports for a particular designation. If @a port_class is NULL, any port
+ with the given designation will be returned.
*/
LILV_API
const LilvPort*
diff --git a/src/plugin.c b/src/plugin.c
index 8ec93ff..4383cc0 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -659,7 +659,7 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
designation->node);
const bool found = !sord_iter_end(iter) &&
- lilv_port_is_a(plugin, port, port_class);
+ (!port_class || lilv_port_is_a(plugin, port, port_class));
sord_iter_free(iter);
if (found) {
@@ -676,9 +676,19 @@ lilv_plugin_get_latency_port_index(const LilvPlugin* p)
{
LilvNode* prop = lilv_node_new_from_node(
p->world, p->world->uris.lv2_reportsLatency);
- const LilvPort* latency_port = lilv_plugin_get_port_by_property(p, prop);
+ LilvNode* des = lilv_node_new_from_node(
+ p->world, p->world->uris.lv2_latency);
+ const LilvPort* prop_port = lilv_plugin_get_port_by_property(p, prop);
+ const LilvPort* des_port = lilv_plugin_get_port_by_property(p, des);
lilv_node_free(prop);
- return latency_port ? latency_port->index : UINT32_MAX;
+ lilv_node_free(des);
+ if (prop_port) {
+ return prop_port->index;
+ } else if (des_port) {
+ return des_port->index;
+ } else {
+ return UINT32_MAX;
+ }
}
LILV_API