add chan-mapping count/size()
authorRobin Gareus <robin@gareus.org>
Fri, 1 Apr 2016 20:54:00 +0000 (22:54 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 1 Apr 2016 20:57:56 +0000 (22:57 +0200)
libs/ardour/ardour/chan_mapping.h
libs/ardour/chan_mapping.cc

index f73408baec7071b423038b3cc0622534ac385ba9..88cdf44408aac0084fbd46c69722492164681bc0 100644 (file)
@@ -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
index 6386c2863b264a668121631b1bdf1c71071d9cb6..9e69294fdbad233d926ec6c86b9579319a291884 100644 (file)
@@ -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)