/[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

libgig/trunk/src/gigdump.cpp revision 916 by schoenebeck, Thu Aug 10 21:27:50 2006 UTC libgig/trunk/src/tools/gigdump.cpp revision 2573 by schoenebeck, Thu May 22 15:17:09 2014 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-2006 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2014 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  *
12   *   the Free Software Foundation; either version 2 of the License, or     *   *   the Free Software Foundation; either version 2 of the License, or     *
# Line 29  Line 31 
31  #include <cstdlib>  #include <cstdlib>
32  #include <string>  #include <string>
33    
34  #include "gig.h"  #include "../gig.h"
35    
36  using namespace std;  using namespace std;
37    
38  string Revision();  string Revision();
39  void PrintVersion();  void PrintVersion();
40  void PrintFileInformations(gig::File* gig);  void PrintFileInformations(gig::File* gig);
41    void PrintGroups(gig::File* gig);
42  void PrintSamples(gig::File* gig);  void PrintSamples(gig::File* gig);
43  void PrintInstruments(gig::File* gig);  void PrintInstruments(gig::File* gig);
44  void PrintRegions(gig::Instrument* instr);  void PrintRegions(gig::Instrument* instr);
# Line 66  int main(int argc, char *argv[]) Line 69  int main(int argc, char *argv[])
69          gig::File*  gig  = new gig::File(riff);          gig::File*  gig  = new gig::File(riff);
70          PrintFileInformations(gig);          PrintFileInformations(gig);
71          cout << endl;          cout << endl;
72            PrintGroups(gig);
73            cout << endl;
74          PrintSamples(gig);          PrintSamples(gig);
75          cout << endl;          cout << endl;
76          PrintInstruments(gig);          PrintInstruments(gig);
# Line 88  void PrintFileInformations(gig::File* gi Line 93  void PrintFileInformations(gig::File* gi
93      cout << "Global File Informations:" << endl;      cout << "Global File Informations:" << endl;
94      cout << "    Total instruments: " << gig->Instruments << endl;      cout << "    Total instruments: " << gig->Instruments << endl;
95      if (gig->pVersion) {      if (gig->pVersion) {
96         cout << "    Version: " << gig->pVersion->major   << "."         cout << "    Version: " << gig->pVersion->major   << "."
97                             << gig->pVersion->minor   << "."                             << gig->pVersion->minor   << "."
98                             << gig->pVersion->release << "."                             << gig->pVersion->release << "."
99                             << gig->pVersion->build   << endl;                             << gig->pVersion->build   << endl;
100      }      }
101      if (gig->pInfo) {      if (gig->pInfo) {
102          if (gig->pInfo->Name.size())          if (gig->pInfo->Name.size())
# Line 129  void PrintFileInformations(gig::File* gi Line 134  void PrintFileInformations(gig::File* gi
134      }      }
135  }  }
136    
137    void PrintGroups(gig::File* gig) {
138        int groups = 0;
139        cout << "ALL defined Groups:" << endl;
140        for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup()) {
141            groups++;
142            string name = pGroup->Name;
143            if (name == "") name = "<NO NAME>";
144            else            name = '\"' + name + '\"';
145            cout << "    Group " << groups << ")" << endl;
146            cout << "        Name: " << name << endl;
147        }
148    }
149    
150  void PrintSamples(gig::File* gig) {  void PrintSamples(gig::File* gig) {
151      int samples = 0;      int samples = 0;
152      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;
153      gig::Sample* pSample = gig->GetFirstSample();      gig::Sample* pSample = gig->GetFirstSample();
154      while (pSample) {      while (pSample) {
155          samples++;          samples++;
156            // determine sample's name
157          string name = pSample->pInfo->Name;          string name = pSample->pInfo->Name;
158          if (name == "") name = "<NO NAME>";          if (name == "") name = "<NO NAME>";
159          else            name = '\"' + name + '\"';          else            name = '\"' + name + '\"';
160            // determine group this sample belongs to
161            int iGroup = 1;
162            for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup(), iGroup++) {
163                if (pGroup == pSample->GetGroup()) break;
164            }
165            // print sample info
166          cout << "    Sample " << samples << ") " << name << ", ";          cout << "    Sample " << samples << ") " << name << ", ";
167            cout << "Group " << iGroup << ", ";
168          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";
169          if (pSample->Loops) {          if (pSample->Loops) {
170              cout << " (Type: ";              cout << " (Type: ";
# Line 226  void PrintRegions(gig::Instrument* instr Line 252  void PrintRegions(gig::Instrument* instr
252                  case gig::dimension_random: // Different samples triggered each time a note is played, random order                  case gig::dimension_random: // Different samples triggered each time a note is played, random order
253                      cout << "RANDOM";                      cout << "RANDOM";
254                      break;                      break;
255                    case gig::dimension_smartmidi: // For MIDI tools like legato and repetition mode
256                        cout << "SMARTMIDI";
257                        break;
258                    case gig::dimension_roundrobinkeyboard: // Different samples triggered each time a note is played, any key advances the counter
259                        cout << "ROUNDROBINKEYBOARD";
260                        break;
261                  case gig::dimension_modwheel: // Modulation Wheel (MIDI Controller 1)                  case gig::dimension_modwheel: // Modulation Wheel (MIDI Controller 1)
262                      cout << "MODWHEEL";                      cout << "MODWHEEL";
263                      break;                      break;
# Line 369  void PrintDimensionRegions(gig::Region* Line 401  void PrintDimensionRegions(gig::Region*
401  }  }
402    
403  string Revision() {  string Revision() {
404      string s = "$Revision: 1.19 $";      string s = "$Revision$";
405      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
406  }  }
407    

Legend:
Removed from v.916  
changed lines
  Added in v.2573

  ViewVC Help
Powered by ViewVC