diff options
author | David Robillard <d@drobilla.net> | 2011-09-14 22:57:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-09-14 22:57:21 +0000 |
commit | 67c2d56207de2b3609658561184a1cf8d327260e (patch) | |
tree | e5a763b33ab8111c65f294979bd068cae9e8aed4 /src/plugin.c | |
parent | 530b2d14e6d847d83a810d9a9418d32230092703 (diff) | |
download | lilv-67c2d56207de2b3609658561184a1cf8d327260e.tar.gz lilv-67c2d56207de2b3609658561184a1cf8d327260e.tar.bz2 lilv-67c2d56207de2b3609658561184a1cf8d327260e.zip |
Support integer minimum, maximum, and default port values in lilv_plugin_get_port_ranges_float.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3461 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/plugin.c b/src/plugin.c index 8b86e04..6a245e2 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -457,20 +457,35 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, for (uint32_t i = 0; i < p->num_ports; ++i) { lilv_port_get_range(p, p->ports[i], defptr, minptr, maxptr); - if (min_values) - min_values[i] = lilv_node_is_float(min) - ? lilv_node_as_float(min) - : NAN; - - if (max_values) - max_values[i] = lilv_node_is_float(max) - ? lilv_node_as_float(max) - : NAN; - - if (def_values) - def_values[i] = lilv_node_is_float(def) - ? lilv_node_as_float(def) - : NAN; + if (min_values) { + if (lilv_node_is_float(min)) { + min_values[i] = lilv_node_as_float(min); + } else if (lilv_node_is_int(min)) { + min_values[i] = lilv_node_as_int(min); + } else { + min_values[i] = NAN; + } + } + + if (max_values) { + if (lilv_node_is_float(max)) { + max_values[i] = lilv_node_as_float(max); + } else if (lilv_node_is_int(max)) { + max_values[i] = lilv_node_as_int(max); + } else { + max_values[i] = NAN; + } + } + + if (def_values) { + if (lilv_node_is_float(def)) { + def_values[i] = lilv_node_as_float(def); + } else if (lilv_node_is_int(def)) { + def_values[i] = lilv_node_as_int(def); + } else { + def_values[i] = NAN; + } + } lilv_node_free(def); lilv_node_free(min); |