consistent count/n_total API
authorRobin Gareus <robin@gareus.org>
Fri, 8 Apr 2016 16:16:19 +0000 (18:16 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 8 Apr 2016 16:16:19 +0000 (18:16 +0200)
libs/ardour/ardour/chan_mapping.h
libs/ardour/chan_mapping.cc
libs/ardour/plugin_insert.cc

index f1ffef373e45d85193c2ed5c5d4558e82ea6abdb..ac546e3bbd6000b180ec22db4a20b1c600d307bb 100644 (file)
@@ -88,7 +88,9 @@ public:
         */
        bool     is_monotonic () const;
 
-       uint32_t count () const;
+       uint32_t n_total () const;
+
+       ChanCount count () const;
 
        XMLNode* state(const std::string& name) const;
 
index 1d59faff00033def1aa2858cac7f1d6dcc39a4de..ca422b5bced2fc260da5e726a061a08f4962b73d 100644 (file)
@@ -219,8 +219,9 @@ ChanMapping::is_identity (ChanCount offset) const
 }
 
 uint32_t
-ChanMapping::count () const
+ChanMapping::n_total () const
 {
+       // fast version of count().n_total();
        uint32_t rv = 0;
        const Mappings& mp (mappings());
        for (Mappings::const_iterator tm = mp.begin(); tm != mp.end(); ++tm) {
@@ -229,6 +230,19 @@ ChanMapping::count () const
        return rv;
 }
 
+ChanCount
+ChanMapping::count () const
+{
+       ChanCount rv;
+       const Mappings& mp (mappings());
+       for (Mappings::const_iterator tm = mp.begin(); tm != mp.end(); ++tm) {
+               rv.set (tm->first, tm->second.size ());
+       }
+       return rv;
+}
+
+
+
 } // namespace ARDOUR
 
 std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanMapping& cm)
index bda00f59d3945b19e6506dc52e03339b5402d249..55b592561cf3bac2925a9e3aa6be7a071a58479f 100644 (file)
@@ -1073,7 +1073,7 @@ PluginInsert::check_inplace ()
 {
        bool inplace_ok = !_plugins.front()->inplace_broken ();
 
-       if (_thru_map.count () > 0) {
+       if (_thru_map.n_total () > 0) {
                // TODO once midi-bypass is part of the mapping, ignore it
                inplace_ok = false;
        }