summaryrefslogtreecommitdiff
path: root/gtk2_ardour/mixer_strip.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2017-08-24 22:51:53 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2017-08-25 21:35:18 +0200
commit5aeb5f0c7d06036f05ca35081cfd9545c40fcf1b (patch)
tree000ab3ea84392c1e291228b8935899b4f901f1bb /gtk2_ardour/mixer_strip.cc
parent3596bdff14431ffc937951c5022f4be1601a62e2 (diff)
Remove unneeded test
The for loop will not be executed if |port_connections| is empty, no need to check beforehand.
Diffstat (limited to 'gtk2_ardour/mixer_strip.cc')
-rw-r--r--gtk2_ardour/mixer_strip.cc142
1 files changed, 70 insertions, 72 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 96383cad98..90e3eda60a 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1350,92 +1350,90 @@ MixerStrip::update_io_button (bool for_input)
io_connection_count = 0;
- if (!port_connections.empty()) {
- for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
- string pn = "";
- string& connection_name (*i);
+ for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
+ string pn = "";
+ string& connection_name (*i);
- if (connection_name.find("system:") == 0) {
- pn = AudioEngine::instance()->get_pretty_name_by_name (connection_name);
- }
-
- if (io_connection_count == 0) {
- tooltip << endl << Gtkmm2ext::markup_escape_text (port->name().substr(port->name().find("/") + 1))
- << " -> "
- << Gtkmm2ext::markup_escape_text ( pn.empty() ? connection_name : pn );
- } else {
- tooltip << ", "
- << Gtkmm2ext::markup_escape_text ( pn.empty() ? connection_name : pn );
- }
-
- if (connection_name.find(RouteUI::program_port_prefix) == 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("system:") == 0) {
+ pn = AudioEngine::instance()->get_pretty_name_by_name (connection_name);
+ }
- if (connection_name.find(ardour_track_name) == 0) {
- ++ardour_connection_count;
- }
- } else if (!pn.empty()) {
- if (system_ports.empty()) {
- system_ports += pn;
- } else {
- system_ports += "/" + pn;
- }
- if (connection_name.find("system:") == 0) {
- ++system_connection_count;
- }
- } else if (connection_name.find("system:midi_") == 0) {
- if (for_input) {
- // "system:midi_capture_123" -> "123"
- system_port = "M " + connection_name.substr(20);
- } else {
- // "system:midi_playback_123" -> "123"
- system_port = "M " + connection_name.substr(21);
- }
+ if (io_connection_count == 0) {
+ tooltip << endl << Gtkmm2ext::markup_escape_text (port->name().substr(port->name().find("/") + 1))
+ << " -> "
+ << Gtkmm2ext::markup_escape_text ( pn.empty() ? connection_name : pn );
+ } else {
+ tooltip << ", "
+ << Gtkmm2ext::markup_escape_text ( pn.empty() ? connection_name : pn );
+ }
- if (system_ports.empty()) {
- system_ports += system_port;
- } else {
- system_ports += "/" + system_port;
+ if (connection_name.find(RouteUI::program_port_prefix) == 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 (!pn.empty()) {
+ if (system_ports.empty()) {
+ system_ports += pn;
+ } else {
+ system_ports += "/" + pn;
+ }
+ if (connection_name.find("system:") == 0) {
++system_connection_count;
+ }
+ } else if (connection_name.find("system:midi_") == 0) {
+ if (for_input) {
+ // "system:midi_capture_123" -> "123"
+ system_port = "M " + connection_name.substr(20);
+ } else {
+ // "system:midi_playback_123" -> "123"
+ system_port = "M " + connection_name.substr(21);
+ }
- } 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;
+ }
- if (system_ports.empty()) {
- system_ports += system_port;
- } else {
- system_ports += "/" + system_port;
- }
+ ++system_connection_count;
- ++system_connection_count;
+ } else if (connection_name.find("system:") == 0) {
+ if (for_input) {
+ // "system:capture_123" -> "123"
+ system_port = connection_name.substr(15);
} else {
- if (other_connection_type.empty()) {
- // "jamin:in 1" -> "jamin:"
- other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
- }
+ // "system:playback_123" -> "123"
+ system_port = connection_name.substr(16);
+ }
- if (connection_name.find(other_connection_type) == 0) {
- ++other_connection_count;
- }
+ if (system_ports.empty()) {
+ system_ports += system_port;
+ } else {
+ system_ports += "/" + system_port;
}
- ++total_connection_count;
- ++io_connection_count;
+ ++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) {