From a7d7fae434dc32e6787dfe54d1c30e0bccc660bd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 7 Mar 2011 05:34:19 +0000 Subject: Apply LV2 UI MIDI event fix from Lars Luthman (ticket #651) with minor changes. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3048 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/LV2URIMap.cpp | 22 ++++++++++++++++++++++ src/shared/LV2URIMap.hpp | 4 ++++ 2 files changed, 26 insertions(+) (limited to 'src/shared') diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp index 768982d0..d72739df 100644 --- a/src/shared/LV2URIMap.cpp +++ b/src/shared/LV2URIMap.cpp @@ -170,6 +170,28 @@ LV2URIMap::id_to_uri(const char* map, } +std::pair +LV2URIMap::event_to_global(uint16_t event_id) const +{ + EventToGlobal::const_iterator i = _event_to_global.find(event_id); + if (i == _event_to_global.end()) { + return std::make_pair(false, uint32_t(0)); + } + return std::make_pair(true, i->second); +} + + +std::pair +LV2URIMap::global_to_event(uint32_t global_id) const +{ + GlobalToEvent::const_iterator i = _global_to_event.find(global_id); + if (i == _global_to_event.end()) { + return std::make_pair(false, uint16_t(0)); + } + return std::make_pair(true, i->second); +} + + uint32_t LV2URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index fe98bbc3..20957a6a 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -19,6 +19,7 @@ #define INGEN_SHARED_LV2URIMAP_HPP #include +#include #include @@ -59,6 +60,9 @@ public: virtual uint32_t uri_to_id(const char* map, const char* uri); virtual const char* id_to_uri(const char* map, uint32_t id); + std::pair event_to_global(uint16_t event_id) const; + std::pair global_to_event(uint32_t global_id) const; + private: static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, -- cgit v1.2.1