13
0

fix ordering in session construction so that new sessions and existing ones both work

This commit is contained in:
Paul Davis 2013-09-16 09:57:22 -04:00
parent bde50d5396
commit 31157cb343
2 changed files with 26 additions and 11 deletions

View File

@ -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;
}

View File

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