summaryrefslogtreecommitdiff
path: root/libs/ardour/bundle.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2017-08-29 10:42:00 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2017-08-29 10:53:41 +0200
commitd4c211ef6fd7ea823963f003ec18b22c4ea39582 (patch)
treea2c329e5ff144c44354375bdbcbac3a1afc7ee3f /libs/ardour/bundle.cc
parent41c5913b9150c6cf02c5b3b2b936635c3b87ebfe (diff)
Compare bundle ports per-type
This addresses the XXX comment in Bundle::has_same_ports()
Diffstat (limited to 'libs/ardour/bundle.cc')
-rw-r--r--libs/ardour/bundle.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc
index 081d790b6c..65f0c8e127 100644
--- a/libs/ardour/bundle.cc
+++ b/libs/ardour/bundle.cc
@@ -563,17 +563,22 @@ Bundle::set_name (string const & n)
bool
Bundle::has_same_ports (boost::shared_ptr<Bundle> b) const
{
- uint32_t const N = n_total();
+ ChanCount our_count = nchannels();
+ ChanCount other_count = b->nchannels();
- if (b->n_total() != N) {
+ if (our_count != other_count)
return false;
- }
- /* XXX: probably should sort channel port lists before comparing them */
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ uint32_t N = our_count.n(*t);
+ for (uint32_t i = 0; i < N; ++i) {
+ Bundle::PortList const & our_ports =
+ channel_ports (type_channel_to_overall(*t, i));
+ Bundle::PortList const & other_ports =
+ b->channel_ports (b->type_channel_to_overall(*t, i));
- for (uint32_t i = 0; i < N; ++i) {
- if (channel_ports (i) != b->channel_ports (i)) {
- return false;
+ if (our_ports != other_ports)
+ return false;
}
}