summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-05-09 01:19:03 +0200
committerRobin Gareus <robin@gareus.org>2020-05-09 01:19:03 +0200
commitdffe780d9501abcf63b3865ec547155cd3ca4cf2 (patch)
tree3077bebd02ebeb3d3ff172aa9e672a351b71fa2a /gtk2_ardour
parentfe8df2eeae8939da58e0e78950c50fc12fe076bb (diff)
Engine-dialog: latency spinbox sensitivity
This allows to change latency while running using numeric entry or otherwise makes the spinboxes insensitive.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/engine_dialog.cc46
-rw-r--r--gtk2_ardour/engine_dialog.h3
2 files changed, 36 insertions, 13 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc
index 36c2364230..1363a63e28 100644
--- a/gtk2_ardour/engine_dialog.cc
+++ b/gtk2_ardour/engine_dialog.cc
@@ -371,13 +371,13 @@ EngineControl::connect_changed_signals ()
sigc::mem_fun (*this, &EngineControl::output_device_changed));
input_latency_connection = input_latency.signal_changed ().connect (
- sigc::mem_fun (*this, &EngineControl::parameter_changed));
+ sigc::mem_fun (*this, &EngineControl::latency_changed));
output_latency_connection = output_latency.signal_changed ().connect (
- sigc::mem_fun (*this, &EngineControl::parameter_changed));
+ sigc::mem_fun (*this, &EngineControl::latency_changed));
input_channels_connection = input_channels.signal_changed ().connect (
- sigc::mem_fun (*this, &EngineControl::parameter_changed));
+ sigc::mem_fun (*this, &EngineControl::channels_changed));
output_channels_connection = output_channels.signal_changed ().connect (
- sigc::mem_fun (*this, &EngineControl::parameter_changed));
+ sigc::mem_fun (*this, &EngineControl::channels_changed));
}
void
@@ -887,6 +887,14 @@ EngineControl::update_sensitivity ()
valid = false;
}
+ if (!engine_running || backend->can_change_systemic_latency_when_running ()) {
+ input_latency.set_sensitive (true);
+ output_latency.set_sensitive (true);
+ } else {
+ input_latency.set_sensitive (false);
+ output_latency.set_sensitive (false);
+ }
+
if (get_popdown_string_count (sample_rate_combo) > 0) {
bool allow_to_set_rate = false;
if (!engine_running) {
@@ -1801,7 +1809,22 @@ EngineControl::midi_option_changed ()
}
void
-EngineControl::parameter_changed ()
+EngineControl::latency_changed ()
+{
+ boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
+ if (!backend || !_have_control || !ARDOUR::AudioEngine::instance()->running ()) {
+ return;
+ }
+ if (!backend->can_change_systemic_latency_when_running ()) {
+ return;
+ }
+ backend->set_systemic_input_latency (get_input_latency ());
+ backend->set_systemic_output_latency (get_output_latency ());
+ post_push ();
+}
+
+void
+EngineControl::channels_changed ()
{
}
@@ -3200,20 +3223,19 @@ EngineControl::use_latency_button_clicked ()
double one_way = rint ((mtdm->del() - ARDOUR::AudioEngine::instance()->latency_signal_delay()) / 2.0);
one_way = std::max (0., one_way);
- input_latency_adjustment.set_value (one_way);
- output_latency_adjustment.set_value (one_way);
-
State state = get_saved_state_for_currently_displayed_backend_and_device ();
if (state) {
state->lm_input = lm_input_channel_combo.get_active ()->get_value (lm_input_channel_cols.port_name);
state->lm_output = lm_output_channel_combo.get_active ()->get_value (lm_output_channel_cols.port_name);
- post_push ();
+ post_push (); /* save */
}
- if (backend->can_change_systemic_latency_when_running ()) {
- backend->set_systemic_input_latency (one_way);
- backend->set_systemic_output_latency (one_way);
+ /* these trigger EngineControl::latency_changed, and a post_push()
+ * when the latency can be changed while running */
+ input_latency_adjustment.set_value (one_way);
+ output_latency_adjustment.set_value (one_way);
+ if (backend->can_change_systemic_latency_when_running ()) {
/* engine is running, continue to load session.
* RESPONSE_OK is a NO-OP when the dialog is displayed as Window
* from a running instance.
diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h
index bf66722d64..e80c110c90 100644
--- a/gtk2_ardour/engine_dialog.h
+++ b/gtk2_ardour/engine_dialog.h
@@ -153,7 +153,8 @@ private:
void sample_rate_changed ();
void buffer_size_changed ();
void nperiods_changed ();
- void parameter_changed ();
+ void channels_changed ();
+ void latency_changed ();
void midi_option_changed ();
void setup_midi_tab_for_backend ();