From e27096b054cbaa5c58063f96ee64b3af3af3e7bd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 8 Apr 2016 18:16:19 +0200 Subject: [PATCH] consistent count/n_total API --- libs/ardour/ardour/chan_mapping.h | 4 +++- libs/ardour/chan_mapping.cc | 16 +++++++++++++++- libs/ardour/plugin_insert.cc | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index f1ffef373e..ac546e3bbd 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -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; diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index 1d59faff00..ca422b5bce 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -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) diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index bda00f59d3..55b592561c 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -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; } -- 2.30.2