-
- if (!no_splash) {
- ui->show_splash ();
- if (session_name.length()) {
- gtk_timeout_add (4000, show_ui_callback, ui);
- }
- }
-
- try {
- engine = new ARDOUR::AudioEngine (jack_client_name);
- ARDOUR::init (*engine, use_vst, try_hw_optimization, handler2);
- ui->set_engine (*engine);
- }
-
- catch (AudioEngine::NoBackendAvailable& err) {
- gui_jack_error ();
- error << compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg;
- return -1;
- }
-
- catch (failed_constructor& err) {
- error << _("could not initialize Ardour.") << endmsg;
- exit (1);
- }
-
- /* load session, if given */
- string name, path;
-
- if (session_name.length()){
- bool isnew;
-
- if (Session::find_session (session_name, path, name, isnew)) {
- error << compose(_("could not load command line session \"%1\""), session_name) << endmsg;
- } else {
-
- if (new_session) {
-
- /* command line required that the session be new */
-
- if (isnew) {
-
- /* popup the new session dialog
- once everything else is OK.
- */
-
- Main::idle.connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path));
- ui->set_will_create_new_session_automatically (true);
-
- } else {
-
- /* it wasn't new, but we require a new session */
-
- error << compose (_("\n\nA session named \"%1\" already exists.\n\
-To avoid this message, start ardour as \"ardour %1"), path)
- << endmsg;
- goto out;
- }
-
- } else {
-
- /* command line didn't require a new session */
-
- if (isnew) {
- error << compose (_("\n\nNo session named \"%1\" exists.\n\
-To create it from the command line, start ardour as \"ardour --new %1"), path)
- << endmsg;
- goto out;
- }
-
- ui->load_session (path, name);
- }
- }
-
- if (no_splash) {
- ui->show();
- }
-
- } else {
- ui->hide_splash ();
- ui->show ();
- if (!Config->get_no_new_session_dialog()) {
- ui->new_session (true);
- }
- }
-