diff options
author | David Robillard <d@drobilla.net> | 2008-01-28 01:18:25 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-28 01:18:25 +0000 |
commit | cbeb09ee0a31a8bec670864b03d4f743f968d1b1 (patch) | |
tree | 1839dcf4cb4b9e572e313b0a1a9c594fadca14f6 /src | |
parent | 6de587b04154f2efdc2a94c0a78225f7adc88ff9 (diff) | |
download | lilv-cbeb09ee0a31a8bec670864b03d4f743f968d1b1.tar.gz lilv-cbeb09ee0a31a8bec670864b03d4f743f968d1b1.tar.bz2 lilv-cbeb09ee0a31a8bec670864b03d4f743f968d1b1.zip |
Add slv2_plugin_get_num_ports_of_class.
git-svn-id: http://svn.drobilla.net/lad/slv2@1116 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugin.c b/src/plugin.c index 437bcb6..4745135 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -473,6 +473,41 @@ slv2_plugin_get_num_ports(SLV2Plugin p) } +uint32_t +slv2_plugin_get_num_ports_of_class(SLV2Plugin p, + SLV2Value class_1, ...) +{ + uint32_t ret = 0; + va_list args; + + for (unsigned i=0; i < slv2_plugin_get_num_ports(p); ++i) { + SLV2Port port = raptor_sequence_get_at(p->ports, i); + if (!slv2_port_is_a(p, port, class_1)) + continue; + + va_start(args, class_1); + + bool matches = true; + for (SLV2Value class_i = NULL; (class_i = va_arg(args, SLV2Value)) != NULL ; ) { + if (!slv2_port_is_a(p, port, class_i)) { + va_end(args); + matches = false; + break; + } + } + + if (matches) { + printf("HIT: %s\n", slv2_value_as_string(slv2_port_get_name(p, port))); + ++ret; + } + + va_end(args); + } + + return ret; +} + + bool slv2_plugin_has_latency(SLV2Plugin p) { |