mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 15:15:41 +01:00
Add connected_to ()
git-svn-id: svn://localhost/ardour2/branches/3.0@4527 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9b6d5a9361
commit
a192ccaebc
2 changed files with 37 additions and 0 deletions
|
|
@ -88,6 +88,7 @@ class Bundle : public sigc::trackable
|
|||
void add_channels_from_bundle (boost::shared_ptr<Bundle>);
|
||||
void connect (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
void disconnect (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
bool connected_to (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
|
||||
/** Set the name.
|
||||
* @param n New name.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue