- if (s) {
- if (!_offer_inputs) {
- _io->connect_input (_io->input(r), p, 0);
- } else {
- _io->connect_output (_io->output(r), p, 0);
- }
- } else {
- if (!_offer_inputs) {
- _io->disconnect_input (_io->input(r), p, 0);
- } else {
- _io->disconnect_output (_io->output(r), p, 0);
- }
- }
+ ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel);
+ ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel);
+
+ for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
+ for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
+
+ Port* f = _session.engine().get_port_by_name (*i);
+ if (!f) {
+ return;
+ }
+
+ if (s) {
+ if (!_find_inputs_for_io_outputs) {
+ _io->connect_input (f, *j, 0);
+ } else {
+ _io->connect_output (f, *j, 0);
+ }
+ } else {
+ if (!_find_inputs_for_io_outputs) {
+ _io->disconnect_input (f, *j, 0);
+ } else {
+ _io->disconnect_output (f, *j, 0);
+ }
+ }
+ }
+ }