diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-16 09:57:22 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-16 09:57:22 -0400 |
commit | 31157cb343ad1b6a82134c92c77fb37d983cc5ed (patch) | |
tree | edcb1b56ad685a61d5338e0ff7dfb095cb068798 /libs/ardour | |
parent | bde50d5396b49ac982686034c3165c337b7069a7 (diff) |
fix ordering in session construction so that new sessions and existing ones both work
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/session.cc | 30 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 7 |
2 files changed, 26 insertions, 11 deletions
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 (); |