From 96dcffcb222bc920cef9bfbaffb0548138352d65 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Oct 2011 04:51:04 +0000 Subject: More robust plugin I/O mapping. This does not change the actual mapping logic, but makes the application of the mapping much more robust. If there is no valid mapping for a given port, that port is connected to silence (instead of crashing messily and/or via a failed assertion). Also tolerate mappings that nonsensically map to a buffer that is not present (this particularly happens for MIDI ports in some cases) as a temporary fix. The mapping logic needs work and/or our concept of just how much MIDI we support in a route needs simplification... git-svn-id: svn://localhost/ardour2/branches/3.0@10262 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/chan_mapping.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libs/ardour/chan_mapping.cc') diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index 3f7ccad8f9..5c5bb17de6 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -41,12 +41,19 @@ ChanMapping::ChanMapping(ChanCount identity) } uint32_t -ChanMapping::get(DataType t, uint32_t from) +ChanMapping::get(DataType t, uint32_t from, bool* valid) { Mappings::iterator tm = _mappings.find(t); - assert(tm != _mappings.end()); + if (tm == _mappings.end()) { + *valid = false; + return -1; + } TypeMapping::iterator m = tm->second.find(from); - assert(m != tm->second.end()); + if (m == tm->second.end()) { + *valid = false; + return -1; + } + *valid = true; return m->second; } -- cgit v1.2.3