summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-08 18:16:19 +0200
committerRobin Gareus <robin@gareus.org>2016-04-08 18:16:19 +0200
commite27096b054cbaa5c58063f96ee64b3af3af3e7bd (patch)
tree3630627a1de9c6592d21adb800f1e686e89310f9 /libs/ardour
parent752662051a1d7217ce842ded78d1ee8e041a112f (diff)
consistent count/n_total API
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/chan_mapping.h4
-rw-r--r--libs/ardour/chan_mapping.cc16
-rw-r--r--libs/ardour/plugin_insert.cc2
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;
}