send a slightly more useful message if a control protocol's probe() method fails
[ardour.git] / libs / ardour / session.cc
index 69d0b082e28e06ca44886b85ffd8fb62e19a5c26..431cadfca0628cc0a8e2edd99f480db5295fe721 100644 (file)
@@ -910,6 +910,41 @@ Session::setup_click_state (const XMLNode* node)
        }
 }
 
+void
+Session::get_physical_ports (vector<string>& inputs, vector<string>& outputs, DataType type, bool excluding)
+{
+       _engine.get_physical_inputs (type, inputs);
+
+       if (excluding) {
+               /* rip out ControlOnly ports, and ALSA MIDI Through ports */
+
+               for (vector<string>::iterator si = inputs.begin(); si != inputs.end(); ) {
+                       if (PortManager::port_is_control_only (*si)) {
+                               si = inputs.erase (si);
+                       } else if ((*si).find (X_("Midi Through")) != string::npos || (*si).find (X_("Midi-Through")) != string::npos) {
+                               si = inputs.erase (si);
+                       } else {
+                               ++si;
+                       }
+               }
+       }
+       _engine.get_physical_outputs (type, outputs);
+
+       if (excluding) {
+               /* rip out ControlOnly ports, and ALSA MIDI Through ports */
+
+               for (vector<string>::iterator si = outputs.begin(); si != outputs.end(); ) {
+                       if (PortManager::port_is_control_only (*si)) {
+                               si = outputs.erase (si);
+                       } else if ((*si).find (X_("Midi Through")) != string::npos || (*si).find (X_("Midi-Through")) != string::npos) {
+                               si = outputs.erase (si);
+                       } else {
+                               ++si;
+                       }
+               }
+       }
+}
+
 void
 Session::setup_bundles ()
 {
@@ -928,9 +963,9 @@ Session::setup_bundles ()
 
        vector<string> inputs[DataType::num_types];
        vector<string> outputs[DataType::num_types];
+
        for (uint32_t i = 0; i < DataType::num_types; ++i) {
-               _engine.get_physical_inputs (DataType (DataType::Symbol (i)), inputs[i]);
-               _engine.get_physical_outputs (DataType (DataType::Symbol (i)), outputs[i]);
+               get_physical_ports (inputs[i], outputs[i], DataType (DataType::Symbol (i)), true);
        }
 
        /* Create a set of Bundle objects that map
@@ -6294,12 +6329,12 @@ Session::goto_end ()
 }
 
 void
-Session::goto_start ()
+Session::goto_start (bool and_roll)
 {
        if (_session_range_location) {
-               request_locate (_session_range_location->start(), false);
+               request_locate (_session_range_location->start(), and_roll);
        } else {
-               request_locate (0, false);
+               request_locate (0, and_roll);
        }
 }
 
@@ -6913,8 +6948,7 @@ Session::auto_connect (const AutoConnectRequest& ar)
                vector<string> physinputs;
                vector<string> physoutputs;
 
-               _engine.get_physical_outputs (*t, physoutputs);
-               _engine.get_physical_inputs (*t, physinputs);
+               get_physical_ports (physinputs, physoutputs, *t, true);
 
                if (!physinputs.empty() && ar.connect_inputs) {
                        uint32_t nphysical_in = physinputs.size();