From f27c481af1181475945de5c93fbd5330e614eee0 Mon Sep 17 00:00:00 2001 From: Torben Hohn Date: Wed, 2 Jun 2010 14:36:31 +0000 Subject: [PATCH] add template support to jack-session code. and also generate timestamped name git-svn-id: svn://localhost/ardour2/branches/3.0@7209 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session_state.cc | 52 ++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a78bfbfdd1..9ac0cfb329 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -684,20 +684,44 @@ Session::remove_state (string snapshot_name) void Session::jack_session_event (jack_session_event_t * event) { - if (save_state ("jacksession_snap")) { - event->flags = JackSessionSaveError; - } else { - sys::path xml_path (_session_dir->root_path()); - xml_path /= legalize_for_path ("jacksession_snap") + statefile_suffix; - - string cmd ("PROG_NAME -U "); - cmd += event->client_uuid; - cmd += " \""; - cmd += xml_path.to_string(); - cmd += '\"'; - - event->command_line = strdup (cmd.c_str()); - } + char timebuf[128]; + time_t n; + struct tm local_time; + + time (&n); + localtime_r (&n, &local_time); + strftime (timebuf, sizeof(timebuf), "JS_%FT%T", &local_time); + + if (event->type == JackSessionSaveTemplate) + { + if (save_template( timebuf )) { + event->flags = JackSessionSaveError; + } else { + string cmd ("ardour3 -U "); + cmd += event->client_uuid; + cmd += " -T "; + cmd += timebuf; + + event->command_line = strdup (cmd.c_str()); + } + } + else + { + if (save_state (timebuf)) { + event->flags = JackSessionSaveError; + } else { + sys::path xml_path (_session_dir->root_path()); + xml_path /= legalize_for_path (timebuf) + statefile_suffix; + + string cmd ("ardour3 -U "); + cmd += event->client_uuid; + cmd += " \""; + cmd += xml_path.to_string(); + cmd += '\"'; + + event->command_line = strdup (cmd.c_str()); + } + } jack_session_reply (_engine.jack(), event);