2019-09-23 16:49:06 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005-2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2005-2017 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
* Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2008-2010 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
* Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
|
|
|
|
* Copyright (C) 2013-2016 John Emmas <john@creativepost.co.uk>
|
|
|
|
* Copyright (C) 2013-2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015 André Nusser <andre.nusser@googlemail.com>
|
|
|
|
* Copyright (C) 2016-2018 Len Ovens <len@ovenwerks.net>
|
|
|
|
* Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#include "gtk2ardour-version.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PLATFORM_WINDOWS
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include "pbd/gstdio_compat.h"
|
|
|
|
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
|
|
|
#include "pbd/basename.h"
|
|
|
|
#include "pbd/file_utils.h"
|
|
|
|
|
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
#include "ardour/filename_extensions.h"
|
|
|
|
#include "ardour/filesystem_paths.h"
|
|
|
|
#include "ardour/profile.h"
|
2022-07-26 19:03:03 -04:00
|
|
|
#include "ardour/recent_sessions.h"
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
#include "gtkmm2ext/application.h"
|
|
|
|
|
|
|
|
#include "ambiguous_file_dialog.h"
|
2019-12-14 17:31:24 -05:00
|
|
|
#include "ardour_message.h"
|
2019-09-23 16:49:06 -04:00
|
|
|
#include "ardour_ui.h"
|
2019-10-24 23:13:08 -04:00
|
|
|
#include "debug.h"
|
2019-09-23 16:49:06 -04:00
|
|
|
#include "engine_dialog.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "missing_file_dialog.h"
|
|
|
|
#include "nsm.h"
|
|
|
|
#include "opts.h"
|
|
|
|
#include "pingback.h"
|
2020-05-20 20:04:24 -04:00
|
|
|
#include "plugin_scan_dialog.h"
|
2019-09-23 16:49:06 -04:00
|
|
|
#include "public_editor.h"
|
|
|
|
#include "splash.h"
|
2021-07-05 20:08:56 -04:00
|
|
|
#include "ui_config.h"
|
2019-09-23 16:49:06 -04:00
|
|
|
|
2019-09-26 00:11:30 -04:00
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
2023-09-14 13:36:10 -04:00
|
|
|
using namespace Temporal;
|
2019-09-23 16:49:06 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
static bool
|
|
|
|
_hide_splash (gpointer arg)
|
|
|
|
{
|
|
|
|
((ARDOUR_UI*)arg)->hide_splash();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ARDOUR_UI::first_idle ()
|
|
|
|
{
|
|
|
|
if (_session) {
|
2020-03-30 11:43:16 -04:00
|
|
|
_session->reset_xrun_count ();
|
2019-09-23 16:49:06 -04:00
|
|
|
_session->allow_auto_play (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (editor) {
|
|
|
|
editor->first_idle();
|
|
|
|
}
|
|
|
|
|
2020-01-17 12:52:33 -05:00
|
|
|
/* in 1 second, hide the splash screen */
|
2019-09-23 16:49:06 -04:00
|
|
|
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 1000);
|
|
|
|
|
|
|
|
Keyboard::set_can_save_keybindings (true);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::setup_profile ()
|
|
|
|
{
|
|
|
|
if (gdk_screen_width() < 1200 || getenv ("ARDOUR_NARROW_SCREEN")) {
|
|
|
|
Profile->set_small_screen ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_getenv ("MIXBUS")) {
|
|
|
|
Profile->set_mixbus ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ARDOUR_UI::missing_file (Session*s, std::string str, DataType type)
|
|
|
|
{
|
2021-07-06 18:33:50 -04:00
|
|
|
MissingFileDialog dialog (_main_window, s, str, type);
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
dialog.show ();
|
|
|
|
dialog.present ();
|
|
|
|
|
|
|
|
int result = dialog.run ();
|
|
|
|
dialog.hide ();
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
case RESPONSE_OK:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 1; // quit entire session load
|
|
|
|
}
|
|
|
|
|
|
|
|
result = dialog.get_action ();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ARDOUR_UI::ambiguous_file (std::string file, std::vector<std::string> hits)
|
|
|
|
{
|
|
|
|
AmbiguousFileDialog dialog (file, hits);
|
|
|
|
|
|
|
|
dialog.show ();
|
|
|
|
dialog.present ();
|
|
|
|
|
|
|
|
dialog.run ();
|
|
|
|
|
|
|
|
return dialog.get_which ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::session_format_mismatch (std::string xml_path, std::string backup_path)
|
|
|
|
{
|
|
|
|
const char* start_big = "<span size=\"x-large\" weight=\"bold\">";
|
|
|
|
const char* end_big = "</span>";
|
|
|
|
const char* start_mono = "<tt>";
|
|
|
|
const char* end_mono = "</tt>";
|
|
|
|
|
2019-12-14 17:31:24 -05:00
|
|
|
ArdourMessageDialog msg (string_compose (_("%4This is a session from an older version of %3%5\n\n"
|
|
|
|
"%3 has copied the old session file\n\n%6%1%7\n\nto\n\n%6%2%7\n\n"
|
|
|
|
"From now on, use the backup copy with older versions of %3"),
|
|
|
|
xml_path, backup_path, PROGRAM_NAME,
|
|
|
|
start_big, end_big,
|
|
|
|
start_mono, end_mono), true);
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
msg.run ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ARDOUR_UI::sr_mismatch_dialog (samplecnt_t desired, samplecnt_t actual)
|
|
|
|
{
|
|
|
|
HBox* hbox = new HBox();
|
|
|
|
Image* image = new Image (Stock::DIALOG_WARNING, ICON_SIZE_DIALOG);
|
|
|
|
ArdourDialog dialog (_("Sample Rate Mismatch"), true);
|
2023-01-30 19:21:48 -05:00
|
|
|
Label message (string_compose (_("\
|
|
|
|
This session was created with a sample rate of %1 Hz, but \
|
|
|
|
%2 is currently running at %3 Hz. If you load this session, \
|
|
|
|
audio will be resampled, which reduces quality.\n"), desired, PROGRAM_NAME, actual));
|
|
|
|
message.set_line_wrap ();
|
2019-09-23 16:49:06 -04:00
|
|
|
|
2022-01-26 18:04:44 -05:00
|
|
|
image->set_alignment(ALIGN_CENTER, ALIGN_START);
|
2019-09-23 16:49:06 -04:00
|
|
|
hbox->pack_start (*image, PACK_EXPAND_WIDGET, 12);
|
|
|
|
hbox->pack_end (message, PACK_EXPAND_PADDING, 12);
|
|
|
|
dialog.get_vbox()->pack_start(*hbox, PACK_EXPAND_PADDING, 6);
|
2022-08-06 16:35:01 -04:00
|
|
|
|
|
|
|
if (ARDOUR::AudioEngine::instance ()->setup_required ()) {
|
|
|
|
dialog.add_button (_("Reconfigure Engine"), RESPONSE_YES);
|
|
|
|
}
|
2019-09-23 16:49:06 -04:00
|
|
|
dialog.add_button (_("Do not load session"), RESPONSE_REJECT);
|
|
|
|
dialog.add_button (_("Load session anyway"), RESPONSE_ACCEPT);
|
|
|
|
dialog.set_default_response (RESPONSE_ACCEPT);
|
|
|
|
dialog.set_position (WIN_POS_CENTER);
|
|
|
|
message.show();
|
|
|
|
image->show();
|
|
|
|
hbox->show();
|
|
|
|
|
|
|
|
switch (dialog.run()) {
|
2022-08-06 16:35:01 -04:00
|
|
|
case RESPONSE_YES:
|
|
|
|
ARDOUR::AudioEngine::instance ()->stop ();
|
|
|
|
(dynamic_cast<EngineControl*> (audio_midi_setup.get (true)))->run ();
|
|
|
|
(dynamic_cast<EngineControl*> (audio_midi_setup.get (true)))->hide ();
|
|
|
|
return AudioEngine::instance()->running () ? -1 : 1;
|
2019-09-23 16:49:06 -04:00
|
|
|
case RESPONSE_ACCEPT:
|
|
|
|
return 0;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::sr_mismatch_message (samplecnt_t desired, samplecnt_t actual)
|
|
|
|
{
|
2019-12-14 17:31:24 -05:00
|
|
|
ArdourMessageDialog msg (string_compose (_("\
|
2023-01-30 19:21:48 -05:00
|
|
|
This session was created with a sample rate of %1 Hz, but \
|
2019-09-23 16:49:06 -04:00
|
|
|
%2 is currently running at %3 Hz.\n\
|
2023-01-30 19:21:48 -05:00
|
|
|
Audio is resampled for both playback and recording to match the sampling \
|
|
|
|
rate, which reduces quality. Reconfigure the Audio Engine in \
|
2019-09-23 16:49:06 -04:00
|
|
|
Menu > Window > Audio/Midi Setup"),
|
|
|
|
desired, PROGRAM_NAME, actual),
|
|
|
|
true,
|
|
|
|
Gtk::MESSAGE_WARNING);
|
|
|
|
msg.run ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::preferences_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("Preferences"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("Preferences"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Preferences"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::mixer_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("Mixer"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("Mixer"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Mixer"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::main_window_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("Main"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("Main"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
if (getenv("ARDOUR_INSTANT_XML_PATH")) {
|
|
|
|
node = Config->instant_xml(getenv("ARDOUR_INSTANT_XML_PATH"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Main"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::editor_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("Editor"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("Editor"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
if (getenv("ARDOUR_INSTANT_XML_PATH")) {
|
|
|
|
node = Config->instant_xml(getenv("ARDOUR_INSTANT_XML_PATH"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Editor"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2020-10-26 17:55:00 -04:00
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::recorder_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("Recorder"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("Recorder"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Recorder"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2021-11-08 20:27:38 -05:00
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::trigger_page_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("TriggerPage"));
|
|
|
|
} else {
|
|
|
|
node = Config->instant_xml(X_("TriggerPage"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("TriggerPage"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2022-10-10 15:03:07 -04:00
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::clock_mode_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
node = _session->instant_xml(X_("ClockModes"));
|
|
|
|
}
|
|
|
|
if (!node) {
|
|
|
|
node = Config->instant_xml(X_("ClockModes"));
|
|
|
|
}
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("ClockModes"));
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
XMLNode*
|
|
|
|
ARDOUR_UI::keyboard_settings () const
|
|
|
|
{
|
|
|
|
XMLNode* node = 0;
|
|
|
|
|
|
|
|
node = Config->extra_xml(X_("Keyboard"));
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
node = new XMLNode (X_("Keyboard"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::hide_splash ()
|
|
|
|
{
|
2019-10-11 16:29:55 -04:00
|
|
|
Splash::drop ();
|
2019-09-23 16:49:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::check_announcements ()
|
|
|
|
{
|
|
|
|
#ifdef PHONE_HOME
|
|
|
|
string _annc_filename;
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
_annc_filename = PROGRAM_NAME "_announcements_osx_";
|
|
|
|
#elif defined PLATFORM_WINDOWS
|
|
|
|
_annc_filename = PROGRAM_NAME "_announcements_windows_";
|
|
|
|
#else
|
|
|
|
_annc_filename = PROGRAM_NAME "_announcements_linux_";
|
|
|
|
#endif
|
|
|
|
_annc_filename.append (VERSIONSTRING);
|
|
|
|
|
|
|
|
_announce_string = "";
|
|
|
|
|
|
|
|
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
|
|
|
FILE* fin = g_fopen (path.c_str(), "rb");
|
|
|
|
if (fin) {
|
|
|
|
while (!feof (fin)) {
|
|
|
|
char tmp[1024];
|
|
|
|
size_t len;
|
|
|
|
if ((len = fread (tmp, sizeof(char), 1024, fin)) == 0 || ferror (fin)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_announce_string.append (tmp, len);
|
|
|
|
}
|
|
|
|
fclose (fin);
|
|
|
|
}
|
|
|
|
|
|
|
|
pingback (VERSIONSTRING, path);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-10-03 19:23:57 -04:00
|
|
|
int
|
|
|
|
ARDOUR_UI::nsm_init ()
|
|
|
|
{
|
|
|
|
const char *nsm_url;
|
|
|
|
|
|
|
|
if ((nsm_url = g_getenv ("NSM_URL")) == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsm = new NSM_Client;
|
|
|
|
|
|
|
|
if (nsm->init (nsm_url)) {
|
|
|
|
delete nsm;
|
|
|
|
nsm = 0;
|
|
|
|
error << _("NSM: initialization failed") << endmsg;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the ardour executable may have different names:
|
|
|
|
*
|
|
|
|
* waf's obj.target for distro versions: eg ardour4, ardourvst4
|
|
|
|
* Ardour4, Mixbus3 for bundled versions + full path on OSX & windows
|
|
|
|
* argv[0] does not apply since we need the wrapper-script (not the binary itself)
|
|
|
|
*
|
|
|
|
* The wrapper startup script should set the environment variable 'ARDOUR_SELF'
|
|
|
|
*/
|
|
|
|
const char *process_name = g_getenv ("ARDOUR_SELF");
|
2021-12-02 08:34:58 -05:00
|
|
|
nsm->announce (PROGRAM_NAME, ":dirty:switch:", process_name ? process_name : "ardour7");
|
2019-10-03 19:23:57 -04:00
|
|
|
|
|
|
|
unsigned int i = 0;
|
|
|
|
// wait for announce reply from nsm server
|
|
|
|
for ( i = 0; i < 5000; ++i) {
|
|
|
|
nsm->check ();
|
|
|
|
|
|
|
|
Glib::usleep (i);
|
|
|
|
if (nsm->is_active()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == 5000) {
|
2020-05-13 12:34:00 -04:00
|
|
|
error << _("NSM server did not announce itself. Continuing without NSM.") << endmsg;
|
|
|
|
delete nsm;
|
|
|
|
nsm = 0;
|
|
|
|
return 0;
|
2019-10-03 19:23:57 -04:00
|
|
|
}
|
2020-05-20 20:04:24 -04:00
|
|
|
|
|
|
|
/* wait for open command from nsm server */
|
|
|
|
for (i = 0; i < 5000; ++i) {
|
2019-10-03 19:23:57 -04:00
|
|
|
nsm->check ();
|
|
|
|
Glib::usleep (1000);
|
|
|
|
if (nsm->client_id ()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 5000) {
|
|
|
|
error << _("NSM: no client ID provided") << endmsg;
|
2020-05-13 12:34:00 -04:00
|
|
|
delete nsm;
|
|
|
|
nsm = 0;
|
2019-10-03 19:23:57 -04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_session && nsm) {
|
|
|
|
_session->set_nsm_state( nsm->is_active() );
|
|
|
|
} else {
|
|
|
|
error << _("NSM: no session created") << endmsg;
|
2020-05-13 12:34:00 -04:00
|
|
|
delete nsm;
|
|
|
|
nsm = 0;
|
2019-10-03 19:23:57 -04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsm requires these actions disabled
|
|
|
|
vector<string> action_names;
|
|
|
|
action_names.push_back("SaveAs");
|
|
|
|
action_names.push_back("Rename");
|
|
|
|
action_names.push_back("New");
|
|
|
|
action_names.push_back("Open");
|
|
|
|
action_names.push_back("Recent");
|
|
|
|
action_names.push_back("Close");
|
|
|
|
|
|
|
|
for (vector<string>::const_iterator n = action_names.begin(); n != action_names.end(); ++n) {
|
|
|
|
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Main"), (*n).c_str());
|
|
|
|
if (act) {
|
|
|
|
act->set_sensitive (false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
void
|
|
|
|
ARDOUR_UI::sfsm_response (StartupFSM::Result r)
|
|
|
|
{
|
2019-10-24 23:13:08 -04:00
|
|
|
DEBUG_TRACE (DEBUG::GuiStartup, string_compose (X_("startup FSM response %1\n"), r));
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
switch (r) {
|
2022-11-19 23:29:41 -05:00
|
|
|
case StartupFSM::ExitProgram: {
|
2022-11-28 12:18:43 -05:00
|
|
|
/* failure mode */
|
2022-11-19 23:29:41 -05:00
|
|
|
std::stringstream str;;
|
|
|
|
dump_errors (str, 10);
|
|
|
|
std::string msg (string_compose (_("<span font_size=\"large\" font_weight=\"bold\">Something went seriously wrong. %1 cannot continue.</span>\n\n"
|
|
|
|
"Here are a few hints at what might be wrong:\n\n%2"),
|
|
|
|
PROGRAM_NAME,
|
|
|
|
str.str()));
|
|
|
|
ArdourMessageDialog d (msg, true);
|
2022-11-20 00:25:03 -05:00
|
|
|
d.set_title (string_compose (_("%1: Unrecoverable Error"), PROGRAM_NAME));
|
2022-11-19 23:29:41 -05:00
|
|
|
d.run();
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
queue_finish ();
|
2022-11-19 23:29:41 -05:00
|
|
|
}
|
2019-10-09 22:50:34 -04:00
|
|
|
break;
|
2019-10-24 23:13:08 -04:00
|
|
|
|
2022-11-28 12:18:43 -05:00
|
|
|
case StartupFSM::QuitProgram:
|
|
|
|
/* user explicitly requested quit */
|
|
|
|
queue_finish ();
|
|
|
|
break;
|
|
|
|
|
2024-02-14 18:33:34 -05:00
|
|
|
case StartupFSM::LoadedSession:
|
|
|
|
startup_done ();
|
|
|
|
break;
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
case StartupFSM::LoadSession:
|
2019-10-24 23:13:08 -04:00
|
|
|
|
2019-10-10 17:24:20 -04:00
|
|
|
if (load_session_from_startup_fsm () == 0) {
|
2020-06-12 16:08:04 -04:00
|
|
|
startup_done ();
|
2019-10-24 23:13:08 -04:00
|
|
|
} else {
|
2020-06-12 16:08:04 -04:00
|
|
|
DEBUG_TRACE (DEBUG::GuiStartup, "FSM reset\n");
|
2019-10-24 23:13:08 -04:00
|
|
|
startup_fsm->reset ();
|
2019-10-10 17:24:20 -04:00
|
|
|
}
|
2019-10-24 23:13:08 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
int
|
|
|
|
ARDOUR_UI::starting ()
|
|
|
|
{
|
2019-12-14 12:20:55 -05:00
|
|
|
Application* app = Application::instance();
|
|
|
|
|
2020-03-05 19:34:41 -05:00
|
|
|
app->ShouldLoad.connect (sigc::mem_fun (*this, &ARDOUR_UI::load_from_application_api));
|
|
|
|
|
2021-07-05 20:08:56 -04:00
|
|
|
if (ARDOUR_COMMAND_LINE::check_announcements
|
|
|
|
#ifndef MIXBUS
|
|
|
|
&& UIConfiguration::instance().get_check_announcements ()
|
|
|
|
#endif
|
|
|
|
) {
|
2019-09-23 16:49:06 -04:00
|
|
|
check_announcements ();
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:20:55 -05:00
|
|
|
app->ready ();
|
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
/* we need to create this early because it may need to set the
|
|
|
|
* audio backend end up.
|
|
|
|
*/
|
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
EngineControl* amd;
|
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
try {
|
2019-10-09 22:50:34 -04:00
|
|
|
amd = dynamic_cast<EngineControl*> (audio_midi_setup.get (true));
|
2019-09-23 16:49:06 -04:00
|
|
|
} catch (...) {
|
|
|
|
std::cerr << "audio-midi engine setup failed."<< std::endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-03 19:23:57 -04:00
|
|
|
if (nsm_init ()) {
|
|
|
|
return -1;
|
2019-09-23 16:49:06 -04:00
|
|
|
} else {
|
|
|
|
|
2020-05-20 20:04:24 -04:00
|
|
|
if (nsm) {
|
|
|
|
return 0;
|
|
|
|
}
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
startup_fsm = new StartupFSM (*amd);
|
|
|
|
startup_fsm->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::sfsm_response));
|
|
|
|
|
2020-06-12 16:08:04 -04:00
|
|
|
|
|
|
|
/* allow signals to be handled, ShouldLoad() from flush-pending */
|
2021-06-23 06:52:16 -04:00
|
|
|
Splash::instance()->exists(); // create splash
|
2020-06-12 16:08:04 -04:00
|
|
|
flush_pending ();
|
|
|
|
|
|
|
|
if (!startup_fsm) {
|
|
|
|
DEBUG_TRACE (DEBUG::GuiStartup, "Starting: SFSM was driven by flush-pending\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-18 02:07:31 -04:00
|
|
|
/* Note: entire startup process could happen in this one call
|
|
|
|
* if:
|
|
|
|
*
|
|
|
|
* 1) not a new user
|
|
|
|
* 2) session name provided on command line (and valid)
|
|
|
|
* 3) no audio/MIDI setup required
|
|
|
|
*/
|
|
|
|
|
|
|
|
startup_fsm->start ();
|
2023-09-18 18:26:41 -04:00
|
|
|
|
|
|
|
if (startup_fsm->complete()) {
|
|
|
|
delete startup_fsm;
|
|
|
|
startup_fsm = 0;
|
|
|
|
}
|
2019-10-09 22:50:34 -04:00
|
|
|
}
|
2019-09-23 16:49:06 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-26 19:03:03 -04:00
|
|
|
int
|
|
|
|
ARDOUR_UI::copy_demo_sessions ()
|
|
|
|
{
|
|
|
|
int copied = 0;
|
|
|
|
if (ARDOUR::Profile->get_mixbus () && Config->get_copy_demo_sessions ()) {
|
|
|
|
std::string dspd (Config->get_default_session_parent_dir());
|
|
|
|
Searchpath ds (ARDOUR::ardour_data_search_path());
|
|
|
|
ds.add_subdirectory_to_paths ("sessions");
|
|
|
|
vector<string> demos;
|
|
|
|
find_files_matching_pattern (demos, ds, string_compose ("*%1", ARDOUR::session_archive_suffix));
|
|
|
|
|
|
|
|
ARDOUR::RecentSessions rs;
|
|
|
|
ARDOUR::read_recent_sessions (rs);
|
|
|
|
|
|
|
|
for (vector<string>::iterator i = demos.begin(); i != demos.end (); ++i) {
|
|
|
|
/* "demo-session" must be inside "demo-session.<session_archive_suffix>" */
|
|
|
|
std::string name = basename_nosuffix (basename_nosuffix (*i));
|
|
|
|
std::string path = Glib::build_filename (dspd, name);
|
|
|
|
/* skip if session-dir already exists */
|
|
|
|
if (Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_DIR)) {
|
|
|
|
/* ..but add it to recent-list */
|
|
|
|
store_recent_sessions (name, path);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* skip sessions that are already in 'recent'.
|
|
|
|
* eg. a new user changed <session-default-dir> shortly after installation
|
|
|
|
*/
|
|
|
|
for (ARDOUR::RecentSessions::iterator r = rs.begin(); r != rs.end(); ++r) {
|
|
|
|
if ((*r).first == name) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
PBD::FileArchive ar (*i);
|
|
|
|
if (0 == ar.inflate (dspd)) {
|
|
|
|
store_recent_sessions (name, path);
|
|
|
|
info << string_compose (_("Copied demo session `%1'."), name) << endmsg;
|
|
|
|
++copied;
|
|
|
|
}
|
|
|
|
} catch (...) {
|
|
|
|
info << string_compose (_("Failed to extract demo session `%1'."), name) << endmsg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return copied;
|
|
|
|
}
|
|
|
|
|
2019-10-10 17:24:20 -04:00
|
|
|
int
|
2019-10-09 22:50:34 -04:00
|
|
|
ARDOUR_UI::load_session_from_startup_fsm ()
|
|
|
|
{
|
2023-09-14 13:36:10 -04:00
|
|
|
const string session_path = startup_fsm->session_path;
|
|
|
|
const string session_name = startup_fsm->session_name;
|
|
|
|
const string session_template = startup_fsm->session_template;
|
|
|
|
const bool session_is_new = startup_fsm->session_is_new;
|
|
|
|
const bool session_was_not_named = (!startup_fsm->session_name_edited && ARDOUR_COMMAND_LINE::session_name.empty());
|
|
|
|
const TimeDomain session_domain = startup_fsm->session_domain;
|
|
|
|
const BusProfile bus_profile = startup_fsm->bus_profile;
|
2019-10-09 22:50:34 -04:00
|
|
|
|
|
|
|
if (session_is_new) {
|
|
|
|
|
2023-09-14 13:36:10 -04:00
|
|
|
if (build_session (session_path, session_name, session_template, bus_profile, true, session_was_not_named, session_domain)) {
|
2019-10-10 17:24:20 -04:00
|
|
|
return -1;
|
2019-09-23 16:49:06 -04:00
|
|
|
}
|
2019-10-10 17:24:20 -04:00
|
|
|
return 0;
|
|
|
|
}
|
2019-10-09 22:50:34 -04:00
|
|
|
|
2023-09-18 18:26:41 -04:00
|
|
|
int ret = load_session (session_path, session_name, session_template);
|
|
|
|
|
|
|
|
if (!ret) {
|
|
|
|
startup_fsm->set_complete ();
|
|
|
|
}
|
2019-09-23 16:49:06 -04:00
|
|
|
|
2023-09-18 18:26:41 -04:00
|
|
|
return ret;
|
2019-10-09 22:50:34 -04:00
|
|
|
}
|
2019-09-23 16:49:06 -04:00
|
|
|
|
2019-10-09 22:50:34 -04:00
|
|
|
void
|
|
|
|
ARDOUR_UI::startup_done ()
|
|
|
|
{
|
2019-12-14 12:36:31 -05:00
|
|
|
/* ShouldQuit is a desktop environment mechanism that tells the
|
|
|
|
application it should exit for reasons external to the application
|
|
|
|
itself.
|
|
|
|
|
|
|
|
During startup, startupFSM handles ShouldQuit. But it is done now,
|
|
|
|
and we have to take over responsibility.
|
|
|
|
*/
|
|
|
|
Application::instance()->ShouldQuit.connect (sigc::mem_fun (*this, &ARDOUR_UI::queue_finish));
|
2020-03-01 23:35:44 -05:00
|
|
|
/* Same story applies for ShouldLoad ... startupFSM will handle it
|
|
|
|
normally, but if it doesn't we (ARDOUR_UI) need to take responsibility
|
|
|
|
for it.
|
|
|
|
*/
|
|
|
|
Application::instance()->ShouldLoad.connect (sigc::mem_fun (*this, &ARDOUR_UI::load_from_application_api));
|
2019-12-14 12:36:31 -05:00
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
use_config ();
|
|
|
|
|
|
|
|
WM::Manager::instance().show_visible ();
|
|
|
|
|
|
|
|
/* We have to do this here since goto_editor_window() ends up calling show_all() on the
|
|
|
|
* editor window, and we may want stuff to be hidden.
|
|
|
|
*/
|
|
|
|
_status_bar_visibility.update ();
|
|
|
|
|
|
|
|
BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME));
|
2023-11-14 13:03:09 -05:00
|
|
|
|
|
|
|
startup_fsm->set_complete ();
|
2019-09-23 16:49:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::use_config ()
|
|
|
|
{
|
|
|
|
XMLNode* node = Config->extra_xml (X_("TransportControllables"));
|
|
|
|
if (node) {
|
|
|
|
set_transport_controllable_state (*node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::check_memory_locking ()
|
|
|
|
{
|
|
|
|
#if defined(__APPLE__) || defined(PLATFORM_WINDOWS)
|
|
|
|
/* OS X doesn't support mlockall(2), and so testing for memory locking capability there is pointless */
|
|
|
|
return;
|
|
|
|
#else // !__APPLE__
|
|
|
|
|
|
|
|
XMLNode* memory_warning_node = Config->instant_xml (X_("no-memory-warning"));
|
|
|
|
|
2024-09-27 22:15:08 -04:00
|
|
|
if (memory_warning_node == 0) {
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
struct rlimit limits;
|
|
|
|
int64_t ram;
|
|
|
|
long pages, page_size;
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
size_t pages_len=sizeof(pages);
|
|
|
|
if ((page_size = getpagesize()) < 0 ||
|
|
|
|
sysctlbyname("hw.availpages", &pages, &pages_len, NULL, 0))
|
|
|
|
#else
|
|
|
|
if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
ram = 0;
|
|
|
|
} else {
|
|
|
|
ram = (int64_t) pages * (int64_t) page_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getrlimit (RLIMIT_MEMLOCK, &limits)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (limits.rlim_cur != RLIM_INFINITY) {
|
|
|
|
|
|
|
|
if (ram == 0 || ((double) limits.rlim_cur / ram) < 0.75) {
|
|
|
|
|
2019-12-14 17:31:24 -05:00
|
|
|
ArdourMessageDialog msg (
|
2019-09-23 16:49:06 -04:00
|
|
|
string_compose (
|
|
|
|
_("WARNING: Your system has a limit for maximum amount of locked memory. "
|
|
|
|
"This might cause %1 to run out of memory before your system "
|
|
|
|
"runs out of memory. \n\n"
|
|
|
|
"You can view the memory limit with 'ulimit -l', "
|
|
|
|
"and it is normally controlled by %2"),
|
|
|
|
PROGRAM_NAME,
|
2020-02-11 23:02:39 -05:00
|
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
2019-09-23 16:49:06 -04:00
|
|
|
X_("/etc/login.conf")
|
|
|
|
#else
|
|
|
|
X_(" /etc/security/limits.conf")
|
|
|
|
#endif
|
|
|
|
).c_str());
|
|
|
|
|
|
|
|
msg.set_default_response (RESPONSE_OK);
|
|
|
|
|
|
|
|
VBox* vbox = msg.get_vbox();
|
|
|
|
HBox hbox;
|
|
|
|
CheckButton cb (_("Do not show this window again"));
|
|
|
|
hbox.pack_start (cb, true, false);
|
|
|
|
vbox->pack_start (hbox);
|
|
|
|
cb.show();
|
|
|
|
vbox->show();
|
|
|
|
hbox.show ();
|
|
|
|
|
|
|
|
msg.run ();
|
|
|
|
|
|
|
|
if (cb.get_active()) {
|
|
|
|
XMLNode node (X_("no-memory-warning"));
|
|
|
|
Config->add_instant_xml (node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // !__APPLE__
|
|
|
|
}
|
2020-03-01 23:35:44 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::load_from_application_api (const std::string& path)
|
|
|
|
{
|
|
|
|
/* OS X El Capitan (and probably later) now somehow passes the command
|
|
|
|
line arguments to an app via the openFile delegate protocol. Ardour
|
|
|
|
already does its own command line processing, and having both
|
|
|
|
pathways active causes crashes. So, if the command line was already
|
2020-03-05 19:34:41 -05:00
|
|
|
set, do nothing here. NSM also uses this code path.
|
2020-03-01 23:35:44 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-20 20:04:24 -04:00
|
|
|
|
2020-03-01 23:35:44 -05:00
|
|
|
/* Cancel SessionDialog if it's visible to make OSX delegates work.
|
|
|
|
*
|
|
|
|
* ARDOUR_UI::starting connects app->ShouldLoad signal and then shows a SessionDialog
|
|
|
|
* race-condition:
|
|
|
|
* - ShouldLoad does not arrive in time, ARDOUR_COMMAND_LINE::session_name is empty:
|
|
|
|
* -> startupFSM starts a SessionDialog.
|
|
|
|
* - ShouldLoad signal arrives, this function is called and sets ARDOUR_COMMAND_LINE::session_name
|
|
|
|
* -> SessionDialog is not displayed
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (startup_fsm) {
|
2020-03-05 19:34:41 -05:00
|
|
|
/* this will result in the StartupFSM signalling us to load a
|
|
|
|
* session, which if successful will then destroy the
|
|
|
|
* startupFSM and we'll move right along.
|
|
|
|
*/
|
|
|
|
|
2020-03-01 23:35:44 -05:00
|
|
|
startup_fsm->handle_path (path);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-20 20:04:24 -04:00
|
|
|
if (nsm) {
|
2021-12-02 08:34:58 -05:00
|
|
|
unload_session(false, true);
|
|
|
|
|
2024-07-30 22:44:04 -04:00
|
|
|
if (!AudioEngine::instance()->set_backend(
|
|
|
|
#if ! (defined(__APPLE__) || defined(PLATFORM_WINDOWS))
|
|
|
|
"JACK/Pipewire",
|
|
|
|
#else
|
|
|
|
"JACK",
|
|
|
|
#endif
|
|
|
|
ARDOUR_COMMAND_LINE::backend_client_name, "")) {
|
2020-05-21 10:11:39 -04:00
|
|
|
error << _("NSM: The JACK backend is mandatory and can not be loaded.") << endmsg;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-20 20:04:24 -04:00
|
|
|
if (!AudioEngine::instance()->running()) {
|
2020-05-21 10:11:39 -04:00
|
|
|
/* this auto-starts jackd with recent settings
|
|
|
|
* TODO: if Glib::file_test (path, Glib::FILE_TEST_IS_DIR)
|
|
|
|
* query sample-rate of the session and use it.
|
|
|
|
*/
|
|
|
|
if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
|
|
|
|
float sr;
|
|
|
|
SampleFormat sf;
|
|
|
|
string pv;
|
|
|
|
if (0 == Session::get_info_from_path (Glib::build_filename (path, basename_nosuffix (path) + statefile_suffix), sr, sf, pv)) {
|
|
|
|
ARDOUR::AudioEngine::instance ()->set_sample_rate (sr);
|
|
|
|
}
|
|
|
|
}
|
2020-05-20 20:04:24 -04:00
|
|
|
if (AudioEngine::instance()->start()) {
|
2020-05-21 10:11:39 -04:00
|
|
|
error << string_compose (_("NSM: %1 cannot connect to the JACK server. Please start jackd first."), PROGRAM_NAME) << endmsg;
|
2020-05-20 20:04:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-02 08:34:58 -05:00
|
|
|
if (!nsm_first_session_opened) {
|
|
|
|
PluginScanDialog psd (true, false);
|
|
|
|
psd.start ();
|
2020-05-20 20:04:24 -04:00
|
|
|
|
2021-12-02 08:34:58 -05:00
|
|
|
post_engine ();
|
|
|
|
nsm_first_session_opened = true;
|
|
|
|
}
|
2020-05-20 20:04:24 -04:00
|
|
|
}
|
|
|
|
|
2020-03-05 19:34:41 -05:00
|
|
|
/* the mechanisms that can result is this being called are only
|
|
|
|
* possible for existing sessions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
|
2020-05-20 20:04:24 -04:00
|
|
|
if (nsm) {
|
|
|
|
BusProfile bus_profile;
|
|
|
|
bus_profile.master_out_channels = 2;
|
2023-09-14 13:36:10 -04:00
|
|
|
build_session (path, basename_nosuffix (path), "", bus_profile, true, false, AudioTime);
|
2020-05-20 20:04:24 -04:00
|
|
|
}
|
2020-03-05 19:34:41 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-01 23:35:44 -05:00
|
|
|
ARDOUR_COMMAND_LINE::session_name = path;
|
|
|
|
|
|
|
|
int rv;
|
|
|
|
|
|
|
|
if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
|
|
|
|
/* /path/to/foo => /path/to/foo, foo */
|
|
|
|
rv = load_session (path, basename_nosuffix (path));
|
|
|
|
} else {
|
|
|
|
/* /path/to/foo/foo.ardour => /path/to/foo, foo */
|
|
|
|
rv = load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
|
|
|
|
}
|
|
|
|
|
2020-03-05 19:34:41 -05:00
|
|
|
// there was no startupFSM, load_session fails, and there is no existing session ....
|
2020-03-01 23:35:44 -05:00
|
|
|
|
|
|
|
if (rv && !_session) {
|
|
|
|
|
|
|
|
ARDOUR_COMMAND_LINE::session_name = string();
|
|
|
|
|
|
|
|
/* do this again */
|
|
|
|
|
|
|
|
EngineControl* amd;
|
|
|
|
|
|
|
|
try {
|
|
|
|
amd = dynamic_cast<EngineControl*> (audio_midi_setup.get (true));
|
|
|
|
} catch (...) {
|
|
|
|
std::cerr << "audio-midi engine setup failed."<< std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
startup_fsm = new StartupFSM (*amd);
|
|
|
|
startup_fsm->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::sfsm_response));
|
|
|
|
|
|
|
|
/* Note: entire startup process could happen in this one call
|
|
|
|
* if:
|
|
|
|
*
|
|
|
|
* 1) not a new user
|
|
|
|
* 2) session name provided on command line (and valid)
|
|
|
|
* 3) no audio/MIDI setup required
|
|
|
|
*/
|
|
|
|
|
2021-06-23 06:52:16 -04:00
|
|
|
Splash::instance()->exists(); // create splash
|
2020-03-01 23:35:44 -05:00
|
|
|
startup_fsm->start ();
|
|
|
|
}
|
|
|
|
}
|