8 using namespace ARDOUR;
9 using namespace SessionUtils;
12 static void usage (int status)
14 // help2man compatible format (standard GNU help-text)
15 printf (UTILNAME " - create a new empty session from the commandline.\n\n");
16 printf ("Usage: " UTILNAME " [ OPTIONS ] <session-dir> <session/snapshot-name>\n\n");
18 -h, --help display this help and exit\n\
19 -s, --samplerate <rate> samplerate to use (default 48000)\n\
20 -V, --version print version information and exit\n\
23 This tool creates a new empty Ardour session.\n\
25 Note: the tool expects a session-name without .ardour file-name extension.\n\
28 "UTILNAME " -s 44100 /tmp/TestSession TestSession\n\
31 printf ("Report bugs to <http://tracker.ardour.org/>\n"
32 "Website: <http://ardour.org/>\n");
36 int main (int argc, char* argv[])
38 int sample_rate = 48000;
40 const char *optstring = "hs:V";
42 const struct option longopts[] = {
43 { "help", 0, 0, 'h' },
44 { "samplerate", 1, 0, 's' },
45 { "version", 0, 0, 'V' },
49 while (EOF != (c = getopt_long (argc, argv,
50 optstring, longopts, (int *) 0))) {
54 const int sr = atoi (optarg);
55 if (sr >= 8000 && sr <= 192000) {
58 fprintf(stderr, "Invalid Samplerate\n");
64 printf ("ardour-utils version %s\n\n", VERSIONSTRING);
65 printf ("Copyright (C) GPL 2017 Robin Gareus <robin@gareus.org>\n");
79 // XXX perhaps allow to infer the session-name from the dir-name
80 if (optind + 2 > argc) {
89 s = SessionUtils::create_session (argv[optind], argv[optind+1], sample_rate);
91 /* save is implicit when creating a new session */
93 SessionUtils::unload_session(s);
94 SessionUtils::cleanup();