From 371bf59a94b12fbb08f3cccc09b8761094543d45 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 23 Jun 2014 04:26:53 +0200 Subject: for backends w/o control, save a fake state with only the "active" attribute. This makes ardour start directly with external jack without asking if jack was previously used. It also retains jackd settings if jackd was previously started by ardour. --- gtk2_ardour/engine_dialog.cc | 46 ++++++++++++++++++++++++++------------------ gtk2_ardour/engine_dialog.h | 4 +++- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 8041dd6843..3da4dca38e 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1053,8 +1053,8 @@ EngineControl::get_matching_state ( { for (StateList::iterator i = states.begin(); i != states.end(); ++i) { if ((*i)->backend == backend && - (*i)->driver == driver && - (*i)->device == device) { + (!_have_control || ((*i)->driver == driver && (*i)->device == device))) + { return (*i); } } @@ -1081,11 +1081,19 @@ EngineControl::get_saved_state_for_currently_displayed_backend_and_device () EngineControl::State EngineControl::save_state () { + State state; + if (!_have_control) { - return State(); + state = get_matching_state (backend_combo.get_active_text(), string(), string()); + if (state) { + return state; + } + state.reset(new StateStruct); + state->backend = get_backend (); + } else { + state.reset(new StateStruct); + store_state (state); } - State state (new StateStruct); - store_state (state); for (StateList::iterator i = states.begin(); i != states.end();) { if ((*i)->backend == state->backend && @@ -1604,26 +1612,26 @@ EngineControl::post_push () * necessary */ - if (_have_control) { - State state = get_saved_state_for_currently_displayed_backend_and_device (); + State state = get_saved_state_for_currently_displayed_backend_and_device (); - if (!state) { - state = save_state (); - assert (state); - } + if (!state) { + state = save_state (); + assert (state); + } - /* all off */ + /* all off */ - for (StateList::iterator i = states.begin(); i != states.end(); ++i) { - (*i)->active = false; - } + for (StateList::iterator i = states.begin(); i != states.end(); ++i) { + (*i)->active = false; + } - /* mark this one active (to be used next time the dialog is - * shown) - */ + /* mark this one active (to be used next time the dialog is + * shown) + */ - state->active = true; + state->active = true; + if (_have_control) { // XXX manage_control_app_sensitivity (); } diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 3e3f9b82fb..16de4c2766 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -190,7 +190,9 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { std::vector midi_devices; StateStruct() - : input_latency (0) + : sample_rate (48000) + , buffer_size (1024) + , input_latency (0) , output_latency (0) , input_channels (0) , output_channels (0) -- cgit v1.2.3