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

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

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

revision 55 by schoenebeck, Tue Apr 27 09:06:07 2004 UTC revision 1953 by schoenebeck, Thu Jul 30 08:16:02 2009 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *   *   Copyright (C) 2003-2009 by Christian Schoenebeck                      *
6   *                               <cuse@users.sourceforge.net>              *   *                              <cuse@users.sourceforge.net>               *
7     *                                                                         *
8     *   This program is part of libgig.                                       *
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   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 29 
29    
30  #include <iostream>  #include <iostream>
31  #include <cstdlib>  #include <cstdlib>
32    #include <string>
33    
34  #include "DLS.h"  #include "DLS.h"
35    
36  using namespace std;  using namespace std;
37    
38    string Revision();
39    void PrintVersion();
40  void PrintSamples(DLS::File* dls);  void PrintSamples(DLS::File* dls);
41  void PrintInstruments(DLS::File* dls);  void PrintInstruments(DLS::File* dls);
42  void PrintRegions(DLS::Instrument* instr);  void PrintRegions(DLS::Instrument* instr);
# Line 43  int main(int argc, char *argv[]) Line 48  int main(int argc, char *argv[])
48          PrintUsage();          PrintUsage();
49          return EXIT_FAILURE;          return EXIT_FAILURE;
50      }      }
51        if (argv[1][0] == '-') {
52            switch (argv[1][1]) {
53                case 'v':
54                    PrintVersion();
55                    return EXIT_SUCCESS;
56            }
57        }
58      FILE* hFile = fopen(argv[1], "r");      FILE* hFile = fopen(argv[1], "r");
59      if (!hFile) {      if (!hFile) {
60          cout << "Invalid file argument!" << endl;          cout << "Invalid file argument!" << endl;
# Line 52  int main(int argc, char *argv[]) Line 64  int main(int argc, char *argv[])
64      try {      try {
65          RIFF::File* riff = new RIFF::File(argv[1]);          RIFF::File* riff = new RIFF::File(argv[1]);
66          DLS::File*  dls  = new DLS::File(riff);          DLS::File*  dls  = new DLS::File(riff);
67          if (dls->pInfo->Name != "") cout << "File Name: " << dls->pInfo->Name << endl;          if (dls->pInfo->Name != "") cout << "File Name: \"" << dls->pInfo->Name << "\"\n";
68          PrintSamples(dls);          PrintSamples(dls);
69          cout << endl;          cout << endl;
70          PrintInstruments(dls);          PrintInstruments(dls);
# Line 113  void PrintRegions(DLS::Instrument* instr Line 125  void PrintRegions(DLS::Instrument* instr
125          cout << "        Region " << regions << ") ";          cout << "        Region " << regions << ") ";
126          DLS::Sample* pSample = pRegion->GetSample();          DLS::Sample* pSample = pRegion->GetSample();
127          if (pSample) {          if (pSample) {
128              cout << "Sample: " << pSample->SamplesPerSecond << "Hz, ";              cout << "Sample: ";
129                if (pSample->pInfo->Name != "") {
130                    cout << "\"" << pSample->pInfo->Name << "\", ";
131                }
132                cout << pSample->SamplesPerSecond << "Hz, ";
133          }          }
134          else {          else {
135              cout << "<NO_VALID_SAMPLE_REFERENCE> ";              cout << "<NO_VALID_SAMPLE_REFERENCE> ";
# Line 126  void PrintRegions(DLS::Instrument* instr Line 142  void PrintRegions(DLS::Instrument* instr
142      }      }
143  }  }
144    
145    string Revision() {
146        string s = "$Revision: 1.6 $";
147        return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
148    }
149    
150    void PrintVersion() {
151        cout << "dlsdump revision " << Revision() << endl;
152        cout << "using " << DLS::libraryName() << " " << DLS::libraryVersion() << endl;
153    }
154    
155  void PrintUsage() {  void PrintUsage() {
156      cout << "dlsdump - parses DLS (Downloadable Sounds) Level 1 and Level 2 files and prints out the content." << endl;      cout << "dlsdump - parses DLS (Downloadable Sounds) Level 1 and Level 2 files and prints out the content." << endl;
157      cout << endl;      cout << endl;
158      cout << "Usage: dlsdump FILE" << endl;      cout << "Usage: dlsdump [-v] FILE" << endl;
159        cout << endl;
160        cout << "   -v  Print version and exit." << endl;
161        cout << endl;
162  }  }

Legend:
Removed from v.55  
changed lines
  Added in v.1953

  ViewVC Help
Powered by ViewVC