diff options
author | David Robillard <d@drobilla.net> | 2011-10-21 04:51:04 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-10-21 04:51:04 +0000 |
commit | 96dcffcb222bc920cef9bfbaffb0548138352d65 (patch) | |
tree | ef1ee41a55af73d4197910a5788b299d529d7479 /libs/ardour/chan_mapping.cc | |
parent | 454f14d9c58de541a230c266ad59987b8ca7b1a4 (diff) |
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
Diffstat (limited to 'libs/ardour/chan_mapping.cc')
-rw-r--r-- | libs/ardour/chan_mapping.cc | 13 |
1 files changed, 10 insertions, 3 deletions
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; } |