#include <pbd/error.h>
#include <pbd/compose.h>
#include <pbd/error.h>
#include <pbd/compose.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
#include <pbd/enumwriter.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
#include <pbd/enumwriter.h>
have_disk_speed_dialog_displayed = false;
_will_create_new_session_automatically = false;
session_loaded = false;
have_disk_speed_dialog_displayed = false;
_will_create_new_session_automatically = false;
session_loaded = false;
last_speed_displayed = -1.0f;
keybindings_path = ARDOUR::find_config_file ("ardour.bindings");
last_speed_displayed = -1.0f;
keybindings_path = ARDOUR::find_config_file ("ardour.bindings");
{
string session_name;
string session_path;
{
string session_name;
string session_path;
+ string template_name;
+
+ if (!loading_dialog) {
+ loading_dialog = new MessageDialog (*new_session_dialog,
+ _("Starting audio engine"),
+ false,
+ Gtk::MESSAGE_INFO,
+ Gtk::BUTTONS_NONE);
+ }
+
int response = Gtk::RESPONSE_NONE;
new_session_dialog->set_modal(true);
int response = Gtk::RESPONSE_NONE;
new_session_dialog->set_modal(true);
+ loading_dialog->show_all ();
+ flush_pending ();
+
create_engine ();
/* now handle possible affirmative responses */
create_engine ();
/* now handle possible affirmative responses */
/* OK == OPEN button */
session_name = new_session_dialog->session_name();
/* OK == OPEN button */
session_name = new_session_dialog->session_name();
-
- if (new_session_dialog->get_current_page() == 1) {
-
- if (session_name.empty()) {
- response = Gtk::RESPONSE_NONE;
- continue;
- }
+
+ if (session_name.empty()) {
+ response = Gtk::RESPONSE_NONE;
+ continue;
+ }
+ switch (new_session_dialog->get_current_page()) {
+ case 1: /* recent session selector */
+ case 2: /* audio engine control */
+
if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
session_path = new_session_dialog->session_folder();
load_session (session_path, session_name);
}
session_path = new_session_dialog->session_folder();
load_session (session_path, session_name);
}
- if (session_name.empty()) {
- response = Gtk::RESPONSE_NONE;
- continue;
- }
+ case 0: /* nominally the "new" session creator, but could be in use for an old session */
if (new_session_dialog->get_current_page() == 0 && ARDOUR_COMMAND_LINE::session_name.empty()) {
should_be_new = true;
if (new_session_dialog->get_current_page() == 0 && ARDOUR_COMMAND_LINE::session_name.empty()) {
should_be_new = true;
session_path = Glib::build_filename (session_path, session_name);
session_path = Glib::build_filename (session_path, session_name);
- if (should_be_new && Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+ if (!should_be_new) {
+
+ load_session (session_path, session_name);
+ continue; /* leaves while() loop because response != NONE */
+
+ } else if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
Glib::ustring str = string_compose (_("This session\n%1\nalready exists. Do you want to open it?"), session_path);
Glib::ustring str = string_compose (_("This session\n%1\nalready exists. Do you want to open it?"), session_path);
switch (msg.run()) {
case RESPONSE_YES:
switch (msg.run()) {
case RESPONSE_YES:
+ new_session_dialog->hide ();
+ goto_editor_window ();
+ flush_pending ();
load_session (session_path, session_name);
goto done;
break;
load_session (session_path, session_name);
goto done;
break;
new_session_dialog->reset ();
continue;
}
new_session_dialog->reset ();
continue;
}
-
- std::string template_name = new_session_dialog->session_template_name();
if (new_session_dialog->use_session_template()) {
if (new_session_dialog->use_session_template()) {
+
+ template_name = new_session_dialog->session_template_name();
+
+ new_session_dialog->hide ();
+ goto_editor_window ();
+ flush_pending ();
+
load_session (session_path, session_name, &template_name);
} else {
load_session (session_path, session_name, &template_name);
} else {
nphysout = (uint32_t) new_session_dialog->output_limit_count();
}
nphysout = (uint32_t) new_session_dialog->output_limit_count();
}
+ new_session_dialog->hide ();
+ goto_editor_window ();
+ flush_pending ();
+
if (build_session (session_path,
session_name,
cchns,
if (build_session (session_path,
session_name,
cchns,
+ break;
+
+ default:
+ break;
- new_session_dialog->get_window()->set_cursor();
+ loading_dialog->hide ();
new_session_dialog->hide();
return true;
}
void
new_session_dialog->hide();
return true;
}
void
-ARDOUR_UI::close_session()
+ARDOUR_UI::close_session ()
{
if (!check_audioengine()) {
return;
}
{
if (!check_audioengine()) {
return;
}
+ unload_session (true);
+
get_session_parameters ("", true, false);
}
get_session_parameters ("", true, false);
}
ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template)
{
Session *new_session;
ARDOUR_UI::load_session (const string & path, const string & snap_name, string* mix_template)
{
Session *new_session;
+ int unload_status;
+ int retval = -1;
+
if (!check_audioengine()) {
return -1;
}
if (!check_audioengine()) {
return -1;
}
+ unload_status = unload_session ();
- if (x < 0) {
- return -1;
- } else if (x > 0) {
- return 0;
+ if (unload_status < 0) {
+ goto out;
+ } else if (unload_status > 0) {
+ retval = 0;
+ goto out;
}
/* if it already exists, we must have write access */
}
/* if it already exists, we must have write access */
MessageDialog msg (*editor, _("You do not have write access to this session.\n"
"This prevents the session from being loaded."));
msg.run ();
MessageDialog msg (*editor, _("You do not have write access to this session.\n"
"This prevents the session from being loaded."));
msg.run ();
+ goto out;
+ }
+
+ if (loading_dialog) {
+ loading_dialog->set_markup (_("Please wait while Ardour loads your session"));
+ flush_pending ();
+ disable_screen_updates ();
+
try {
new_session = new Session (*engine, path, snap_name, mix_template);
}
catch (...) {
try {
new_session = new Session (*engine, path, snap_name, mix_template);
}
catch (...) {
error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
}
connect_to_session (new_session);
}
connect_to_session (new_session);
}
editor->edit_cursor_position (true);
}
editor->edit_cursor_position (true);
+ enable_screen_updates ();
+ flush_pending ();
+ retval = 0;
+
+ out:
+ return retval;
bool get_session_parameters (Glib::ustring path, bool have_engine = false, bool should_be_new = false);
gint cmdline_new_session (string path);
bool get_session_parameters (Glib::ustring path, bool have_engine = false, bool should_be_new = false);
gint cmdline_new_session (string path);
+ int unload_session (bool hide_stuff = false);
void close_session();
int save_state_canfail (string state_name = "");
void close_session();
int save_state_canfail (string state_name = "");
Glib::RefPtr<Gtk::TextBuffer::Tag> ptag, Glib::RefPtr<Gtk::TextBuffer::Tag> mtag, const char *msg);
Gtk::Label status_bar_label;
Gtk::ToggleButton error_log_button;
Glib::RefPtr<Gtk::TextBuffer::Tag> ptag, Glib::RefPtr<Gtk::TextBuffer::Tag> mtag, const char *msg);
Gtk::Label status_bar_label;
Gtk::ToggleButton error_log_button;
+ Gtk::MessageDialog* loading_dialog;
};
#endif /* __ardour_gui_h__ */
};
#endif /* __ardour_gui_h__ */
-ARDOUR_UI::unload_session ()
+ARDOUR_UI::unload_session (bool hide_stuff)
{
if (session && session->dirty()) {
switch (ask_about_saving_session (_("close"))) {
{
if (session && session->dirty()) {
switch (ask_about_saving_session (_("close"))) {
+
+ if (hide_stuff) {
+ editor->hide ();
+ mixer->hide ();
+ }
+
second_connection.disconnect ();
point_one_second_connection.disconnect ();
point_oh_five_second_connection.disconnect ();
second_connection.disconnect ();
point_one_second_connection.disconnect ();
point_oh_five_second_connection.disconnect ();
case RESPONSE_OK:
sfbrowser->hide ();
break;
case RESPONSE_OK:
sfbrowser->hide ();
break;
default:
// cancel from the browser - we are done
sfbrowser->hide ();
default:
// cancel from the browser - we are done
sfbrowser->hide ();
void
SoundFileBrowser::found_list_view_selected ()
{
void
SoundFileBrowser::found_list_view_selected ()
{
- cerr << "file selected\n";
-
if (!reset_options ()) {
set_response_sensitive (RESPONSE_OK, false);
} else {
if (!reset_options ()) {
set_response_sensitive (RESPONSE_OK, false);
} else {
- cerr << "got " << paths.size() << " paths at depth = " << reset_depth << endl;
-
if (paths.empty()) {
channel_combo.set_sensitive (false);
if (paths.empty()) {
channel_combo.set_sensitive (false);
- cerr << "file selection changed\n";
-
if (!reset_options ()) {
set_response_sensitive (RESPONSE_OK, false);
} else {
if (!reset_options ()) {
set_response_sensitive (RESPONSE_OK, false);
} else {
/*
* carbon event handler
*/
/*
* carbon event handler
*/
+static int eventcnt = 0;
static OSStatus
menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
static OSStatus
menu_event_handler_func (EventHandlerCallRef event_handler_call_ref,
Auditioner::audition_region (boost::shared_ptr<Region> region)
{
if (g_atomic_int_get (&_active)) {
Auditioner::audition_region (boost::shared_ptr<Region> region)
{
if (g_atomic_int_get (&_active)) {
- cerr << "re-audition while still active!\n";
/* don't go via session for this, because we are going
to remain active.
*/
/* don't go via session for this, because we are going
to remain active.
*/
}
need_butler = _diskstream->commit (this_nframes);
}
need_butler = _diskstream->commit (this_nframes);
current_frame += this_nframes;
if (current_frame >= length) {
current_frame += this_nframes;
if (current_frame >= length) {
mountpoint.cc
path.cc
pathscanner.cc
mountpoint.cc
path.cc
pathscanner.cc
--- /dev/null
+#include <pbd/misc.h>
+
+#ifdef GTKOSX
+#include <AppKit/AppKit.h>
+#endif
+
+void
+disable_screen_updates ()
+{
+#ifdef GTKOSX
+ NSDisableScreenUpdates ();
+#endif
+}
+
+void
+enable_screen_updates ()
+{
+#ifdef GTKOSX
+ NSEnableScreenUpdates();
+#endif
+}
return best;
}
#endif // HAVE_GETMNTENT
return best;
}
#endif // HAVE_GETMNTENT
--- /dev/null
+#ifndef __pbd_misc_h__
+#define __pbd_misc_h__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void disable_screen_updates ();
+ void enable_screen_updates ();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __pbd_misc_h__ */