+ for (vector<ARDOUR::AudioBackend::DeviceStatus>::const_iterator i = all_devices.begin(); i != all_devices.end(); ++i) {
+ available_devices.push_back (i->name);
+ }
+
+ if (!available_devices.empty()) {
+ update_sensitivity ();
+
+ {
+ string current_device, found_device;
+ current_device = input_device_combo.get_active_text ();
+ if (current_device == "") {
+ current_device = backend->input_device_name ();
+ }
+
+ // Make sure that the active text is still relevant for this
+ // device (it might only be relevant to the previous device!!)
+ for (vector<string>::const_iterator i = available_devices.begin(); i != available_devices.end(); ++i) {
+ if (*i == current_device)
+ found_device = current_device;
+ }
+ if (found_device == "")
+ // device has never been set (or was not relevant
+ // for this backend) Let's make sure it's not blank
+ current_device = available_devices.front ();
+
+ PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
+ set_popdown_strings (input_device_combo, available_devices);
+
+ input_device_combo.set_active_text (current_device);
+ }
+
+ input_device_changed ();
+ return true;
+ }
+
+ return false;
+}
+
+// @return true if there are output devices available
+bool
+EngineControl::set_output_device_popdown_strings ()
+{
+ boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
+ vector<ARDOUR::AudioBackend::DeviceStatus> all_devices = backend->enumerate_output_devices ();
+
+ vector<string> available_devices;
+
+ for (vector<ARDOUR::AudioBackend::DeviceStatus>::const_iterator i = all_devices.begin(); i != all_devices.end(); ++i) {
+ available_devices.push_back (i->name);
+ }
+
+ if (!available_devices.empty()) {
+ update_sensitivity ();
+
+ {
+ string current_device, found_device;
+ current_device = output_device_combo.get_active_text ();
+ if (current_device == "") {
+ current_device = backend->output_device_name ();
+ }
+
+ // Make sure that the active text is still relevant for this
+ // device (it might only be relevant to the previous device!!)
+ for (vector<string>::const_iterator i = available_devices.begin(); i != available_devices.end(); ++i) {
+ if (*i == current_device)
+ found_device = current_device;
+ }
+ if (found_device == "")
+ // device has never been set (or was not relevant
+ // for this backend) Let's make sure it's not blank
+ current_device = available_devices.front ();
+
+ PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
+ set_popdown_strings (output_device_combo, available_devices);
+
+ output_device_combo.set_active_text (current_device);
+ }
+
+ output_device_changed ();
+ return true;
+ }
+
+ return false;
+}
+
+void
+EngineControl::list_devices ()
+{
+ boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
+ assert (backend);
+
+ /* now fill out devices, mark sample rates, buffer sizes insensitive */
+
+ bool devices_available = false;
+
+ if (backend->use_separate_input_and_output_devices ()) {
+ bool input_devices_available = set_input_device_popdown_strings ();
+ bool output_devices_available = set_output_device_popdown_strings ();
+ devices_available = input_devices_available || output_devices_available;
+ } else {
+ devices_available = set_device_popdown_strings ();
+ }
+
+ if (devices_available) {