From: Robin Gareus Date: Fri, 1 Apr 2016 20:54:00 +0000 (+0200) Subject: add chan-mapping count/size() X-Git-Tag: 5.0-pre0~1132 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=c25962aa7ed14573de1f7839b00bf67bc9e7e03f;p=ardour.git add chan-mapping count/size() --- diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index f73408baec..88cdf44408 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -86,6 +86,8 @@ public: */ bool is_monotonic () const; + uint32_t count () const; + /** Test if this mapping is a subset * @param superset to test against * @returns true if all mapping are also present in the superset diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index 6386c2863b..9e69294fdb 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -184,6 +184,17 @@ ChanMapping::is_identity (ChanCount offset) const return true; } +uint32_t +ChanMapping::count () const +{ + uint32_t rv = 0; + const Mappings& mp (mappings()); + for (Mappings::const_iterator tm = mp.begin(); tm != mp.end(); ++tm) { + rv += tm->second.size (); + } + return rv; +} + } // namespace ARDOUR std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanMapping& cm)