diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2015-08-25 22:57:44 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2015-09-02 12:07:15 +1000 |
commit | 9626e0c41346be98c72ae1502727366ef38d6a73 (patch) | |
tree | 8007457e1af181ccb8633b9ea3663085a43dd069 /gtk2_ardour/engine_dialog.cc | |
parent | 88b332412c5fc802e3b7f0016309b273548020bf (diff) |
Add "Refresh Devices" button in Audio Setup dialog for backends that support it
This allows the portaudio library to be reinitialized to pick up new devices
and changes to ASIO buffer changes made externally.
Diffstat (limited to 'gtk2_ardour/engine_dialog.cc')
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 29ea0de0ee..c9b59086b3 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -87,6 +87,7 @@ EngineControl::EngineControl () , control_app_button (_("Device Control Panel")) , midi_devices_button (_("Midi Device Setup")) , start_stop_button (_("Stop")) + , update_devices_button (_("Refresh Devices")) , lm_measure_label (_("Measure")) , lm_use_button (_("Use results")) , lm_back_button (_("Back to settings ... (ignore results)")) @@ -274,6 +275,11 @@ EngineControl::EngineControl () start_stop_button.set_name ("generic button"); start_stop_button.set_can_focus(true); + update_devices_button.signal_clicked.connect (mem_fun (*this, &EngineControl::update_devices_button_clicked)); + update_devices_button.set_sensitive (false); + update_devices_button.set_name ("generic button"); + update_devices_button.set_can_focus(true); + cancel_button = add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL); ok_button = add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); @@ -466,6 +472,7 @@ EngineControl::build_notebook () engine_status.show(); basic_packer.attach (start_stop_button, 3, 4, 0, 1, xopt, xopt); + basic_packer.attach (update_devices_button, 3, 4, 1, 2, xopt, xopt); lm_button_audio.signal_clicked.connect (sigc::mem_fun (*this, &EngineControl::calibrate_audio_latency)); lm_button_audio.set_name ("generic button"); @@ -802,10 +809,19 @@ EngineControl::update_sensitivity () start_stop_button.show(); if (ARDOUR::AudioEngine::instance()->running()) { start_stop_button.set_text("Stop"); + update_devices_button.set_sensitive(false); } else { + if (backend->can_request_update_devices()) { + update_devices_button.show(); + } else { + update_devices_button.hide(); + } start_stop_button.set_text("Start"); + update_devices_button.set_sensitive(true); } } else { + update_devices_button.set_sensitive(false); + update_devices_button.hide(); start_stop_button.set_sensitive(false); start_stop_button.hide(); } @@ -2464,6 +2480,20 @@ EngineControl::start_stop_button_clicked () } void +EngineControl::update_devices_button_clicked () +{ + boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend(); + + if (!backend) { + return; + } + + if (backend->update_devices()) { + device_list_changed (); + } +} + +void EngineControl::manage_control_app_sensitivity () { boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend(); |