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

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

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

revision 439 by schoenebeck, Wed Mar 9 23:46:19 2005 UTC revision 808 by schoenebeck, Tue Nov 22 09:11:17 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *   *   Copyright (C) 2003-2005 by Christian Schoenebeck                      *
6   *                               <cuse@users.sourceforge.net>              *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 27  Line 27 
27    
28  #include <iostream>  #include <iostream>
29  #include <cstdlib>  #include <cstdlib>
30    #include <string>
31    
32  #include "gig.h"  #include "gig.h"
33    
34  using namespace std;  using namespace std;
35    
36    string Revision();
37    void PrintVersion();
38  void PrintSamples(gig::File* gig);  void PrintSamples(gig::File* gig);
39  void PrintInstruments(gig::File* gig);  void PrintInstruments(gig::File* gig);
40  void PrintRegions(gig::Instrument* instr);  void PrintRegions(gig::Instrument* instr);
# Line 44  int main(int argc, char *argv[]) Line 47  int main(int argc, char *argv[])
47          PrintUsage();          PrintUsage();
48          return EXIT_FAILURE;          return EXIT_FAILURE;
49      }      }
50        if (argv[1][0] == '-') {
51            switch (argv[1][1]) {
52                case 'v':
53                    PrintVersion();
54                    return EXIT_SUCCESS;
55            }
56        }
57      FILE* hFile = fopen(argv[1], "r");      FILE* hFile = fopen(argv[1], "r");
58      if (!hFile) {      if (!hFile) {
59          cout << "Invalid file argument!" << endl;          cout << "Invalid file argument!" << endl;
# Line 90  void PrintSamples(gig::File* gig) { Line 100  void PrintSamples(gig::File* gig) {
100                  case gig::loop_type_backward:       cout << "reverse)";  break;                  case gig::loop_type_backward:       cout << "reverse)";  break;
101              }              }
102              cout << ", LoopFraction=" << pSample->LoopFraction << ", Start=" << pSample->LoopStart << ", End=" << pSample->LoopEnd;              cout << ", LoopFraction=" << pSample->LoopFraction << ", Start=" << pSample->LoopStart << ", End=" << pSample->LoopEnd;
103                cout << ", LoopPlayCount=" << pSample->LoopPlayCount;
104          }          }
105          cout << ", Length=" << pSample->SamplesTotal << " Compressed=" << ((pSample->Compressed) ? "true" : "false") << endl;          cout << ", Length=" << pSample->SamplesTotal << " Compressed=" << ((pSample->Compressed) ? "true" : "false") << endl;
106          pSample = gig->GetNextSample();          pSample = gig->GetNextSample();
# Line 266  void PrintRegions(gig::Instrument* instr Line 277  void PrintRegions(gig::Instrument* instr
277  void PrintDimensionRegions(gig::Region* rgn) {  void PrintDimensionRegions(gig::Region* rgn) {
278      int dimensionRegions = 0;      int dimensionRegions = 0;
279      gig::DimensionRegion* pDimensionRegion;      gig::DimensionRegion* pDimensionRegion;
280      while (dimensionRegions < 32) {      while (dimensionRegions < rgn->DimensionRegions) {
281          pDimensionRegion = rgn->pDimensionRegions[dimensionRegions];          pDimensionRegion = rgn->pDimensionRegions[dimensionRegions];
282          if (!pDimensionRegion) break;          if (!pDimensionRegion) break;
283    
# Line 312  void PrintDimensionRegions(gig::Region* Line 323  void PrintDimensionRegions(gig::Region*
323      }      }
324  }  }
325    
326    string Revision() {
327        string s = "$Revision: 1.17 $";
328        return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
329    }
330    
331    void PrintVersion() {
332        cout << "gigdump revision " << Revision() << endl;
333        cout << "using " << gig::libraryName() << " " << gig::libraryVersion() << endl;
334    }
335    
336  void PrintUsage() {  void PrintUsage() {
337      cout << "gigdump - parses Gigasampler files and prints out the content." << endl;      cout << "gigdump - parses Gigasampler files and prints out the content." << endl;
338      cout << endl;      cout << endl;
339      cout << "Usage: gigdump FILE" << endl;      cout << "Usage: gigdump [-v] FILE" << endl;
340        cout << endl;
341        cout << "   -v  Print version and exit." << endl;
342        cout << endl;
343  }  }

Legend:
Removed from v.439  
changed lines
  Added in v.808

  ViewVC Help
Powered by ViewVC