+Plugin::IOPortDescription
+LV2Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
+{
+ PortFlags match = 0;
+ switch (dt) {
+ case DataType::AUDIO:
+ match = PORT_AUDIO;
+ break;
+ case DataType::MIDI:
+ match = PORT_SEQUENCE | PORT_MIDI; // ignore old PORT_EVENT
+ break;
+ default:
+ return Plugin::IOPortDescription ("?");
+ break;
+ }
+ if (input) {
+ match |= PORT_INPUT;
+ } else {
+ match |= PORT_OUTPUT;
+ }
+
+ uint32_t p = 0;
+ uint32_t idx = UINT32_MAX;
+
+ uint32_t const num_ports = parameter_count();
+ for (uint32_t port_index = 0; port_index < num_ports; ++port_index) {
+ PortFlags flags = _port_flags[port_index];
+ if ((flags & match) == match) {
+ if (p == id) {
+ idx = port_index;
+ }
+ ++p;
+ }
+ }
+ if (idx == UINT32_MAX) {
+ return Plugin::IOPortDescription ("?");
+ }
+
+ LilvNode* name = lilv_port_get_name(_impl->plugin,
+ lilv_plugin_get_port_by_index(_impl->plugin, idx));
+ Plugin::IOPortDescription iod (lilv_node_as_string (name));
+ lilv_node_free(name);
+
+ if (lilv_port_has_property(_impl->plugin,
+ lilv_plugin_get_port_by_index(_impl->plugin, idx), _world.lv2_isSideChain)) {
+ iod.is_sidechain = true;
+ }
+ return iod;
+}
+