_will_create_new_session_automatically = false;
add_route_dialog = 0;
route_params = 0;
- option_editor = 0;
+ rc_option_editor = 0;
+ session_option_editor = 0;
location_ui = 0;
open_session_selector = 0;
have_configure_timeout = false;
}
setup_gtk_ardour_enums ();
- Config->set_current_owner (ConfigVariableBase::Interface);
setup_profile ();
GainMeter::setup_slider_pix ();
blink_timeout_tag = -1;
- /* the global configuration object is now valid */
-
- use_config ();
-
/* this being a GUI and all, we want peakfiles */
AudioFileSource::set_build_peakfiles (true);
exit (1);
}
+ use_config ();
+
goto_editor_window ();
BootMessage (_("Ardour is ready for use"));
ARDOUR_UI::update_buffer_load ()
{
char buf[64];
+ uint32_t c, p;
if (session) {
+ c = session->capture_load ();
+ p = session->playback_load ();
+
+ push_buffer_stats (c, p);
+
snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"),
session->playback_load(), session->capture_load());
buffer_load_label.set_text (buf);
switch (prompter.run()) {
case RESPONSE_ACCEPT:
+ {
prompter.get_result (snapname);
- if (snapname.length()){
+
+ bool do_save = (snapname.length() != 0);
+
+ vector<sys::path> p;
+ get_state_files_in_directory (session->session_directory().root_path(), p);
+ vector<string> n = get_file_names_no_extension (p);
+ if (find (n.begin(), n.end(), snapname) != n.end()) {
+
+ ArdourDialog confirm (_("Confirm snapshot overwrite"), true);
+ Label m (_("A snapshot already exists with that name. Do you want to overwrite it?"));
+ confirm.get_vbox()->pack_start (m, true, true);
+ confirm.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ confirm.add_button (_("Overwrite"), Gtk::RESPONSE_ACCEPT);
+ confirm.show_all ();
+ switch (confirm.run()) {
+ case RESPONSE_CANCEL:
+ do_save = false;
+ }
+ }
+
+ if (do_save) {
save_state (snapname);
}
break;
+ }
default:
break;
if (session == 0) {
return;
}
+
+ Session::RecordState const r = session->record_status ();
+ bool const h = session->have_rec_enabled_diskstream ();
- switch (session->record_status()) {
- case Session::Enabled:
+ if (r == Session::Enabled || (r == Session::Recording && !h)) {
if (onoff) {
rec_button.set_visual_state (2);
} else {
rec_button.set_visual_state (0);
}
- break;
-
- case Session::Recording:
+ } else if (r == Session::Recording && h) {
rec_button.set_visual_state (1);
- break;
-
- default:
+ } else {
rec_button.set_visual_state (0);
- break;
}
}
if (!should_be_new && !ARDOUR_COMMAND_LINE::session_name.empty()) {
- session_path = Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name);
+ /* if they named a specific statefile, use it, otherwise they are
+ just giving a session folder, and we want to use it as is
+ to find the session.
+ */
+
+ if (ARDOUR_COMMAND_LINE::session_name.find (statefile_suffix) != string::npos) {
+ session_path = Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name);
+ } else {
+ session_path = ARDOUR_COMMAND_LINE::session_name;
+ }
+
session_name = Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name);
-
+
} else {
run_startup (should_be_new);
if (likely_new) {
- ustring existing = Glib::build_filename (session_path, session_name);
+ Glib::ustring existing = Glib::build_filename (session_path, session_name);
if (!ask_about_loading_existing_session (existing)) {
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
connect_to_session (new_session);
- Config->set_current_owner (ConfigVariableBase::Interface);
-
session_loaded = true;
goto_editor_window ();
}
}
+void
+ARDOUR_UI::push_buffer_stats (uint32_t capture, uint32_t playback)
+{
+ time_t now;
+ time (&now);
+
+ while (disk_buffer_stats.size() > 60) {
+ disk_buffer_stats.pop_front ();
+ }
+
+ disk_buffer_stats.push_back (DiskBufferStat (now, capture, playback));
+}
+
+void
+ARDOUR_UI::write_buffer_stats ()
+{
+ struct tm tm;
+ char buf[64];
+ char* path;
+
+ char* tmplt = (char*)calloc(strlen("ardourXXXXXX"), sizeof(char));
+ int fd = mkstemp (tmplt);
+ if (fd) {
+ cerr << X_("cannot find temporary name for ardour buffer stats") << endl;
+ return;
+ }
+
+ FILE* fout = fdopen (fd, "w");
+ if (!fout) {
+ cerr << string_compose (X_("cannot open file %1 for ardour buffer stats"), path) << endl;
+ return;
+ }
+
+ for (list<DiskBufferStat>::iterator i = disk_buffer_stats.begin(); i != disk_buffer_stats.end(); ++i) {
+ std::ostringstream ss;
+ localtime_r (&(*i).when, &tm);
+ strftime (buf, sizeof (buf), "%T", &tm);
+ fprintf(fout, "%s %u %u\n", buf, (*i).capture, (*i).playback);
+ }
+
+ disk_buffer_stats.clear ();
+
+ fclose (fout);
+ close (fd);
+
+ cerr << "Ardour buffering statistics can be found in: " << path << endl;
+ free (path);
+ free (tmplt);
+}
+
void
ARDOUR_UI::disk_overrun_handler ()
{
ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
+ write_buffer_stats ();
+
if (!have_disk_speed_dialog_displayed) {
have_disk_speed_dialog_displayed = true;
MessageDialog* msg = new MessageDialog (*editor, _("\
{
ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
+ write_buffer_stats ();
+
if (!have_disk_speed_dialog_displayed) {
have_disk_speed_dialog_displayed = true;
MessageDialog* msg = new MessageDialog (*editor,
{
Glib::RefPtr<Action> act;
- switch (Config->get_native_file_data_format ()) {
+ assert (session);
+
+ switch (session->config.get_native_file_data_format ()) {
case FormatFloat:
act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
break;
ract->set_active ();
}
- switch (Config->get_native_file_header_format ()) {
+ switch (session->config.get_native_file_header_format ()) {
case BWF:
act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
break;
return;
}
- switch (session->record_status()) {
- case Session::Recording:
+ Session::RecordState const r = session->record_status ();
+ bool const h = session->have_rec_enabled_diskstream ();
+
+ if (r == Session::Recording && h) {
big_clock.set_widget_name ("BigClockRecording");
- break;
- default:
+ } else {
big_clock.set_widget_name ("BigClockNonRecording");
- break;
}
}