diff options
author | David Robillard <d@drobilla.net> | 2012-04-11 04:00:27 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-04-11 04:00:27 +0000 |
commit | 722defe41a6119cfe6e9f5a66fdcb2408c12a455 (patch) | |
tree | c43ecf0b034b8449422a30ee91c5fd3a76ab3ad4 | |
parent | dbd6ae23d061718fd072e15519559311454a626d (diff) |
Fix crash introduced in r11877 (oops). Add LV2Plugin::port_index().
git-svn-id: svn://localhost/ardour2/branches/3.0@11885 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 1 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 38 |
2 files changed, 27 insertions, 12 deletions
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<string, uint32_t>::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) { |