13
0

change names, add comment, improve return type to avoid extra call to get EngineControl::State*

This commit is contained in:
Paul Davis 2013-09-12 12:26:59 -04:00
parent 4df3666738
commit 6b3907d57f
3 changed files with 14 additions and 9 deletions

View File

@ -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<ARDOUR::AudioBackend> 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);
}

View File

@ -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*);

View File

@ -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<int> r = AudioEngineSetupRequired (sr);