+ io_count = route->n_outputs().n_total();
+ }
+
+ for (io_index = 0; io_index < io_count; ++io_index) {
+ if (for_input) {
+ port = route->input()->nth (io_index);
+ } else {
+ port = route->output()->nth (io_index);
+ }
+
+ connections.clear ();
+ port->get_connections(connections);
+ io_connection_count = 0;
+
+ if (!connections.empty()) {
+ for (vector<string>::iterator i = connections.begin(); i != connections.end(); ++i) {
+ string& connection_name (*i);
+
+ if (io_connection_count == 0) {
+ tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
+ } else {
+ tooltip << ", " << connection_name;
+ }
+
+ if (connection_name.find("ardour:") == 0) {
+ if (ardour_track_name.empty()) {
+ // "ardour:Master/in 1" -> "ardour:Master/"
+ string::size_type slash = connection_name.find("/");
+ if (slash != string::npos) {
+ ardour_track_name = connection_name.substr(0, slash + 1);
+ }
+ }
+
+ if (connection_name.find(ardour_track_name) == 0) {
+ ++ardour_connection_count;
+ }
+ } else if (connection_name.find("system:") == 0) {
+ if (for_input) {
+ // "system:capture_123" -> "123"
+ system_port = connection_name.substr(15);
+ } else {
+ // "system:playback_123" -> "123"
+ system_port = connection_name.substr(16);
+ }
+
+ if (system_ports.empty()) {
+ system_ports += system_port;
+ } else {
+ system_ports += "/" + system_port;
+ }
+
+ ++system_connection_count;
+ } else {
+ if (other_connection_type.empty()) {
+ // "jamin:in 1" -> "jamin:"
+ other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
+ }
+
+ if (connection_name.find(other_connection_type) == 0) {
+ ++other_connection_count;
+ }
+ }
+
+ ++total_connection_count;
+ ++io_connection_count;
+ }
+ }
+
+ if (io_connection_count != 1) {
+ each_io_has_one_connection = false;