/[svn]/libgig/trunk/src/tools/wav2gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/tools/wav2gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3990 by schoenebeck, Mon Aug 30 20:14:15 2021 UTC revision 3991 by schoenebeck, Tue Aug 31 15:58:57 2021 UTC
# Line 90  static void printUsage() { Line 90  static void printUsage() {
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;
# Line 435  static gig::Sample* createSample(gig::Fi Line 439  static gig::Sample* createSample(gig::Fi
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 = "^([^-]+) - [^-]+ - [^-]+ - [^-]+ - [^.]+",
# Line 466  int main(int argc, char *argv[]) { Line 471  int main(int argc, char *argv[]) {
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;
# Line 549  int main(int argc, char *argv[]) { Line 556  int main(int argc, char *argv[]) {
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;
# Line 578  int main(int argc, char *argv[]) { Line 585  int main(int argc, char *argv[]) {
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;

Legend:
Removed from v.3990  
changed lines
  Added in v.3991

  ViewVC Help
Powered by ViewVC