13
0

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.
This commit is contained in:
Tim Mayberry 2015-08-25 22:57:44 +10:00
parent 88b332412c
commit 9626e0c413
2 changed files with 32 additions and 0 deletions

View File

@ -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<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (!backend) {
return;
}
if (backend->update_devices()) {
device_list_changed ();
}
}
void
EngineControl::manage_control_app_sensitivity ()
{

View File

@ -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);