From 9dd89e3a4b9d9f0bfb408c827358f8e97c12373b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 3 May 2008 17:27:00 +0000 Subject: Add slv2_plugin_get_port_ranges. Use slv2_plugin_get_port_ranges in lv2_jack_host and lv2_inspect (significant performance improvement for plugins with lots of ports). git-svn-id: http://svn.drobilla.net/lad/slv2@1193 a436a847-0d15-0410-975c-d299462d15a1 --- utils/lv2_inspect.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'utils') diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index 200d7dc..ebdb052 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ SLV2Value event_class = NULL; SLV2Value control_class = NULL; void -print_port(SLV2Plugin p, uint32_t index) +print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defaults) { SLV2Port port = slv2_plugin_get_port_by_index(p, index); @@ -71,11 +72,12 @@ print_port(SLV2Plugin p, uint32_t index) slv2_value_free(val); if (slv2_port_is_a(p, port, control_class)) { - SLV2Value def, min, max; - slv2_port_get_range(p, port, &def, &min, &max); - printf("\t\tMinimum: %f\n", slv2_value_as_float(min)); - printf("\t\tMaximum: %f\n", slv2_value_as_float(max)); - printf("\t\tDefault: %f\n", slv2_value_as_float(def)); + if (!isnan(mins[index])) + printf("\t\tMinimum: %f\n", mins[index]); + if (!isnan(mins[index])) + printf("\t\tMaximum: %f\n", maxes[index]); + if (!isnan(mins[index])) + printf("\t\tDefault: %f\n", defaults[index]); } SLV2Values properties = slv2_port_get_properties(p, port); @@ -207,11 +209,15 @@ print_plugin(SLV2Plugin p) /* Ports */ const uint32_t num_ports = slv2_plugin_get_num_ports(p); + float* mins = calloc(num_ports, sizeof(float)); + float* maxes = calloc(num_ports, sizeof(float)); + float* defaults = calloc(num_ports, sizeof(float)); + slv2_plugin_get_port_ranges(p, mins, maxes, defaults); //printf("\n\t# Ports: %d\n", num_ports); for (uint32_t i=0; i < num_ports; ++i) - print_port(p, i); + print_port(p, i, mins, maxes, defaults); } -- cgit v1.2.1