diff options
author | Carl Hetherington <carl@carlh.net> | 2009-02-11 02:13:15 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-02-11 02:13:15 +0000 |
commit | a192ccaebc8094a7bec68ef77db976d3a3e461bf (patch) | |
tree | 4278d591344786b64cc8801229ebc0fc138f93d1 /libs/ardour/bundle.cc | |
parent | 9b6d5a936118d879f8460505b1023c0bfaec404c (diff) |
Add connected_to ()
git-svn-id: svn://localhost/ardour2/branches/3.0@4527 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/bundle.cc')
-rw-r--r-- | libs/ardour/bundle.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc index f90b84ff25..fc109c33a9 100644 --- a/libs/ardour/bundle.cc +++ b/libs/ardour/bundle.cc @@ -23,6 +23,7 @@ #include <ardour/ardour.h> #include <ardour/bundle.h> #include <ardour/audioengine.h> +#include <ardour/port.h> #include <pbd/xml++.h> #include "i18n.h" @@ -395,3 +396,38 @@ Bundle::emit_changed (Change c) } } +bool +Bundle::connected_to (boost::shared_ptr<Bundle> other, AudioEngine & engine) +{ + if (_ports_are_inputs == other->_ports_are_inputs || + _type != other->_type || + nchannels() != other->nchannels ()) { + + return false; + } + + for (uint32_t i = 0; i < nchannels(); ++i) { + Bundle::PortList const & A = channel_ports (i); + Bundle::PortList const & B = other->channel_ports (i); + + for (uint32_t j = 0; j < A.size(); ++j) { + for (uint32_t k = 0; k < B.size(); ++k) { + + Port* p = engine.get_port_by_name (A[j]); + Port* q = engine.get_port_by_name (B[k]); + + if (!p && !q) { + return false; + } + + if (p && !p->connected_to (B[k])) { + return false; + } else if (q && !q->connected_to (A[j])) { + return false; + } + } + } + } + + return true; +} |