diff options
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/bundle.h | 1 | ||||
-rw-r--r-- | libs/ardour/bundle.cc | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 0c7d6a5978..1af7a3bad0 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -89,6 +89,7 @@ class Bundle : public sigc::trackable void connect (boost::shared_ptr<Bundle>, AudioEngine &); void disconnect (boost::shared_ptr<Bundle>, AudioEngine &); bool connected_to (boost::shared_ptr<Bundle>, AudioEngine &); + bool has_same_ports (boost::shared_ptr<Bundle>) const; void set_name (std::string const &); diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc index 4f2198fd41..f409e0beee 100644 --- a/libs/ardour/bundle.cc +++ b/libs/ardour/bundle.cc @@ -466,3 +466,26 @@ Bundle::set_name (string const & n) _name = n; emit_changed (NameChanged); } + +/** @param b Other bundle. + * @return true if b has the same number of channels as this bundle, and those channels have corresponding ports. + */ +bool +Bundle::has_same_ports (boost::shared_ptr<Bundle> b) const +{ + uint32_t const N = nchannels (); + + if (b->nchannels() != N) { + return false; + } + + /* XXX: probably should sort channel port lists before comparing them */ + + for (uint32_t i = 0; i < N; ++i) { + if (channel_ports (i) != b->channel_ports (i)) { + return false; + } + } + + return true; +} |