diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 90c456c1f8..51d88a672d 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -69,6 +69,7 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee bool ui_is_resizable () const; const char* port_symbol (uint32_t port) const; + uint32_t port_index (const char* symbol) const; const LV2_Feature* const* features () { return _features; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 7a2dc0b750..ba7a9cacde 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -208,18 +208,20 @@ LV2Plugin::init(void* c_plugin, framecnt_t rate) { DEBUG_TRACE(DEBUG::LV2, "init\n"); - _impl->plugin = (LilvPlugin*)c_plugin; - _impl->ui = NULL; - _impl->ui_type = NULL; - _to_ui = NULL; - _from_ui = NULL; - _control_data = 0; - _shadow_data = 0; - _ev_buffers = 0; - _latency_control_port = 0; - _state_version = 0; - _was_activated = false; - _has_state_interface = false; + _impl->plugin = (LilvPlugin*)c_plugin; + _impl->ui = NULL; + _impl->ui_type = NULL; + _to_ui = NULL; + _from_ui = NULL; + _control_data = 0; + _shadow_data = 0; + _ev_buffers = 0; + _bpm_control_port = 0; + _freewheel_control_port = 0; + _latency_control_port = 0; + _state_version = 0; + _was_activated = false; + _has_state_interface = false; _instance_access_feature.URI = "http://lv2plug.in/ns/ext/instance-access"; _data_access_feature.URI = "http://lv2plug.in/ns/ext/data-access"; @@ -548,6 +550,18 @@ LV2Plugin::port_symbol(uint32_t index) const return lilv_node_as_string(sym); } +uint32_t +LV2Plugin::port_index (const char* symbol) const +{ + const map::const_iterator i = _port_indices.find(symbol); + if (i != _port_indices.end()) { + return i->second; + } else { + warning << string_compose(_("LV2: Unknown port %1"), symbol) << endmsg; + return (uint32_t)-1; + } +} + void LV2Plugin::set_parameter(uint32_t which, float val) {