2 Copyright (C) 2010 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <boost/scoped_ptr.hpp>
28 #include <gtkmm/messagedialog.h>
30 #include "pbd/error.h"
31 #include "pbd/xml++.h"
32 #include "pbd/unwind.h"
33 #include "pbd/failed_constructor.h"
35 #include <gtkmm/alignment.h>
36 #include <gtkmm/stock.h>
37 #include <gtkmm/notebook.h>
38 #include <gtkmm2ext/utils.h>
40 #include "ardour/audio_backend.h"
41 #include "ardour/audioengine.h"
42 #include "ardour/mtdm.h"
43 #include "ardour/rc_configuration.h"
44 #include "ardour/types.h"
46 #include "pbd/convert.h"
47 #include "pbd/error.h"
49 #include "ardour_ui.h"
50 #include "engine_dialog.h"
51 #include "gui_thread.h"
57 using namespace Gtkmm2ext;
61 static const unsigned int midi_tab = -1; /* not currently in use */
62 static const unsigned int latency_tab = 1; /* zero-based, page zero is the main setup page */
64 static const char* results_markup = X_("<span foreground=\"red\" style=\"italic\" size=\"larger\">%1</span>");
66 EngineControl::EngineControl ()
67 : ArdourDialog (_("Audio/MIDI Setup"))
69 , input_latency_adjustment (0, 0, 99999, 1)
70 , input_latency (input_latency_adjustment)
71 , output_latency_adjustment (0, 0, 99999, 1)
72 , output_latency (output_latency_adjustment)
73 , input_channels_adjustment (0, 0, 256, 1)
74 , input_channels (input_channels_adjustment)
75 , output_channels_adjustment (0, 0, 256, 1)
76 , output_channels (output_channels_adjustment)
77 , ports_adjustment (128, 8, 1024, 1, 16)
78 , ports_spinner (ports_adjustment)
79 , control_app_button (_("Device Control Panel"))
80 , lm_measure_button (_("Measure"))
81 , lm_use_button (_("Use results"))
82 , lm_back_button (_("Back to settings ... (ignore results)"))
83 , lm_button (_("Calibrate..."))
85 , have_lm_results (false)
87 , midi_refresh_button (_("Refresh list"))
89 , _desired_sample_rate (0)
91 , started_at_least_once (false)
93 using namespace Notebook_Helpers;
94 vector<string> strings;
96 AttachOptions xopt = AttachOptions (FILL|EXPAND);
99 set_name (X_("AudioMIDISetup"));
101 /* the backend combo is the one thing that is ALWAYS visible
104 vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
106 if (backends.empty()) {
107 MessageDialog msg (string_compose (_("No audio/MIDI backends detected. %1 cannot run\n\n(This is a build/packaging/system error. It should never happen.)"), PROGRAM_NAME));
109 throw failed_constructor ();
112 for (vector<const ARDOUR::AudioBackendInfo*>::const_iterator b = backends.begin(); b != backends.end(); ++b) {
113 strings.push_back ((*b)->name);
116 set_popdown_strings (backend_combo, strings);
117 backend_combo.set_active_text (strings.front());
118 backend_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::backend_changed));
120 /* setup basic packing characteristics for the table used on the main
121 * tab of the notebook
124 basic_packer.set_spacings (6);
125 basic_packer.set_border_width (12);
126 basic_packer.set_homogeneous (false);
130 basic_hbox.pack_start (basic_packer, false, false);
134 /* latency measurement tab */
136 lm_title.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("Latency Measurement Tool")));
139 lm_table.set_row_spacings (12);
140 lm_table.set_col_spacings (6);
141 lm_table.set_homogeneous (false);
143 lm_table.attach (lm_title, 0, 3, row, row+1, xopt, (AttachOptions) 0);
146 Gtk::Label* preamble;
148 preamble = manage (new Label);
149 preamble->set_width_chars (60);
150 preamble->set_line_wrap (true);
151 preamble->set_markup (_("<span weight=\"bold\">Turn down the volume on your audio equipment to a very low level.</span>"));
153 lm_table.attach (*preamble, 0, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
156 preamble = manage (new Label);
157 preamble->set_width_chars (60);
158 preamble->set_line_wrap (true);
159 preamble->set_markup (_("Select two channels below and connect them using a cable."));
161 lm_table.attach (*preamble, 0, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
164 label = manage (new Label (_("Output channel")));
165 lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
167 Gtk::Alignment* misc_align = manage (new Alignment (0.0, 0.5));
168 misc_align->add (lm_output_channel_combo);
169 lm_table.attach (*misc_align, 1, 3, row, row+1, xopt, (AttachOptions) 0);
172 label = manage (new Label (_("Input channel")));
173 lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
175 misc_align = manage (new Alignment (0.0, 0.5));
176 misc_align->add (lm_input_channel_combo);
177 lm_table.attach (*misc_align, 1, 3, row, row+1, FILL, (AttachOptions) 0);
180 xopt = AttachOptions(0);
182 lm_measure_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::latency_button_clicked));
183 lm_use_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::use_latency_button_clicked));
184 lm_back_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (notebook, &Gtk::Notebook::set_current_page), 0));
186 lm_use_button.set_sensitive (false);
188 /* Increase the default spacing around the labels of these three
194 if ((l = dynamic_cast<Gtk::Misc*>(lm_measure_button.get_child())) != 0) {
195 l->set_padding (10, 10);
198 if ((l = dynamic_cast<Gtk::Misc*>(lm_use_button.get_child())) != 0) {
199 l->set_padding (10, 10);
202 if ((l = dynamic_cast<Gtk::Misc*>(lm_back_button.get_child())) != 0) {
203 l->set_padding (10, 10);
206 preamble = manage (new Label);
207 preamble->set_width_chars (60);
208 preamble->set_line_wrap (true);
209 preamble->set_markup (_("Once the channels are connected, click the \"Measure\" button."));
210 lm_table.attach (*preamble, 0, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
213 preamble = manage (new Label);
214 preamble->set_width_chars (60);
215 preamble->set_line_wrap (true);
216 preamble->set_markup (_("When satisfied with the results, click the \"Use results\" button."));
217 lm_table.attach (*preamble, 0, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
219 ++row; // skip a row in the table
220 ++row; // skip a row in the table
222 lm_table.attach (lm_results, 0, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
224 ++row; // skip a row in the table
225 ++row; // skip a row in the table
227 lm_table.attach (lm_measure_button, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
228 lm_table.attach (lm_use_button, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
229 lm_table.attach (lm_back_button, 2, 3, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0);
231 lm_results.set_markup (string_compose (results_markup, _("No measurement results yet")));
233 lm_vbox.set_border_width (12);
234 lm_vbox.pack_start (lm_table, false, false);
238 notebook.pages().push_back (TabElem (basic_vbox, _("Audio")));
239 // notebook.pages().push_back (TabElem (midi_vbox, _("MIDI")));
240 notebook.pages().push_back (TabElem (lm_vbox, _("Latency")));
241 notebook.set_border_width (12);
243 notebook.set_show_tabs (false);
244 notebook.show_all ();
246 notebook.set_name ("SettingsNotebook");
248 /* packup the notebook */
250 get_vbox()->set_border_width (12);
251 get_vbox()->pack_start (notebook);
253 /* need a special function to print "all available channels" when the
254 * channel counts hit zero.
257 input_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &input_channels));
258 output_channels.signal_output().connect (sigc::bind (sigc::ptr_fun (&EngineControl::print_channel_count), &output_channels));
260 control_app_button.signal_clicked().connect (mem_fun (*this, &EngineControl::control_app_button_clicked));
261 manage_control_app_sensitivity ();
263 cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
264 ok_button = add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
265 apply_button = add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
267 /* Pick up any existing audio setup configuration, if appropriate */
269 XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
271 ARDOUR::AudioEngine::instance()->Running.connect (running_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_running, this), gui_context());
272 ARDOUR::AudioEngine::instance()->Stopped.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
273 ARDOUR::AudioEngine::instance()->Halted.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
278 set_state (*audio_setup);
281 /* Connect to signals */
283 driver_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::driver_changed));
284 sample_rate_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::sample_rate_changed));
285 buffer_size_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::buffer_size_changed));
286 device_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::device_changed));
287 midi_option_combo.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::midi_option_changed));
289 input_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
290 output_latency.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
291 input_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
292 output_channels.signal_changed().connect (sigc::mem_fun (*this, &EngineControl::parameter_changed));
294 notebook.signal_switch_page().connect (sigc::mem_fun (*this, &EngineControl::on_switch_page));
300 EngineControl::on_response (int response_id)
302 ArdourDialog::on_response (response_id);
304 switch (response_id) {
306 push_state_to_backend (true);
309 push_state_to_backend (true);
312 case RESPONSE_DELETE_EVENT: {
314 ev.type = GDK_BUTTON_PRESS;
316 on_delete_event ((GdkEventAny*) &ev);
325 EngineControl::build_notebook ()
328 AttachOptions xopt = AttachOptions (FILL|EXPAND);
330 /* clear the table */
332 Gtkmm2ext::container_clear (basic_vbox);
333 Gtkmm2ext::container_clear (basic_packer);
335 label = manage (left_aligned_label (_("Audio System:")));
336 basic_packer.attach (*label, 0, 1, 0, 1, xopt, (AttachOptions) 0);
337 basic_packer.attach (backend_combo, 1, 2, 0, 1, xopt, (AttachOptions) 0);
339 lm_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (notebook, &Gtk::Notebook::set_current_page), latency_tab));
340 lm_button.set_name ("record enable button");
342 build_full_control_notebook ();
344 build_no_control_notebook ();
347 basic_vbox.pack_start (basic_hbox, false, false);
350 Gtk::HBox* hpacker = manage (new HBox);
351 hpacker->set_border_width (12);
352 hpacker->pack_start (control_app_button, false, false);
354 control_app_button.show();
355 basic_vbox.pack_start (*hpacker);
358 basic_vbox.show_all ();
362 EngineControl::build_full_control_notebook ()
364 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
367 using namespace Notebook_Helpers;
369 vector<string> strings;
370 AttachOptions xopt = AttachOptions (FILL|EXPAND);
371 int row = 1; // row zero == backend combo
373 /* start packing it up */
375 if (backend->requires_driver_selection()) {
376 label = manage (left_aligned_label (_("Driver:")));
377 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
378 basic_packer.attach (driver_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
382 label = manage (left_aligned_label (_("Device:")));
383 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
384 basic_packer.attach (device_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
387 label = manage (left_aligned_label (_("Sample rate:")));
388 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
389 basic_packer.attach (sample_rate_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
393 label = manage (left_aligned_label (_("Buffer size:")));
394 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
395 basic_packer.attach (buffer_size_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
396 buffer_size_duration_label.set_alignment (0.0); /* left-align */
397 basic_packer.attach (buffer_size_duration_label, 2, 3, row, row+1, SHRINK, (AttachOptions) 0);
400 input_channels.set_name ("InputChannels");
401 input_channels.set_flags(Gtk::CAN_FOCUS);
402 input_channels.set_digits(0);
403 input_channels.set_wrap(false);
404 output_channels.set_editable (true);
406 label = manage (left_aligned_label (_("Input Channels:")));
407 basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
408 basic_packer.attach (input_channels, 1, 2, row, row+1, xopt, (AttachOptions) 0);
411 output_channels.set_name ("OutputChannels");
412 output_channels.set_flags(Gtk::CAN_FOCUS);
413 output_channels.set_digits(0);
414 output_channels.set_wrap(false);
415 output_channels.set_editable (true);
417 label = manage (left_aligned_label (_("Output Channels:")));
418 basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
419 basic_packer.attach (output_channels, 1, 2, row, row+1, xopt, (AttachOptions) 0);
422 input_latency.set_name ("InputLatency");
423 input_latency.set_flags(Gtk::CAN_FOCUS);
424 input_latency.set_digits(0);
425 input_latency.set_wrap(false);
426 input_latency.set_editable (true);
428 label = manage (left_aligned_label (_("Hardware input latency:")));
429 basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
430 basic_packer.attach (input_latency, 1, 2, row, row+1, xopt, (AttachOptions) 0);
431 label = manage (left_aligned_label (_("samples")));
432 basic_packer.attach (*label, 2, 3, row, row+1, SHRINK, (AttachOptions) 0);
435 output_latency.set_name ("OutputLatency");
436 output_latency.set_flags(Gtk::CAN_FOCUS);
437 output_latency.set_digits(0);
438 output_latency.set_wrap(false);
439 output_latency.set_editable (true);
441 label = manage (left_aligned_label (_("Hardware output latency:")));
442 basic_packer.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0);
443 basic_packer.attach (output_latency, 1, 2, row, row+1, xopt, (AttachOptions) 0);
444 label = manage (left_aligned_label (_("samples")));
445 basic_packer.attach (*label, 2, 3, row, row+1, SHRINK, (AttachOptions) 0);
447 /* button spans 2 rows */
449 basic_packer.attach (lm_button, 3, 4, row-1, row+1, xopt, xopt);
452 label = manage (left_aligned_label (_("MIDI System")));
453 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
454 basic_packer.attach (midi_option_combo, 1, 2, row, row + 1, SHRINK, (AttachOptions) 0);
459 EngineControl::build_no_control_notebook ()
461 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
464 using namespace Notebook_Helpers;
466 vector<string> strings;
467 AttachOptions xopt = AttachOptions (FILL|EXPAND);
468 int row = 1; // row zero == backend combo
469 const string msg = string_compose (_("The %1 audio backend was configured and started externally.\nThis limits your control over it."), backend->name());
471 label = manage (new Label);
472 label->set_markup (string_compose ("<span weight=\"bold\" foreground=\"red\">%1</span>", msg));
473 basic_packer.attach (*label, 0, 2, row, row + 1, xopt, (AttachOptions) 0);
476 if (backend->can_change_sample_rate_when_running()) {
477 label = manage (left_aligned_label (_("Sample rate:")));
478 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
479 basic_packer.attach (sample_rate_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
483 if (backend->can_change_buffer_size_when_running()) {
484 label = manage (left_aligned_label (_("Buffer size:")));
485 basic_packer.attach (*label, 0, 1, row, row + 1, xopt, (AttachOptions) 0);
486 basic_packer.attach (buffer_size_combo, 1, 2, row, row + 1, xopt, (AttachOptions) 0);
487 buffer_size_duration_label.set_alignment (0.0); /* left-align */
488 basic_packer.attach (buffer_size_duration_label, 2, 3, row, row+1, xopt, (AttachOptions) 0);
492 connect_disconnect_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::connect_disconnect_click));
494 basic_packer.attach (connect_disconnect_button, 0, 2, row, row+1, FILL, AttachOptions (0));
498 EngineControl::~EngineControl ()
500 ignore_changes = true;
504 EngineControl::disable_latency_tab ()
506 vector<string> empty;
507 set_popdown_strings (lm_output_channel_combo, empty);
508 set_popdown_strings (lm_input_channel_combo, empty);
509 lm_measure_button.set_sensitive (false);
510 lm_use_button.set_sensitive (false);
514 EngineControl::enable_latency_tab ()
516 vector<string> outputs;
517 ARDOUR::AudioEngine::instance()->get_physical_outputs (ARDOUR::DataType::AUDIO, outputs);
518 set_popdown_strings (lm_output_channel_combo, outputs);
519 lm_output_channel_combo.set_active_text (outputs.front());
521 vector<string> inputs;
522 ARDOUR::AudioEngine::instance()->get_physical_inputs (ARDOUR::DataType::AUDIO, inputs);
523 set_popdown_strings (lm_input_channel_combo, inputs);
524 lm_input_channel_combo.set_active_text (inputs.front());
526 lm_measure_button.set_sensitive (true);
530 EngineControl::setup_midi_tab_for_backend ()
532 string backend = backend_combo.get_active_text ();
534 Gtkmm2ext::container_clear (midi_vbox);
536 midi_vbox.set_border_width (12);
537 midi_device_table.set_border_width (12);
539 if (backend == "JACK") {
540 setup_midi_tab_for_jack ();
543 midi_vbox.pack_start (midi_device_table, true, true);
544 midi_vbox.pack_start (midi_refresh_button, false, false);
545 midi_vbox.show_all ();
547 midi_refresh_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::refresh_midi_display));
551 EngineControl::setup_midi_tab_for_jack ()
556 EngineControl::refresh_midi_display ()
558 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
561 vector<string> midi_inputs;
562 vector<string> midi_outputs;
564 AttachOptions xopt = AttachOptions (FILL|EXPAND);
567 Gtkmm2ext::container_clear (midi_device_table);
569 backend->get_physical_inputs (ARDOUR::DataType::MIDI, midi_inputs);
570 backend->get_physical_outputs (ARDOUR::DataType::MIDI, midi_outputs);
572 midi_device_table.set_spacings (6);
573 midi_device_table.set_homogeneous (true);
574 midi_device_table.resize (midi_inputs.size() + midi_outputs.size() + 3, 1);
576 l = manage (new Label);
577 l->set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("MIDI Inputs")));
578 midi_device_table.attach (*l, 0, 1, row, row + 1, xopt, AttachOptions (0));
579 l->set_alignment (0, 0.5);
583 for (vector<string>::iterator p = midi_inputs.begin(); p != midi_inputs.end(); ++p) {
584 l = manage (new Label ((*p).substr ((*p).find_last_of (':') + 1)));
585 l->set_alignment (0, 0.5);
586 midi_device_table.attach (*l, 0, 1, row, row + 1, xopt, AttachOptions (0));
591 row++; // extra row of spacing
593 l = manage (new Label);
594 l->set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("MIDI Outputs")));
595 midi_device_table.attach (*l, 0, 1, row, row + 1, xopt, AttachOptions (0));
596 l->set_alignment (0, 0.5);
600 for (vector<string>::iterator p = midi_outputs.begin(); p != midi_outputs.end(); ++p) {
601 l = manage (new Label ((*p).substr ((*p).find_last_of (':') + 1)));
602 l->set_alignment (0, 0.5);
603 midi_device_table.attach (*l, 0, 1, row, row + 1, xopt, AttachOptions (0));
610 EngineControl::update_sensitivity ()
615 EngineControl::backend_changed ()
617 if (ignore_changes) {
621 string backend_name = backend_combo.get_active_text();
622 boost::shared_ptr<ARDOUR::AudioBackend> backend;
624 if (!(backend = ARDOUR::AudioEngine::instance()->set_backend (backend_name, "ardour", ""))) {
625 /* eh? setting the backend failed... how ? */
629 _have_control = ARDOUR::AudioEngine::instance()->setup_required ();
632 setup_midi_tab_for_backend ();
634 if (backend->requires_driver_selection()) {
635 vector<string> drivers = backend->enumerate_drivers();
637 if (!drivers.empty()) {
639 PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
640 set_popdown_strings (driver_combo, drivers);
641 driver_combo.set_active_text (drivers.front());
648 driver_combo.set_sensitive (false);
649 /* this will change the device text which will cause a call to
650 * device changed which will set up parameters
655 vector<string> midi_options = backend->enumerate_midi_options();
657 if (midi_options.size() == 1) {
658 /* only contains the "none" option */
659 midi_option_combo.set_sensitive (false);
662 set_popdown_strings (midi_option_combo, midi_options);
663 midi_option_combo.set_active_text (midi_options.front());
664 midi_option_combo.set_sensitive (true);
666 midi_option_combo.set_sensitive (false);
670 maybe_display_saved_state ();
674 EngineControl::print_channel_count (Gtk::SpinButton* sb)
676 uint32_t cnt = (uint32_t) sb->get_value();
678 sb->set_text (_("all available channels"));
681 snprintf (buf, sizeof (buf), "%d", cnt);
688 EngineControl::list_devices ()
690 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
693 /* now fill out devices, mark sample rates, buffer sizes insensitive */
695 vector<ARDOUR::AudioBackend::DeviceStatus> all_devices = backend->enumerate_devices ();
697 /* NOTE: Ardour currently does not display the "available" field of the
700 * Doing so would require a different GUI widget than the combo
701 * box/popdown that we currently use, since it has no way to list
702 * items that are not selectable. Something more like a popup menu,
703 * which could have unselectable items, would be appropriate.
706 vector<string> available_devices;
708 for (vector<ARDOUR::AudioBackend::DeviceStatus>::const_iterator i = all_devices.begin(); i != all_devices.end(); ++i) {
709 available_devices.push_back (i->name);
712 if (!available_devices.empty()) {
714 update_sensitivity ();
717 PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
718 set_popdown_strings (device_combo, available_devices);
719 device_combo.set_active_text (available_devices.front());
724 ok_button->set_sensitive (true);
725 apply_button->set_sensitive (true);
728 sample_rate_combo.set_sensitive (false);
729 buffer_size_combo.set_sensitive (false);
730 input_latency.set_sensitive (false);
731 output_latency.set_sensitive (false);
732 input_channels.set_sensitive (false);
733 output_channels.set_sensitive (false);
734 ok_button->set_sensitive (false);
735 apply_button->set_sensitive (false);
740 EngineControl::driver_changed ()
742 if (ignore_changes) {
746 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
749 backend->set_driver (driver_combo.get_active_text());
752 maybe_display_saved_state ();
756 EngineControl::device_changed ()
758 if (ignore_changes) {
762 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
764 string device_name = device_combo.get_active_text ();
768 PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
770 /* don't allow programmatic change to combos to cause a
771 recursive call to this method.
781 sr = backend->available_sample_rates (device_name);
784 sr.push_back (8000.0f);
785 sr.push_back (16000.0f);
786 sr.push_back (32000.0f);
787 sr.push_back (44100.0f);
788 sr.push_back (48000.0f);
789 sr.push_back (88200.0f);
790 sr.push_back (96000.0f);
791 sr.push_back (192000.0f);
792 sr.push_back (384000.0f);
795 for (vector<float>::const_iterator x = sr.begin(); x != sr.end(); ++x) {
796 s.push_back (rate_as_string (*x));
797 if (*x == _desired_sample_rate) {
803 sample_rate_combo.set_sensitive (true);
804 set_popdown_strings (sample_rate_combo, s);
806 if (desired.empty()) {
807 sample_rate_combo.set_active_text (s.front());
809 sample_rate_combo.set_active_text (desired);
813 sample_rate_combo.set_sensitive (false);
821 bs = backend->available_buffer_sizes(device_name);
822 } else if (backend->can_change_buffer_size_when_running()) {
836 for (vector<uint32_t>::const_iterator x = bs.begin(); x != bs.end(); ++x) {
837 s.push_back (bufsize_as_string (*x));
841 buffer_size_combo.set_sensitive (true);
842 set_popdown_strings (buffer_size_combo, s);
844 buffer_size_combo.set_active_text (s.front());
845 show_buffer_duration ();
847 buffer_size_combo.set_sensitive (false);
850 /* XXX theoretically need to set min + max channel counts here
853 manage_control_app_sensitivity ();
856 /* pick up any saved state for this device */
858 maybe_display_saved_state ();
860 /* and push it to the backend */
862 push_state_to_backend (false);
866 EngineControl::bufsize_as_string (uint32_t sz)
868 /* Translators: "samples" is always plural here, so no
869 need for plural+singular forms.
872 snprintf (buf, sizeof (buf), _("%u samples"), sz);
877 EngineControl::sample_rate_changed ()
879 if (ignore_changes) {
883 /* reset the strings for buffer size to show the correct msec value
884 (reflecting the new sample rate).
887 show_buffer_duration ();
893 EngineControl::buffer_size_changed ()
895 if (ignore_changes) {
899 show_buffer_duration ();
904 EngineControl::show_buffer_duration ()
907 /* buffer sizes - convert from just samples to samples + msecs for
908 * the displayed string
911 string bs_text = buffer_size_combo.get_active_text ();
912 uint32_t samples = atoi (bs_text); /* will ignore trailing text */
913 uint32_t rate = get_rate();
915 /* Translators: "msecs" is ALWAYS plural here, so we do not
916 need singular form as well.
918 /* Developers: note the hard-coding of a double buffered model
919 in the (2 * samples) computation of latency. we always start
920 the audiobackend in this configuration.
923 snprintf (buf, sizeof (buf), _("(%.1f msecs)"), (2 * samples) / (rate/1000.0));
924 buffer_size_duration_label.set_text (buf);
928 EngineControl::midi_option_changed ()
930 if (!ignore_changes) {
936 EngineControl::parameter_changed ()
938 if (!ignore_changes) {
943 EngineControl::State*
944 EngineControl::get_matching_state (const string& backend,
945 const string& driver,
946 const string& device)
948 for (StateList::iterator i = states.begin(); i != states.end(); ++i) {
949 if ((*i).backend == backend &&
950 (*i).driver == driver &&
951 (*i).device == device) {
958 EngineControl::State*
959 EngineControl::get_saved_state_for_currently_displayed_backend_and_device ()
961 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
964 return get_matching_state (backend_combo.get_active_text(),
965 (backend->requires_driver_selection() ? (std::string) driver_combo.get_active_text() : string()),
966 device_combo.get_active_text());
970 return get_matching_state (backend_combo.get_active_text(),
972 device_combo.get_active_text());
975 EngineControl::State*
976 EngineControl::save_state ()
978 if (!_have_control) {
982 bool existing = true;
983 State* state = get_saved_state_for_currently_displayed_backend_and_device ();
990 store_state (*state);
993 states.push_back (*state);
1000 EngineControl::store_state (State& state)
1002 state.backend = get_backend ();
1003 state.driver = get_driver ();
1004 state.device = get_device_name ();
1005 state.sample_rate = get_rate ();
1006 state.buffer_size = get_buffer_size ();
1007 state.input_latency = get_input_latency ();
1008 state.output_latency = get_output_latency ();
1009 state.input_channels = get_input_channels ();
1010 state.output_channels = get_output_channels ();
1011 state.midi_option = get_midi_option ();
1015 EngineControl::maybe_display_saved_state ()
1017 if (!_have_control) {
1021 State* state = get_saved_state_for_currently_displayed_backend_and_device ();
1024 PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
1026 if (!_desired_sample_rate) {
1027 sample_rate_combo.set_active_text (rate_as_string (state->sample_rate));
1029 buffer_size_combo.set_active_text (bufsize_as_string (state->buffer_size));
1030 /* call this explicitly because we're ignoring changes to
1031 the controls at this point.
1033 show_buffer_duration ();
1034 input_latency.set_value (state->input_latency);
1035 output_latency.set_value (state->output_latency);
1037 if (!state->midi_option.empty()) {
1038 midi_option_combo.set_active_text (state->midi_option);
1044 EngineControl::get_state ()
1046 XMLNode* root = new XMLNode ("AudioMIDISetup");
1049 if (!states.empty()) {
1050 XMLNode* state_nodes = new XMLNode ("EngineStates");
1052 for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
1054 XMLNode* node = new XMLNode ("State");
1056 node->add_property ("backend", (*i).backend);
1057 node->add_property ("driver", (*i).driver);
1058 node->add_property ("device", (*i).device);
1059 node->add_property ("sample-rate", (*i).sample_rate);
1060 node->add_property ("buffer-size", (*i).buffer_size);
1061 node->add_property ("input-latency", (*i).input_latency);
1062 node->add_property ("output-latency", (*i).output_latency);
1063 node->add_property ("input-channels", (*i).input_channels);
1064 node->add_property ("output-channels", (*i).output_channels);
1065 node->add_property ("active", (*i).active ? "yes" : "no");
1066 node->add_property ("midi-option", (*i).midi_option);
1068 state_nodes->add_child_nocopy (*node);
1071 root->add_child_nocopy (*state_nodes);
1078 EngineControl::set_state (const XMLNode& root)
1080 XMLNodeList clist, cclist;
1081 XMLNodeConstIterator citer, cciter;
1083 XMLNode* grandchild;
1084 XMLProperty* prop = NULL;
1086 if (root.name() != "AudioMIDISetup") {
1090 clist = root.children();
1094 for (citer = clist.begin(); citer != clist.end(); ++citer) {
1098 if (child->name() != "EngineStates") {
1102 cclist = child->children();
1104 for (cciter = cclist.begin(); cciter != cclist.end(); ++cciter) {
1107 grandchild = *cciter;
1109 if (grandchild->name() != "State") {
1113 if ((prop = grandchild->property ("backend")) == 0) {
1116 state.backend = prop->value ();
1118 if ((prop = grandchild->property ("driver")) == 0) {
1121 state.driver = prop->value ();
1123 if ((prop = grandchild->property ("device")) == 0) {
1126 state.device = prop->value ();
1128 if ((prop = grandchild->property ("sample-rate")) == 0) {
1131 state.sample_rate = atof (prop->value ());
1133 if ((prop = grandchild->property ("buffer-size")) == 0) {
1136 state.buffer_size = atoi (prop->value ());
1138 if ((prop = grandchild->property ("input-latency")) == 0) {
1141 state.input_latency = atoi (prop->value ());
1143 if ((prop = grandchild->property ("output-latency")) == 0) {
1146 state.output_latency = atoi (prop->value ());
1148 if ((prop = grandchild->property ("input-channels")) == 0) {
1151 state.input_channels = atoi (prop->value ());
1153 if ((prop = grandchild->property ("output-channels")) == 0) {
1156 state.output_channels = atoi (prop->value ());
1158 if ((prop = grandchild->property ("active")) == 0) {
1161 state.active = string_is_affirmative (prop->value ());
1163 if ((prop = grandchild->property ("midi-option")) == 0) {
1166 state.midi_option = prop->value ();
1168 states.push_back (state);
1172 /* now see if there was an active state and switch the setup to it */
1174 for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
1178 backend_combo.set_active_text ((*i).backend);
1179 driver_combo.set_active_text ((*i).driver);
1180 device_combo.set_active_text ((*i).device);
1181 sample_rate_combo.set_active_text (rate_as_string ((*i).sample_rate));
1182 buffer_size_combo.set_active_text (bufsize_as_string ((*i).buffer_size));
1183 input_latency.set_value ((*i).input_latency);
1184 output_latency.set_value ((*i).output_latency);
1185 midi_option_combo.set_active_text ((*i).midi_option);
1194 EngineControl::push_state_to_backend (bool start)
1200 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
1206 /* figure out what is going to change */
1208 bool restart_required = false;
1209 bool was_running = ARDOUR::AudioEngine::instance()->running();
1210 bool change_driver = false;
1211 bool change_device = false;
1212 bool change_rate = false;
1213 bool change_bufsize = false;
1214 bool change_latency = false;
1215 bool change_channels = false;
1216 bool change_midi = false;
1218 uint32_t ochan = get_output_channels ();
1219 uint32_t ichan = get_input_channels ();
1221 if (_have_control) {
1223 if (started_at_least_once) {
1225 /* we can control the backend */
1227 if (backend->requires_driver_selection()) {
1228 if (get_driver() != backend->driver_name()) {
1229 change_driver = true;
1233 if (get_device_name() != backend->device_name()) {
1234 change_device = true;
1237 if (get_rate() != backend->sample_rate()) {
1241 if (get_buffer_size() != backend->buffer_size()) {
1242 change_bufsize = true;
1245 if (get_midi_option() != backend->midi_option()) {
1249 /* zero-requested channels means "all available" */
1252 ichan = backend->input_channels();
1256 ochan = backend->output_channels();
1259 if (ichan != backend->input_channels()) {
1260 change_channels = true;
1263 if (ochan != backend->output_channels()) {
1264 change_channels = true;
1267 if (get_input_latency() != backend->systemic_input_latency() ||
1268 get_output_latency() != backend->systemic_output_latency()) {
1269 change_latency = true;
1272 /* backend never started, so we have to force a group
1275 change_driver = true;
1276 if (backend->requires_driver_selection()) {
1277 change_device = true;
1280 change_bufsize = true;
1281 change_channels = true;
1282 change_latency = true;
1288 /* we have no control over the backend, meaning that we can
1289 * only possibly change sample rate and buffer size.
1293 if (get_rate() != backend->sample_rate()) {
1294 change_bufsize = true;
1297 if (get_buffer_size() != backend->buffer_size()) {
1298 change_bufsize = true;
1302 if (!_have_control) {
1304 /* We do not have control over the backend, so the best we can
1305 * do is try to change the sample rate and/or bufsize and get
1309 if (change_rate && !backend->can_change_sample_rate_when_running()) {
1313 if (change_bufsize && !backend->can_change_buffer_size_when_running()) {
1318 backend->set_sample_rate (get_rate());
1321 if (change_bufsize) {
1322 backend->set_buffer_size (get_buffer_size());
1330 /* determine if we need to stop the backend before changing parameters */
1332 if (change_driver || change_device || change_channels || change_latency ||
1333 (change_rate && !backend->can_change_sample_rate_when_running()) ||
1335 (change_bufsize && !backend->can_change_buffer_size_when_running())) {
1336 restart_required = true;
1338 restart_required = false;
1343 if (!change_driver && !change_device && !change_channels && !change_latency && !change_midi) {
1344 /* no changes in any parameters that absolutely require a
1345 * restart, so check those that might be changeable without a
1349 if (change_rate && !backend->can_change_sample_rate_when_running()) {
1350 /* can't do this while running ... */
1351 restart_required = true;
1354 if (change_bufsize && !backend->can_change_buffer_size_when_running()) {
1355 /* can't do this while running ... */
1356 restart_required = true;
1362 if (restart_required) {
1363 if (ARDOUR_UI::instance()->disconnect_from_engine ()) {
1370 if (change_driver && backend->set_driver (get_driver())) {
1371 error << string_compose (_("Cannot set driver to %1"), get_driver()) << endmsg;
1374 if (change_device && backend->set_device_name (get_device_name())) {
1375 error << string_compose (_("Cannot set device name to %1"), get_device_name()) << endmsg;
1378 if (change_rate && backend->set_sample_rate (get_rate())) {
1379 error << string_compose (_("Cannot set sample rate to %1"), get_rate()) << endmsg;
1382 if (change_bufsize && backend->set_buffer_size (get_buffer_size())) {
1383 error << string_compose (_("Cannot set buffer size to %1"), get_buffer_size()) << endmsg;
1387 if (change_channels || get_input_channels() == 0 || get_output_channels() == 0) {
1388 if (backend->set_input_channels (get_input_channels())) {
1389 error << string_compose (_("Cannot set input channels to %1"), get_input_channels()) << endmsg;
1392 if (backend->set_output_channels (get_output_channels())) {
1393 error << string_compose (_("Cannot set output channels to %1"), get_output_channels()) << endmsg;
1397 if (change_latency) {
1398 if (backend->set_systemic_input_latency (get_input_latency())) {
1399 error << string_compose (_("Cannot set input latency to %1"), get_input_latency()) << endmsg;
1402 if (backend->set_systemic_output_latency (get_output_latency())) {
1403 error << string_compose (_("Cannot set output latency to %1"), get_output_latency()) << endmsg;
1409 backend->set_midi_option (get_midi_option());
1412 if (start || (was_running && restart_required)) {
1413 if (ARDOUR_UI::instance()->reconnect_to_engine()) {
1424 EngineControl::post_push ()
1426 /* get a pointer to the current state object, creating one if
1430 if (_have_control) {
1431 State* state = get_saved_state_for_currently_displayed_backend_and_device ();
1434 state = save_state ();
1440 for (StateList::iterator i = states.begin(); i != states.end(); ++i) {
1441 (*i).active = false;
1444 /* mark this one active (to be used next time the dialog is
1448 state->active = true;
1450 manage_control_app_sensitivity ();
1453 /* schedule a redisplay of MIDI ports */
1455 Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (*this, &EngineControl::refresh_midi_display), false), 1000);
1460 EngineControl::get_rate () const
1462 float r = atof (sample_rate_combo.get_active_text ());
1463 /* the string may have been translated with an abbreviation for
1464 * thousands, so use a crude heuristic to fix this.
1474 EngineControl::get_buffer_size () const
1476 string txt = buffer_size_combo.get_active_text ();
1479 if (sscanf (txt.c_str(), "%d", &samples) != 1) {
1487 EngineControl::get_midi_option () const
1489 return midi_option_combo.get_active_text();
1493 EngineControl::get_input_channels() const
1495 return (uint32_t) input_channels_adjustment.get_value();
1499 EngineControl::get_output_channels() const
1501 return (uint32_t) output_channels_adjustment.get_value();
1505 EngineControl::get_input_latency() const
1507 return (uint32_t) input_latency_adjustment.get_value();
1511 EngineControl::get_output_latency() const
1513 return (uint32_t) output_latency_adjustment.get_value();
1517 EngineControl::get_backend () const
1519 return backend_combo.get_active_text ();
1523 EngineControl::get_driver () const
1525 return driver_combo.get_active_text ();
1529 EngineControl::get_device_name () const
1531 return device_combo.get_active_text ();
1535 EngineControl::control_app_button_clicked ()
1537 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
1543 backend->launch_control_app ();
1547 EngineControl::manage_control_app_sensitivity ()
1549 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
1555 string appname = backend->control_app_name();
1557 if (appname.empty()) {
1558 control_app_button.set_sensitive (false);
1560 control_app_button.set_sensitive (true);
1565 EngineControl::set_desired_sample_rate (uint32_t sr)
1567 _desired_sample_rate = sr;
1572 EngineControl::on_switch_page (GtkNotebookPage*, guint page_num)
1574 if (page_num == 0) {
1575 cancel_button->set_sensitive (true);
1576 ok_button->set_sensitive (true);
1577 apply_button->set_sensitive (true);
1579 cancel_button->set_sensitive (false);
1580 ok_button->set_sensitive (false);
1581 apply_button->set_sensitive (false);
1584 if (page_num == midi_tab) {
1586 refresh_midi_display ();
1589 if (page_num == latency_tab) {
1592 if (!ARDOUR::AudioEngine::instance()->running()) {
1594 PBD::Unwinder<uint32_t> protect_ignore_changes (ignore_changes, ignore_changes + 1);
1596 /* save any existing latency values */
1598 uint32_t il = (uint32_t) input_latency.get_value ();
1599 uint32_t ol = (uint32_t) input_latency.get_value ();
1601 /* reset to zero so that our new test instance of JACK
1602 will be clean of any existing latency measures.
1605 input_latency.set_value (0);
1606 output_latency.set_value (0);
1610 input_latency.set_value (il);
1611 output_latency.set_value (ol);
1615 if (ARDOUR::AudioEngine::instance()->prepare_for_latency_measurement()) {
1616 disable_latency_tab ();
1619 enable_latency_tab ();
1622 ARDOUR::AudioEngine::instance()->stop_latency_detection();
1626 /* latency measurement */
1629 EngineControl::check_latency_measurement ()
1631 MTDM* mtdm = ARDOUR::AudioEngine::instance()->mtdm ();
1633 if (mtdm->resolve () < 0) {
1634 lm_results.set_markup (string_compose (results_markup, _("No signal detected ")));
1638 if (mtdm->err () > 0.3) {
1644 ARDOUR::framecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
1646 if (sample_rate == 0) {
1647 lm_results.set_markup (string_compose (results_markup, _("Disconnected from audio engine")));
1648 ARDOUR::AudioEngine::instance()->stop_latency_detection ();
1652 uint32_t frames_total = mtdm->del();
1653 uint32_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
1655 snprintf (buf, sizeof (buf), "%u samples / %.3lf ms", extra, extra * 1000.0f/sample_rate);
1659 if (mtdm->err () > 0.2) {
1661 strcat (buf, _("(signal detection error)"));
1667 strcat (buf, _("(inverted - bad wiring)"));
1672 end_latency_detection ();
1673 lm_use_button.set_sensitive (true);
1674 have_lm_results = true;
1677 lm_results.set_markup (string_compose (results_markup, string_compose (_("Detected roundtrip latency: %1"), buf)));
1683 EngineControl::start_latency_detection ()
1685 ARDOUR::AudioEngine::instance()->set_latency_input_port (lm_input_channel_combo.get_active_text());
1686 ARDOUR::AudioEngine::instance()->set_latency_output_port (lm_output_channel_combo.get_active_text());
1688 if (ARDOUR::AudioEngine::instance()->start_latency_detection () == 0) {
1689 lm_results.set_markup (string_compose (results_markup, _("Detecting ...")));
1690 latency_timeout = Glib::signal_timeout().connect (mem_fun (*this, &EngineControl::check_latency_measurement), 100);
1691 lm_measure_button.set_label (_("Cancel"));
1692 have_lm_results = false;
1693 lm_use_button.set_sensitive (false);
1694 lm_input_channel_combo.set_sensitive (false);
1695 lm_output_channel_combo.set_sensitive (false);
1701 EngineControl::end_latency_detection ()
1703 latency_timeout.disconnect ();
1704 ARDOUR::AudioEngine::instance()->stop_latency_detection ();
1705 lm_measure_button.set_label (_("Measure"));
1706 if (!have_lm_results) {
1707 lm_results.set_markup (string_compose (results_markup, _("No measurement results yet")));
1709 lm_use_button.set_sensitive (false);
1711 lm_input_channel_combo.set_sensitive (true);
1712 lm_output_channel_combo.set_sensitive (true);
1717 EngineControl::latency_button_clicked ()
1720 start_latency_detection ();
1722 end_latency_detection ();
1727 EngineControl::use_latency_button_clicked ()
1729 MTDM* mtdm = ARDOUR::AudioEngine::instance()->mtdm ();
1735 uint32_t frames_total = mtdm->del();
1736 uint32_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
1737 uint32_t one_way = extra/2;
1739 input_latency_adjustment.set_value (one_way);
1740 output_latency_adjustment.set_value (one_way);
1742 /* back to settings page */
1744 notebook.set_current_page (0);
1748 EngineControl::on_delete_event (GdkEventAny* ev)
1750 if (notebook.get_current_page() == 2) {
1751 /* currently on latency tab - be sure to clean up */
1752 end_latency_detection ();
1754 return ArdourDialog::on_delete_event (ev);
1758 EngineControl::engine_running ()
1760 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
1763 buffer_size_combo.set_active_text (bufsize_as_string (backend->buffer_size()));
1764 sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate()));
1766 buffer_size_combo.set_sensitive (true);
1767 sample_rate_combo.set_sensitive (true);
1769 connect_disconnect_button.set_label (string_compose (_("Disconnect from %1"), backend->name()));
1771 started_at_least_once = true;
1775 EngineControl::engine_stopped ()
1777 boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
1780 buffer_size_combo.set_sensitive (false);
1781 connect_disconnect_button.set_label (string_compose (_("Connect to %1"), backend->name()));
1783 sample_rate_combo.set_sensitive (true);
1784 buffer_size_combo.set_sensitive (true);
1788 EngineControl::connect_disconnect_click()
1790 if (ARDOUR::AudioEngine::instance()->running()) {
1791 ARDOUR_UI::instance()->disconnect_from_engine ();
1793 ARDOUR_UI::instance()->reconnect_to_engine ();