diff options
-rw-r--r-- | hosts/lv2_jack_host.c | 2 | ||||
-rw-r--r-- | slv2/plugin.h | 26 | ||||
-rw-r--r-- | src/plugin.c | 8 | ||||
-rw-r--r-- | utils/lv2_inspect.c | 2 |
4 files changed, 21 insertions, 17 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c index 2368352..08ae29d 100644 --- a/hosts/lv2_jack_host.c +++ b/hosts/lv2_jack_host.c @@ -192,7 +192,7 @@ main(int argc, char** argv) host.ports = calloc((size_t)host.num_ports, sizeof(struct Port)); float* default_values = calloc(slv2_plugin_get_num_ports(host.plugin), sizeof(float)); - slv2_plugin_get_port_ranges(host.plugin, NULL, NULL, default_values); + slv2_plugin_get_port_ranges_float(host.plugin, NULL, NULL, default_values); for (uint32_t i=0; i < host.num_ports; ++i) create_port(&host, i, default_values[i]); diff --git a/slv2/plugin.h b/slv2/plugin.h index 435f869..8f41677 100644 --- a/slv2/plugin.h +++ b/slv2/plugin.h @@ -272,19 +272,23 @@ slv2_plugin_get_num_ports(SLV2Plugin p); /** Get the port ranges (minimum, maximum and default values) for all ports. * - * min_values, max_values and def_values must either point to an array of - * N floats, where N is the value returned by slv2_plugin_get_num_ports() for - * this plugin, or NULL. This function will set the elements of the non-NULL - * array pointers to the minimum, maximum and default values of the ports on - * this plugin, with array index corresponding to port index. If a port doesn't - * have a minimum, maximum or default value, the corresponding array element will - * be set to NAN. + * \a min_values, \a max_values and \a def_values must either point to an array + * of N floats, where N is the value returned by slv2_plugin_get_num_ports() + * for this plugin, or NULL. The elements of the array will be set to the + * the minimum, maximum and default values of the ports on this plugin, + * with array index corresponding to port index. If a port doesn't have a + * minimum, maximum or default value, or the port's type is not float, the + * corresponding array element will be set to NAN. + * + * This is a convenience method for the common case of getting the range of + * all float ports on a plugin, and may be significantly faster than + * repeated calls to slv2_port_get_range. */ void -slv2_plugin_get_port_ranges(SLV2Plugin p, - float* min_values, - float* max_values, - float* def_values); +slv2_plugin_get_port_ranges_float(SLV2Plugin p, + float* min_values, + float* max_values, + float* def_values); /** Get the number of ports on this plugin that are members of some class(es). * diff --git a/src/plugin.c b/src/plugin.c index 57de06c..cb98d69 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -559,10 +559,10 @@ slv2_plugin_get_port_float_values(SLV2Plugin p, void -slv2_plugin_get_port_ranges(SLV2Plugin p, - float* min_values, - float* max_values, - float* def_values) +slv2_plugin_get_port_ranges_float(SLV2Plugin p, + float* min_values, + float* max_values, + float* def_values) { if (min_values) slv2_plugin_get_port_float_values(p, ":minimum", min_values); diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index ebdb052..035ac0c 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -212,7 +212,7 @@ print_plugin(SLV2Plugin 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); + slv2_plugin_get_port_ranges_float(p, mins, maxes, defaults); //printf("\n\t# Ports: %d\n", num_ports); |