summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2015-08-25 22:57:44 +1000
committerTim Mayberry <mojofunk@gmail.com>2015-09-02 12:07:15 +1000
commit9626e0c41346be98c72ae1502727366ef38d6a73 (patch)
tree8007457e1af181ccb8633b9ea3663085a43dd069
parent88b332412c5fc802e3b7f0016309b273548020bf (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.
-rw-r--r--gtk2_ardour/engine_dialog.cc30
-rw-r--r--gtk2_ardour/engine_dialog.h2
2 files changed, 32 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();
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);