/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2002 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
_signals_suspended (other->_signals_suspended),
_pending_change (other->_pending_change)
{
-
+
}
uint32_t
Glib::Mutex::Lock lm (_channel_mutex);
PortList& pl = _channel[ch].ports;
PortList::iterator i = find (pl.begin(), pl.end(), portname);
-
+
if (i != pl.end()) {
pl.erase (i);
changed = true;
Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
{
assert (ch < nchannels());
-
+
Glib::Mutex::Lock lm (_channel_mutex);
return (std::find (_channel[ch].ports.begin (), _channel[ch].ports.end (), portname) != _channel[ch].ports.end ());
}
Bundle::add_channels_from_bundle (boost::shared_ptr<Bundle> other)
{
uint32_t const ch = nchannels ();
-
+
for (uint32_t i = 0; i < other->nchannels(); ++i) {
std::stringstream s;
Bundle::remove_ports_from_channel (uint32_t ch)
{
assert (ch < nchannels ());
-
+
{
Glib::Mutex::Lock lm (_channel_mutex);
_channel[ch].ports.clear ();
Changed (c);
}
}
-
+
bool
Bundle::connected_to (boost::shared_ptr<Bundle> other, AudioEngine & engine)
{
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) {
return true;
}
+
+/** Set the type of the ports in this Bundle.
+ * @param t New type.
+ */
+void
+Bundle::set_type (DataType t)
+{
+ _type = t;
+ emit_changed (TypeChanged);
+}
+
+void
+Bundle::set_ports_are_inputs ()
+{
+ _ports_are_inputs = true;
+ emit_changed (DirectionChanged);
+}
+
+void
+Bundle::set_ports_are_outputs ()
+{
+ _ports_are_inputs = false;
+ emit_changed (DirectionChanged);
+}
+
+/** Set the name.
+ * @param n New name.
+ */
+void
+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;
+}