check_bundles (_bundles_connected, ports());
}
+/** Check the bundles in list to see which are connected to a given PortSet,
+ * and update list with those that are connected such that every port on every
+ * bundle channel x is connected to port x in ports.
+ */
void
IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
{
for (std::vector<UserBundleInfo*>::iterator i = list.begin(); i != list.end(); ++i) {
- uint32_t const N = (*i)->bundle->nchannels ();
+ uint32_t const N = (*i)->bundle->nchannels().n_total();
- if (_ports.num_ports (default_type()) < N) {
+ if (_ports.num_ports() < N) {
continue;
}
}
}
- changed (ConnectionsChanged, src); /* EMIT SIGNAL */
+ changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
_session.set_dirty ();
return 0;
}
}
- changed (ConnectionsChanged, src); /* EMIT SIGNAL */
+ changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
_session.set_dirty ();
return 0;
}
int
IO::remove_port (Port* port, void* src)
{
- IOChange change (NoChange);
+ IOChange change;
{
BLOCK_PROCESS_CALLBACK ();
-
{
Glib::Mutex::Lock lm (io_lock);
+ ChanCount before = _ports.count ();
+
if (_ports.remove(port)) {
- change = IOChange (change|ConfigurationChanged);
+ change.type = IOChange::Type (change.type | IOChange::ConfigurationChanged);
+ change.before = before;
+ change.after = _ports.count ();
if (port->connected()) {
- change = IOChange (change|ConnectionsChanged);
+ change.type = IOChange::Type (change.type | IOChange::ConnectionsChanged);
}
_session.engine().unregister_port (*port);
PortCountChanged (n_ports()); /* EMIT SIGNAL */
}
- if (change & ConfigurationChanged) {
+ if (change.type & IOChange::ConfigurationChanged) {
setup_bundle ();
}
- if (change != NoChange) {
+ if (change.type != IOChange::NoChange) {
changed (change, src);
_session.set_dirty ();
return 0;
return -1;
}
-/** Add an output port.
+/** Add a port.
*
- * @param destination Name of input port to connect new port to.
+ * @param destination Name of port to connect new port to.
* @param src Source for emitted ConfigurationChanged signal.
* @param type Data type of port. Default value (NIL) will use this IO's default type.
*/
type = _default_type;
}
+ IOChange change;
+
{
BLOCK_PROCESS_CALLBACK ();
{
Glib::Mutex::Lock lm (io_lock);
- /* Create a new output port */
+ /* Create a new port */
string portname = build_legal_port_name (type);
}
}
+ change.before = _ports.count ();
_ports.add (our_port);
}
}
// pan_changed (src); /* EMIT SIGNAL */
- changed (ConfigurationChanged, src); /* EMIT SIGNAL */
+ change.type = IOChange::ConfigurationChanged;
+ change.after = _ports.count ();
+ changed (change, src); /* EMIT SIGNAL */
setup_bundle ();
_session.set_dirty ();
}
}
- changed (ConnectionsChanged, src); /* EMIT SIGNAL */
+ changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
return 0;
}
catch (AudioEngine::PortRegistrationFailure& err) {
/* pass it on */
- throw AudioEngine::PortRegistrationFailure();
+ throw;
}
_ports.add (port);
return 0;
}
+ IOChange change;
+
+ change.before = _ports.count ();
+
if (lockit) {
BLOCK_PROCESS_CALLBACK ();
Glib::Mutex::Lock im (io_lock);
}
if (changed) {
- this->changed (ConfigurationChanged, src); /* EMIT SIGNAL */
+ change.after = _ports.count ();
+ change.type = IOChange::ConfigurationChanged;
+ this->changed (change, src); /* EMIT SIGNAL */
setup_bundle ();
_session.set_dirty ();
}
if ((prop = node.property ("connection")) != 0) {
if ((c = find_possible_bundle (prop->value())) != 0) {
- n = ChanCount::max (n, ChanCount(c->type(), c->nchannels()));
+ n = ChanCount::max (n, c->nchannels());
}
return 0;
}
if ((*iter)->name() == X_("Bundle")) {
if ((c = find_possible_bundle (prop->value())) != 0) {
- n = ChanCount::max (n, ChanCount(c->type(), c->nchannels()));
+ n = ChanCount::max (n, c->nchannels());
return 0;
} else {
return -1;
}
}
- changed (IOChange (ConfigurationChanged|ConnectionsChanged), src); /* EMIT SIGNAL */
+ changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
return 0;
}
}
}
- changed (IOChange (ConfigurationChanged|ConnectionsChanged), src); /* EMIT SIGNAL */
+ changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
return 0;
}
_bundle->suspend_signals ();
- _bundle->set_type (default_type ());
-
_bundle->remove_channels ();
if (_direction == Input) {
snprintf(buf, sizeof (buf), _("%s out"), _name.val().c_str());
}
_bundle->set_name (buf);
- uint32_t const ni = _ports.num_ports();
- for (uint32_t i = 0; i < ni; ++i) {
- _bundle->add_channel (bundle_channel_name (i, ni));
- _bundle->set_port (i, _session.engine().make_port_name_non_relative (_ports.port(i)->name()));
+
+ int c = 0;
+ for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
+
+ uint32_t const N = _ports.count().get (*i);
+ for (uint32_t j = 0; j < N; ++j) {
+ _bundle->add_channel (bundle_channel_name (j, N, *i), *i);
+ _bundle->set_port (c, _session.engine().make_port_name_non_relative (_ports.port(*i, j)->name()));
+ ++c;
+ }
+
}
_bundle->resume_signals ();
}
std::string
-IO::bundle_channel_name (uint32_t c, uint32_t n) const
+IO::bundle_channel_name (uint32_t c, uint32_t n, DataType t) const
{
char buf[32];
- switch (n) {
- case 1:
- return _("mono");
- case 2:
- return c == 0 ? _("L") : _("R");
- default:
+ if (t == DataType::AUDIO) {
+
+ switch (n) {
+ case 1:
+ return _("mono");
+ case 2:
+ return c == 0 ? _("L") : _("R");
+ default:
+ snprintf (buf, sizeof(buf), _("%d"), (c + 1));
+ return buf;
+ }
+
+ } else {
+
snprintf (buf, sizeof(buf), _("%d"), (c + 1));
return buf;
+
}
return "";