add wrapper for ChanMapping::get()

The boolean "valid" is implicit, get() returns -1 (really UINT32_MAX)
This simplifies upcoming lua bindings
This commit is contained in:
Robin Gareus 2016-01-24 01:11:15 +01:00
parent 9bcd01c0a1
commit 470255effa
2 changed files with 4 additions and 3 deletions

View File

@ -40,6 +40,7 @@ public:
ChanMapping(ARDOUR::ChanCount identity);
uint32_t get(DataType t, uint32_t from, bool* valid);
uint32_t get(DataType t, uint32_t from) { return get (t, from, NULL); }
void set(DataType t, uint32_t from, uint32_t to);
void offset_from(DataType t, int32_t delta);
void offset_to(DataType t, int32_t delta);

View File

@ -45,15 +45,15 @@ ChanMapping::get(DataType t, uint32_t from, bool* valid)
{
Mappings::iterator tm = _mappings.find(t);
if (tm == _mappings.end()) {
*valid = false;
if (valid) { *valid = false; }
return -1;
}
TypeMapping::iterator m = tm->second.find(from);
if (m == tm->second.end()) {
*valid = false;
if (valid) { *valid = false; }
return -1;
}
*valid = true;
if (valid) { *valid = true; }
return m->second;
}