X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fchan_mapping.cc;h=5c5bb17de67a292c3094eb4584dbf25e84779603;hb=f8ed1bbcf4e0f56911e2b6975efc627af949869d;hp=653d45d58f46b91f34b12c335f7054e9dd42258f;hpb=80c8866303c405fb6230eb96f2a8cd7f181b57da;p=ardour.git diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index 653d45d58f..5c5bb17de6 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -1,6 +1,6 @@ /* - Copyright (C) 2009 Paul Davis - Author: Dave Robillard + Copyright (C) 2009 Paul Davis + Author: David Robillard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; } @@ -99,7 +106,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanMapping& cm) o << "\t" << i->first << " => " << i->second << endl; } } - + return o; }