/[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 808 by schoenebeck, Tue Nov 22 09:11:17 2005 UTC revision 931 by schoenebeck, Sun Oct 29 17:58:14 2006 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-2005 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2006 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  *
# Line 35  using namespace std; Line 35  using namespace std;
35    
36  string Revision();  string Revision();
37  void PrintVersion();  void PrintVersion();
38    void PrintFileInformations(gig::File* gig);
39    void PrintGroups(gig::File* gig);
40  void PrintSamples(gig::File* gig);  void PrintSamples(gig::File* gig);
41  void PrintInstruments(gig::File* gig);  void PrintInstruments(gig::File* gig);
42  void PrintRegions(gig::Instrument* instr);  void PrintRegions(gig::Instrument* instr);
# Line 63  int main(int argc, char *argv[]) Line 65  int main(int argc, char *argv[])
65      try {      try {
66          RIFF::File* riff = new RIFF::File(argv[1]);          RIFF::File* riff = new RIFF::File(argv[1]);
67          gig::File*  gig  = new gig::File(riff);          gig::File*  gig  = new gig::File(riff);
68            PrintFileInformations(gig);
69            cout << endl;
70            PrintGroups(gig);
71            cout << endl;
72          PrintSamples(gig);          PrintSamples(gig);
73          cout << endl;          cout << endl;
74          PrintInstruments(gig);          PrintInstruments(gig);
# Line 81  int main(int argc, char *argv[]) Line 87  int main(int argc, char *argv[])
87      return EXIT_SUCCESS;      return EXIT_SUCCESS;
88  }  }
89    
90    void PrintFileInformations(gig::File* gig) {
91        cout << "Global File Informations:" << endl;
92        cout << "    Total instruments: " << gig->Instruments << endl;
93        if (gig->pVersion) {
94           cout << "    Version: " << gig->pVersion->major   << "."
95                               << gig->pVersion->minor   << "."
96                               << gig->pVersion->release << "."
97                               << gig->pVersion->build   << endl;
98        }
99        if (gig->pInfo) {
100            if (gig->pInfo->Name.size())
101                cout << "    Name: '" << gig->pInfo->Name << "'\n";
102            if (gig->pInfo->ArchivalLocation.size())
103                cout << "    ArchivalLocation: '" << gig->pInfo->ArchivalLocation << "'\n";
104            if (gig->pInfo->CreationDate.size())
105                cout << "    CreationDate: '" << gig->pInfo->CreationDate << "'\n";
106            if (gig->pInfo->Comments.size())
107                cout << "    Comments: '" << gig->pInfo->Comments << "'\n";
108            if (gig->pInfo->Product.size())
109                cout << "    Product: '" << gig->pInfo->Product << "'\n";
110            if (gig->pInfo->Copyright.size())
111                cout << "    Copyright: '" << gig->pInfo->Copyright << "'\n";
112            if (gig->pInfo->Artists.size())
113                cout << "    Artists: '" << gig->pInfo->Artists << "'\n";
114            if (gig->pInfo->Genre.size())
115                cout << "    Genre: '" << gig->pInfo->Genre << "'\n";
116            if (gig->pInfo->Keywords.size())
117                cout << "    Keywords: '" << gig->pInfo->Keywords << "'\n";
118            if (gig->pInfo->Engineer.size())
119                cout << "    Engineer: '" << gig->pInfo->Engineer << "'\n";
120            if (gig->pInfo->Technician.size())
121                cout << "    Technician: '" << gig->pInfo->Technician << "'\n";
122            if (gig->pInfo->Software.size())
123                cout << "    Software: '" << gig->pInfo->Software << "'\n";
124            if (gig->pInfo->Medium.size())
125                cout << "    Medium: '" << gig->pInfo->Medium << "'\n";
126            if (gig->pInfo->Source.size())
127                cout << "    Source: '" << gig->pInfo->Source << "'\n";
128            if (gig->pInfo->SourceForm.size())
129                cout << "    SourceForm: '" << gig->pInfo->SourceForm << "'\n";
130            if (gig->pInfo->Commissioned.size())
131                cout << "    Commissioned: '" << gig->pInfo->Commissioned << "'\n";
132        }
133    }
134    
135    void PrintGroups(gig::File* gig) {
136        int groups = 0;
137        cout << "ALL defined Groups:" << endl;
138        for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup()) {
139            groups++;
140            string name = pGroup->Name;
141            if (name == "") name = "<NO NAME>";
142            else            name = '\"' + name + '\"';
143            cout << "    Group " << groups << ")" << endl;
144            cout << "        Name: " << name << endl;
145        }
146    }
147    
148  void PrintSamples(gig::File* gig) {  void PrintSamples(gig::File* gig) {
149      int samples = 0;      int samples = 0;
150      cout << "ALL Available Samples (as there might be more than referenced by Instruments):" << endl;      cout << "ALL Available Samples (as there might be more than referenced by Instruments):" << endl;
151      gig::Sample* pSample = gig->GetFirstSample();      gig::Sample* pSample = gig->GetFirstSample();
152      while (pSample) {      while (pSample) {
153          samples++;          samples++;
154            // determine sample's name
155          string name = pSample->pInfo->Name;          string name = pSample->pInfo->Name;
156          if (name == "") name = "<NO NAME>";          if (name == "") name = "<NO NAME>";
157          else            name = '\"' + name + '\"';          else            name = '\"' + name + '\"';
158            // determine group this sample belongs to
159            int iGroup = 1;
160            for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup(), iGroup++) {
161                if (pGroup == pSample->GetGroup()) break;
162            }
163            // print sample info
164          cout << "    Sample " << samples << ") " << name << ", ";          cout << "    Sample " << samples << ") " << name << ", ";
165            cout << "Group " << iGroup << ", ";
166          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";
167          if (pSample->Loops) {          if (pSample->Loops) {
168              cout << " (Type: ";              cout << " (Type: ";
# Line 257  void PrintRegions(gig::Instrument* instr Line 329  void PrintRegions(gig::Instrument* instr
329                  case gig::split_type_normal:                  case gig::split_type_normal:
330                      cout << "NORMAL" << endl;                      cout << "NORMAL" << endl;
331                      break;                      break;
                 case gig::split_type_customvelocity:  
                     cout << "CUSTOMVELOCITY" << endl;  
                     break;  
332                  case gig::split_type_bit:                  case gig::split_type_bit:
333                      cout << "BIT" << endl;                      cout << "BIT" << endl;
334                      break;                      break;
# Line 324  void PrintDimensionRegions(gig::Region* Line 393  void PrintDimensionRegions(gig::Region*
393  }  }
394    
395  string Revision() {  string Revision() {
396      string s = "$Revision: 1.17 $";      string s = "$Revision: 1.21 $";
397      return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword      return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
398  }  }
399    

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

  ViewVC Help
Powered by ViewVC