mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Minor refinement of new session util
This commit is contained in:
parent
476952f2b6
commit
e96fd26f3f
1 changed files with 29 additions and 8 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include <glibmm.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -13,17 +15,22 @@ static void usage (int status)
|
||||||
{
|
{
|
||||||
// help2man compatible format (standard GNU help-text)
|
// help2man compatible format (standard GNU help-text)
|
||||||
printf (UTILNAME " - create a new empty session from the commandline.\n\n");
|
printf (UTILNAME " - create a new empty session from the commandline.\n\n");
|
||||||
printf ("Usage: " UTILNAME " [ OPTIONS ] <session-dir> <session/snapshot-name>\n\n");
|
printf ("Usage: " UTILNAME " [ OPTIONS ] <session-dir> [session-name]\n\n");
|
||||||
printf ("Options:\n\
|
printf ("Options:\n\
|
||||||
-h, --help display this help and exit\n\
|
-h, --help display this help and exit\n\
|
||||||
-s, --samplerate <rate> samplerate to use (default 48000)\n\
|
-s, --samplerate <rate> samplerate to use (default 48000)\n\
|
||||||
-V, --version print version information and exit\n\
|
-V, --version print version information and exit\n\
|
||||||
\n");
|
\n");
|
||||||
|
|
||||||
printf ("\n\
|
printf ("\n\
|
||||||
This tool creates a new empty Ardour session.\n\
|
This tool creates a new empty Ardour session.\n\
|
||||||
\n\
|
\n\
|
||||||
Note: the tool expects a session-name without .ardour file-name extension.\n\
|
If the session-name is unspecified, the sesion-dir-name is used.\n\
|
||||||
\n\
|
If specified, the tool expects a session-name without .ardour\n\
|
||||||
|
file-name extension.\n\
|
||||||
|
\n");
|
||||||
|
|
||||||
|
printf ("\n\
|
||||||
Examples:\n\
|
Examples:\n\
|
||||||
" UTILNAME " -s 44100 /tmp/TestSession TestSession\n\
|
" UTILNAME " -s 44100 /tmp/TestSession TestSession\n\
|
||||||
\n");
|
\n");
|
||||||
|
|
@ -76,20 +83,34 @@ int main (int argc, char* argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX perhaps allow to infer the session-name from the dir-name
|
std::string snapshot_name;
|
||||||
if (optind + 2 > argc) {
|
|
||||||
|
if (optind + 2 == argc) {
|
||||||
|
snapshot_name = argv[optind+1];
|
||||||
|
} else if (optind + 1 == argc) {
|
||||||
|
snapshot_name = Glib::path_get_basename (argv[optind]);
|
||||||
|
} else {
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (snapshot_name.empty ()) {
|
||||||
|
fprintf(stderr, "Error: Invalid empty session/snapshot name.\n");
|
||||||
|
::exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
/* all systems go */
|
/* all systems go */
|
||||||
|
|
||||||
SessionUtils::init();
|
SessionUtils::init();
|
||||||
Session* s = 0;
|
Session* s = 0;
|
||||||
|
|
||||||
s = SessionUtils::create_session (argv[optind], argv[optind+1], sample_rate);
|
s = SessionUtils::create_session (argv[optind], snapshot_name, sample_rate);
|
||||||
|
|
||||||
/* save is implicit when creating a new session */
|
/* save is implicit when creating a new session */
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
std::cout << "Created session in '" << s->path () <<"'" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
SessionUtils::unload_session (s);
|
SessionUtils::unload_session (s);
|
||||||
SessionUtils::cleanup();
|
SessionUtils::cleanup();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue