summaryrefslogtreecommitdiff
path: root/gtk2_ardour/engine_dialog.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-09-26 21:12:37 +0200
committerRobin Gareus <robin@gareus.org>2019-09-26 21:12:37 +0200
commit9d65350600560abfbf324177c0bad66becb0ca50 (patch)
tree1ad29d4938ef6b2cceb832fd05afed013c2251e9 /gtk2_ardour/engine_dialog.cc
parent55e03e5c683d79781c7260a7c50c8aa93808b648 (diff)
Add use-these-engine-settings-from-now-on checkbox
Functional, but this needs a layout fix, still.
Diffstat (limited to 'gtk2_ardour/engine_dialog.cc')
-rw-r--r--gtk2_ardour/engine_dialog.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc
index 5e3ed3ee38..58e559efa7 100644
--- a/gtk2_ardour/engine_dialog.cc
+++ b/gtk2_ardour/engine_dialog.cc
@@ -42,6 +42,8 @@
#include <gtkmm/notebook.h>
#include <gtkmm2ext/utils.h>
+#include "widgets/tooltips.h"
+
#include "ardour/audio_backend.h"
#include "ardour/audioengine.h"
#include "ardour/mtdm.h"
@@ -98,6 +100,7 @@ EngineControl::EngineControl ()
, start_stop_button (_("Stop"))
, update_devices_button (_("Refresh Devices"))
, use_buffered_io_button (_("Use Buffered I/O"), ArdourButton::led_default_elements)
+ , try_autostart_button (_("Autostart"), ArdourButton::led_default_elements)
, lm_measure_label (_("Measure"))
, lm_use_button (_("Use results"))
, lm_back_button (_("Back to settings ... (ignore results)"))
@@ -307,6 +310,15 @@ EngineControl::EngineControl ()
use_buffered_io_button.set_name ("generic button");
use_buffered_io_button.set_can_focus(true);
+ try_autostart_button.signal_clicked.connect (mem_fun (*this, &EngineControl::try_autostart_button_clicked));
+ try_autostart_button.set_name ("generic button");
+ try_autostart_button.set_can_focus(true);
+ config_parameter_changed ("try-autostart-engine");
+ set_tooltip (try_autostart_button,
+ string_compose (_("Always try these settings when starting %1, if the same device is available"), PROGRAM_NAME));
+
+ ARDOUR::Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&EngineControl::config_parameter_changed, this, _1), gui_context());
+
/* Pick up any existing audio setup configuration, if appropriate */
XMLNode* audio_setup = ARDOUR::Config->extra_xml ("AudioMIDISetup");
@@ -453,6 +465,14 @@ EngineControl::on_map ()
ArdourDialog::on_map ();
}
+void
+EngineControl::config_parameter_changed (std::string const & p)
+{
+ if (p == "try-autostart-engine") {
+ try_autostart_button.set_active (ARDOUR::Config->get_try_autostart_engine ());
+ }
+}
+
bool
EngineControl::try_autostart ()
{
@@ -662,6 +682,14 @@ EngineControl::build_full_control_notebook ()
basic_packer.attach (midi_option_combo, 1, 2, row, row + 1, SHRINK, (AttachOptions) 0);
basic_packer.attach (midi_devices_button, 3, 4, row, row+1, xopt, xopt);
row++;
+
+ /* TODO: This button needs some better layout, position (!)
+ * ideally just below the "start" button.
+ * but that place is next to "Driver" and occupied by update_devices_button (Windows, Portaudio Only)
+ * next line after "Device" is the use_buffered_io_button (also Windows only).
+ * crap.
+ */
+ basic_packer.attach (try_autostart_button, 3, 4, row, row+1, xopt, xopt);
}
void
@@ -2764,6 +2792,13 @@ EngineControl::update_devices_button_clicked ()
}
void
+EngineControl::try_autostart_button_clicked ()
+{
+ ARDOUR::Config->set_try_autostart_engine (!try_autostart_button.get_active ());
+ try_autostart_button.set_active (ARDOUR::Config->get_try_autostart_engine ());
+}
+
+void
EngineControl::use_buffered_io_button_clicked ()
{
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();