diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index cad869a577..e2deb71639 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -264,11 +264,18 @@ Session::Session (AudioEngine &eng, pre_engine_init (fullpath); if (_is_new) { + if (ensure_engine (sr)) { + destroy (); + throw failed_constructor (); + } + if (create (mix_template, bus_profile)) { destroy (); throw failed_constructor (); } + } else { + if (load_state (_current_snapshot_name)) { throw failed_constructor (); } @@ -284,11 +291,11 @@ Session::Session (AudioEngine &eng, sr = atoi (prop->value()); } } - } - if (ensure_engine (sr)) { - destroy (); - throw failed_constructor (); + if (ensure_engine (sr)) { + destroy (); + throw failed_constructor (); + } } if (post_engine_init ()) { @@ -361,6 +368,21 @@ Session::ensure_engine (uint32_t desired_sample_rate) return -1; } + /* the graph is just about as basic to everything else as the engine + so we create it here. this results in it coming into being at just + the right time for both new and existing sessions. + + XXX some cleanup in the new/existing path is still waiting to be + done + */ + + if (how_many_dsp_threads () > 1) { + /* For now, only create the graph if we are using >1 DSP threads, as + it is a bit slower than the old code with 1 thread. + */ + _process_graph.reset (new Graph (*this)); + } + return 0; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index e847ba45ce..99fa3f4a3b 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -210,13 +210,6 @@ Session::post_engine_init () set_block_size (_engine.samples_per_cycle()); set_frame_rate (_engine.sample_rate()); - if (how_many_dsp_threads () > 1) { - /* For now, only create the graph if we are using >1 DSP threads, as - it is a bit slower than the old code with 1 thread. - */ - _process_graph.reset (new Graph (*this)); - } - n_physical_outputs = _engine.n_physical_outputs (); n_physical_inputs = _engine.n_physical_inputs ();