From 6b3907d57f3f69df420529af308412eeb80306a4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Sep 2013 12:26:59 -0400 Subject: [PATCH] change names, add comment, improve return type to avoid extra call to get EngineControl::State* --- gtk2_ardour/engine_dialog.cc | 15 ++++++++------- gtk2_ardour/engine_dialog.h | 4 ++-- libs/ardour/session.cc | 4 ++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 873498f6ec..923024bdc2 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -538,7 +538,7 @@ EngineControl::get_matching_state (const string& backend, } EngineControl::State* -EngineControl::get_current_state () +EngineControl::get_saved_state_for_currently_displayed_backend_and_device () { boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); @@ -554,11 +554,11 @@ EngineControl::get_current_state () device_combo.get_active_text()); } -void +EngineControl::State* EngineControl::save_state () { bool existing = true; - State* state = get_current_state (); + State* state = get_saved_state_for_currently_displayed_backend_and_device (); if (!state) { existing = false; @@ -578,12 +578,14 @@ EngineControl::save_state () if (!existing) { states.push_back (*state); } + + return state; } void EngineControl::maybe_display_saved_state () { - State* state = get_current_state (); + State* state = get_saved_state_for_currently_displayed_backend_and_device (); if (state) { ignore_changes++; @@ -792,11 +794,10 @@ EngineControl::push_state_to_backend (bool start) * necessary */ - State* state = get_current_state (); + State* state = get_saved_state_for_currently_displayed_backend_and_device (); if (!state) { - save_state (); - state = get_current_state (); + state = save_state (); assert (state); } diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 3872917add..88e5094948 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -154,9 +154,9 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { State* get_matching_state (const std::string& backend, const std::string& driver, const std::string& device); - State* get_current_state (); + State* get_saved_state_for_currently_displayed_backend_and_device (); void maybe_display_saved_state (); - void save_state (); + State* save_state (); static bool print_channel_count (Gtk::SpinButton*); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index e89808e818..443738f777 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -285,6 +285,10 @@ Session::Session (AudioEngine &eng, } } } + + /* we need the audioengine to be up and usable to make much more + * progress with construction, so lets get that started if it isn't already. + */ if (_engine.current_backend() == 0 || _engine.setup_required()) { boost::optional r = AudioEngineSetupRequired (sr);