90 |
cout << endl; |
cout << endl; |
91 |
cout << " -r Recurse through all subdirs of provided input WAV dirs." << endl; |
cout << " -r Recurse through all subdirs of provided input WAV dirs." << endl; |
92 |
cout << endl; |
cout << endl; |
93 |
|
cout << " --dry-run" << endl; |
94 |
|
cout << endl; |
95 |
|
cout << " Scan input sample (.wav) files, but exit before creating any .gig file." << endl; |
96 |
|
cout << endl; |
97 |
cout << " --regex-name1 PATTERN" << endl; |
cout << " --regex-name1 PATTERN" << endl; |
98 |
cout << endl; |
cout << endl; |
99 |
cout << " Regular expression for overriding the NAME1 part of the input sample file name scheme." << endl; |
cout << " Regular expression for overriding the NAME1 part of the input sample file name scheme." << endl; |
439 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
440 |
bool bForce = false; |
bool bForce = false; |
441 |
bool bRecursive = false; |
bool bRecursive = false; |
442 |
|
bool bDryRun = false; |
443 |
FilenameRegExPatterns patterns = { |
FilenameRegExPatterns patterns = { |
444 |
// name 1 (e.g. "BSTEIN18") |
// name 1 (e.g. "BSTEIN18") |
445 |
.name1 = "^([^-]+) - [^-]+ - [^-]+ - [^-]+ - [^.]+", |
.name1 = "^([^-]+) - [^-]+ - [^-]+ - [^-]+ - [^.]+", |
471 |
bForce = true; |
bForce = true; |
472 |
} else if (opt == "-r") { |
} else if (opt == "-r") { |
473 |
bRecursive = true; |
bRecursive = true; |
474 |
|
} else if (opt == "--dry-run") { |
475 |
|
bDryRun = true; |
476 |
} else if (opt == "--regex-name1") { |
} else if (opt == "--regex-name1") { |
477 |
if (nextOpt.empty() || beginsWith(nextOpt, "-")) { |
if (nextOpt.empty() || beginsWith(nextOpt, "-")) { |
478 |
cerr << "Missing argument for option '" << opt << "'" << endl; |
cerr << "Missing argument for option '" << opt << "'" << endl; |
556 |
cout << "(" << int(wavFileNames.size()) << " found).\n"; |
cout << "(" << int(wavFileNames.size()) << " found).\n"; |
557 |
|
|
558 |
// check if output file already exists |
// check if output file already exists |
559 |
if (fileExists(outFileName)) { |
if (fileExists(outFileName) && !bDryRun) { |
560 |
if (bForce) deleteFile(outFileName); |
if (bForce) deleteFile(outFileName); |
561 |
else { |
else { |
562 |
cerr << "Output file '" << outFileName << "' already exists. Use -f to overwrite it." << endl; |
cerr << "Output file '" << outFileName << "' already exists. Use -f to overwrite it." << endl; |
585 |
} |
} |
586 |
cout << "OK\n"; |
cout << "OK\n"; |
587 |
|
|
588 |
|
if (bDryRun) |
589 |
|
return EXIT_SUCCESS; |
590 |
|
|
591 |
// create and assemble a new .gig file as output |
// create and assemble a new .gig file as output |
592 |
try { |
try { |
593 |
cout << "Creating new gig file and one new gig instrument ... " << flush; |
cout << "Creating new gig file and one new gig instrument ... " << flush; |