diff options
author | Robin Gareus <robin@gareus.org> | 2016-11-26 14:31:24 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-11-26 15:31:21 +0100 |
commit | 0cb9d4a3d2c0dcd8535e50b8518b9bf8b6df3dc9 (patch) | |
tree | 7ed51b0e51885867a634a074a2ec39b407b701f1 /gtk2_ardour/engine_dialog.cc | |
parent | 335debfa2fed045dc80c43fb2ef62d89262fc8f8 (diff) |
Restrict Device selection to valid choices.
Diffstat (limited to 'gtk2_ardour/engine_dialog.cc')
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index b20b56176f..192c750131 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1592,6 +1592,24 @@ void EngineControl::input_device_changed () { DEBUG_ECONTROL ("input_device_changed"); + + boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend(); + if (backend && backend->match_input_output_devices_or_none ()) { + const std::string& dev_none = ARDOUR::AudioBackend::get_standard_device_name (ARDOUR::AudioBackend::DeviceNone); + + if (get_output_device_name () != dev_none + && get_input_device_name () != dev_none + && get_input_device_name () != get_output_device_name ()) { + block_changed_signals (); + if (contains_value (output_device_combo, get_input_device_name ())) { + output_device_combo.set_active_text (get_input_device_name ()); + } else { + assert (contains_value (output_device_combo, dev_none)); + output_device_combo.set_active_text (dev_none); + } + unblock_changed_signals (); + } + } device_changed (); } @@ -1599,6 +1617,23 @@ void EngineControl::output_device_changed () { DEBUG_ECONTROL ("output_device_changed"); + boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend(); + if (backend && backend->match_input_output_devices_or_none ()) { + const std::string& dev_none = ARDOUR::AudioBackend::get_standard_device_name (ARDOUR::AudioBackend::DeviceNone); + + if (get_input_device_name () != dev_none + && get_input_device_name () != dev_none + && get_input_device_name () != get_output_device_name ()) { + block_changed_signals (); + if (contains_value (input_device_combo, get_output_device_name ())) { + input_device_combo.set_active_text (get_output_device_name ()); + } else { + assert (contains_value (input_device_combo, dev_none)); + input_device_combo.set_active_text (dev_none); + } + unblock_changed_signals (); + } + } device_changed (); } |