Move code from Session::create into the Session constructors
git-svn-id: svn://localhost/ardour2/trunk@1871 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0b0c764f4c
commit
944601ec2d
@ -951,7 +951,7 @@ class Session : public PBD::StatefulDestructible
|
||||
void update_latency_compensation (bool, bool);
|
||||
|
||||
private:
|
||||
int create (bool& new_session, string* mix_template, nframes_t initial_length);
|
||||
int create ();
|
||||
void destroy ();
|
||||
|
||||
void initialize_start_and_end_locations(nframes_t start, nframes_t end);
|
||||
|
@ -126,8 +126,6 @@ Session::Session (AudioEngine &eng,
|
||||
_click_io ((IO*) 0),
|
||||
main_outs (0)
|
||||
{
|
||||
bool new_session;
|
||||
|
||||
if (!eng.connected()) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
@ -139,13 +137,22 @@ Session::Session (AudioEngine &eng,
|
||||
|
||||
first_stage_init (fullpath, snapshot_name);
|
||||
|
||||
new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
|
||||
initialize_start_and_end_locations(0, compute_initial_length ());
|
||||
|
||||
bool new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
|
||||
|
||||
if (new_session) {
|
||||
if (create (new_session, mix_template, compute_initial_length())) {
|
||||
cerr << "create failed\n";
|
||||
// A mix_template must be specified if using this constructor
|
||||
// to create a new session.
|
||||
assert(mix_template);
|
||||
|
||||
if (create () ||
|
||||
!create_session_file_from_template (*mix_template)) {
|
||||
destroy ();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
// Continue construction like a normal saved session from now on.
|
||||
new_session = false;
|
||||
}
|
||||
|
||||
if (second_stage_init (new_session)) {
|
||||
@ -192,8 +199,6 @@ Session::Session (AudioEngine &eng,
|
||||
main_outs (0)
|
||||
|
||||
{
|
||||
bool new_session;
|
||||
|
||||
if (!eng.connected()) {
|
||||
throw failed_constructor();
|
||||
}
|
||||
@ -213,14 +218,14 @@ Session::Session (AudioEngine &eng,
|
||||
|
||||
first_stage_init (fullpath, snapshot_name);
|
||||
|
||||
new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
|
||||
initialize_start_and_end_locations(0, initial_length);
|
||||
|
||||
if (new_session) {
|
||||
if (create (new_session, 0, initial_length)) {
|
||||
if (g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) ||
|
||||
create () ||
|
||||
!create_session_file ()) {
|
||||
destroy ();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
/* set up Master Out and Control Out if necessary */
|
||||
@ -254,7 +259,7 @@ Session::Session (AudioEngine &eng,
|
||||
Config->set_input_auto_connect (input_ac);
|
||||
Config->set_output_auto_connect (output_ac);
|
||||
|
||||
if (second_stage_init (new_session)) {
|
||||
if (second_stage_init (true)) {
|
||||
destroy ();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ Session::create_session_file_from_template (const string& template_path)
|
||||
}
|
||||
|
||||
int
|
||||
Session::create (bool& new_session, string* mix_template, nframes_t initial_length)
|
||||
Session::create ()
|
||||
{
|
||||
string dir;
|
||||
|
||||
@ -541,19 +541,6 @@ Session::create (bool& new_session, string* mix_template, nframes_t initial_leng
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* check new_session so we don't overwrite an existing one */
|
||||
|
||||
if (mix_template) {
|
||||
if(!create_session_file_from_template(*mix_template)) return -1;
|
||||
new_session = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
initialize_start_and_end_locations(0, initial_length);
|
||||
|
||||
if (!create_session_file()) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user