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(); } @@ -2463,6 +2479,20 @@ EngineControl::start_stop_button_clicked () } } +void +EngineControl::update_devices_button_clicked () +{ + boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); + + if (!backend) { + return; + } + + if (backend->update_devices()) { + device_list_changed (); + } +} + void EngineControl::manage_control_app_sensitivity () { diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 421228ea1a..2823057853 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -85,6 +85,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { ArdourButton control_app_button; ArdourButton midi_devices_button; ArdourButton start_stop_button; + ArdourButton update_devices_button; Gtk::Button connect_disconnect_button; @@ -289,6 +290,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { void on_response (int); void control_app_button_clicked (); void start_stop_button_clicked (); + void update_devices_button_clicked (); void use_latency_button_clicked (); void manage_control_app_sensitivity (); int push_state_to_backend (bool start);