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

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

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

revision 3424 by schoenebeck, Sun Jul 23 18:38:36 2017 UTC revision 3425 by schoenebeck, Tue May 8 18:45:28 2018 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2017 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2018 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This program is part of libgig.                                       *   *   This program is part of libgig.                                       *
# Line 37  using namespace std; Line 37  using namespace std;
37    
38  string Revision();  string Revision();
39  void PrintVersion();  void PrintVersion();
40  void PrintFileInformations(gig::File* gig);  void PrintFileInformation(gig::File* gig);
41  void PrintGroups(gig::File* gig);  void PrintGroups(gig::File* gig);
42  void PrintSamples(gig::File* gig);  void PrintSamples(gig::File* gig);
43  void PrintScripts(gig::File* gig);  void PrintScripts(gig::File* gig);
44  void PrintInstruments(gig::File* gig);  void PrintInstruments(gig::File* gig);
45    void PrintInstrumentNamesOnly(gig::File* gig);
46  void PrintRegions(gig::Instrument* instr);  void PrintRegions(gig::Instrument* instr);
47  void PrintUsage();  void PrintUsage();
48  void PrintDimensionRegions(gig::Region* rgn);  void PrintDimensionRegions(gig::Region* rgn);
# Line 64  int main(int argc, char *argv[]) Line 65  int main(int argc, char *argv[])
65  {  {
66      bool bVerify = false;      bool bVerify = false;
67      bool bRebuildChecksums = false;      bool bRebuildChecksums = false;
68        bool bInstrumentNamesOnly = false;
69    
70      if (argc <= 1) {      if (argc <= 1) {
71          PrintUsage();          PrintUsage();
# Line 86  int main(int argc, char *argv[]) Line 88  int main(int argc, char *argv[])
88              bVerify = true;              bVerify = true;
89          } else if (opt == "--rebuild-checksums") {          } else if (opt == "--rebuild-checksums") {
90              bRebuildChecksums = true;              bRebuildChecksums = true;
91            } else if (opt == "--instrument-names") {
92                bInstrumentNamesOnly = true;
93          } else {          } else {
94              cerr << "Unknown option '" << opt << "'" << endl;              cerr << "Unknown option '" << opt << "'" << endl;
95              cerr << endl;              cerr << endl;
# Line 116  int main(int argc, char *argv[]) Line 120  int main(int argc, char *argv[])
120              if (OK) cout << "All checks passed successfully! :-)\n";              if (OK) cout << "All checks passed successfully! :-)\n";
121              return (OK) ? EXIT_SUCCESS : EXIT_FAILURE;              return (OK) ? EXIT_SUCCESS : EXIT_FAILURE;
122          } else {          } else {
123              PrintFileInformations(gig);              if (bInstrumentNamesOnly) {
124              cout << endl;                  PrintInstrumentNamesOnly(gig);
125              PrintGroups(gig);              } else {
126              cout << endl;                  PrintFileInformation(gig);
127              PrintSamples(gig);                  cout << endl;
128              cout << endl;                  PrintGroups(gig);
129              PrintScripts(gig);                  cout << endl;
130              cout << endl;                  PrintSamples(gig);
131              PrintInstruments(gig);                  cout << endl;
132                    PrintScripts(gig);
133                    cout << endl;
134                    PrintInstruments(gig);
135                }
136          }          }
137          delete gig;          delete gig;
138          delete riff;          delete riff;
# Line 141  int main(int argc, char *argv[]) Line 149  int main(int argc, char *argv[])
149      return EXIT_SUCCESS;      return EXIT_SUCCESS;
150  }  }
151    
152  void PrintFileInformations(gig::File* gig) {  void PrintFileInformation(gig::File* gig) {
153      cout << "Global File Information:" << endl;      cout << "Global File Information:" << endl;
154      cout << "    Total instruments: " << gig->Instruments << endl;      cout << "    Total instruments: " << gig->Instruments << endl;
155      if (gig->pVersion) {      if (gig->pVersion) {
# Line 294  void PrintInstruments(gig::File* gig) { Line 302  void PrintInstruments(gig::File* gig) {
302      }      }
303  }  }
304    
305    void PrintInstrumentNamesOnly(gig::File* gig) {
306        int instruments = 0;
307        gig::Instrument* pInstrument = gig->GetFirstInstrument();
308        for (; pInstrument; pInstrument = gig->GetNextInstrument()) {
309            instruments++;
310            string name = pInstrument->pInfo->Name;
311            if (name == "") name = "<NO NAME>";
312            else            name = '\"' + name + '\"';
313            cout << "Instrument " << instruments << ") " << name << endl;
314        }
315    }
316    
317  void PrintRegions(gig::Instrument* instr) {  void PrintRegions(gig::Instrument* instr) {
318      int iRegion = 1;      int iRegion = 1;
319      gig::Region* pRegion = instr->GetFirstRegion();      gig::Region* pRegion = instr->GetFirstRegion();
# Line 605  void PrintUsage() { Line 625  void PrintUsage() {
625      cout << endl;      cout << endl;
626      cout << "   --verify             Checks raw wave data integrity of all samples." << endl;      cout << "   --verify             Checks raw wave data integrity of all samples." << endl;
627      cout << endl;      cout << endl;
628        cout << "   --instrument-names   Print only instrument names." << endl;
629        cout << endl;
630  }  }

Legend:
Removed from v.3424  
changed lines
  Added in v.3425

  ViewVC Help
Powered by ViewVC