/[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 808 by schoenebeck, Tue Nov 22 09:11:17 2005 UTC libgig/trunk/src/tools/gigdump.cpp revision 2609 by schoenebeck, Sun Jun 8 19:00:30 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-2005 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);
41    void PrintGroups(gig::File* gig);
42  void PrintSamples(gig::File* gig);  void PrintSamples(gig::File* gig);
43    void PrintScripts(gig::File* gig);
44  void PrintInstruments(gig::File* gig);  void PrintInstruments(gig::File* gig);
45  void PrintRegions(gig::Instrument* instr);  void PrintRegions(gig::Instrument* instr);
46  void PrintUsage();  void PrintUsage();
# Line 63  int main(int argc, char *argv[]) Line 68  int main(int argc, char *argv[])
68      try {      try {
69          RIFF::File* riff = new RIFF::File(argv[1]);          RIFF::File* riff = new RIFF::File(argv[1]);
70          gig::File*  gig  = new gig::File(riff);          gig::File*  gig  = new gig::File(riff);
71            PrintFileInformations(gig);
72            cout << endl;
73            PrintGroups(gig);
74            cout << endl;
75          PrintSamples(gig);          PrintSamples(gig);
76          cout << endl;          cout << endl;
77            PrintScripts(gig);
78            cout << endl;
79          PrintInstruments(gig);          PrintInstruments(gig);
80          delete gig;          delete gig;
81          delete riff;          delete riff;
# Line 81  int main(int argc, char *argv[]) Line 92  int main(int argc, char *argv[])
92      return EXIT_SUCCESS;      return EXIT_SUCCESS;
93  }  }
94    
95    void PrintFileInformations(gig::File* gig) {
96        cout << "Global File Informations:" << endl;
97        cout << "    Total instruments: " << gig->Instruments << endl;
98        if (gig->pVersion) {
99           cout << "    Version: " << gig->pVersion->major   << "."
100                               << gig->pVersion->minor   << "."
101                               << gig->pVersion->release << "."
102                               << gig->pVersion->build   << endl;
103        }
104        if (gig->pInfo) {
105            if (gig->pInfo->Name.size())
106                cout << "    Name: '" << gig->pInfo->Name << "'\n";
107            if (gig->pInfo->ArchivalLocation.size())
108                cout << "    ArchivalLocation: '" << gig->pInfo->ArchivalLocation << "'\n";
109            if (gig->pInfo->CreationDate.size())
110                cout << "    CreationDate: '" << gig->pInfo->CreationDate << "'\n";
111            if (gig->pInfo->Comments.size())
112                cout << "    Comments: '" << gig->pInfo->Comments << "'\n";
113            if (gig->pInfo->Product.size())
114                cout << "    Product: '" << gig->pInfo->Product << "'\n";
115            if (gig->pInfo->Copyright.size())
116                cout << "    Copyright: '" << gig->pInfo->Copyright << "'\n";
117            if (gig->pInfo->Artists.size())
118                cout << "    Artists: '" << gig->pInfo->Artists << "'\n";
119            if (gig->pInfo->Genre.size())
120                cout << "    Genre: '" << gig->pInfo->Genre << "'\n";
121            if (gig->pInfo->Keywords.size())
122                cout << "    Keywords: '" << gig->pInfo->Keywords << "'\n";
123            if (gig->pInfo->Engineer.size())
124                cout << "    Engineer: '" << gig->pInfo->Engineer << "'\n";
125            if (gig->pInfo->Technician.size())
126                cout << "    Technician: '" << gig->pInfo->Technician << "'\n";
127            if (gig->pInfo->Software.size())
128                cout << "    Software: '" << gig->pInfo->Software << "'\n";
129            if (gig->pInfo->Medium.size())
130                cout << "    Medium: '" << gig->pInfo->Medium << "'\n";
131            if (gig->pInfo->Source.size())
132                cout << "    Source: '" << gig->pInfo->Source << "'\n";
133            if (gig->pInfo->SourceForm.size())
134                cout << "    SourceForm: '" << gig->pInfo->SourceForm << "'\n";
135            if (gig->pInfo->Commissioned.size())
136                cout << "    Commissioned: '" << gig->pInfo->Commissioned << "'\n";
137        }
138    }
139    
140    void PrintGroups(gig::File* gig) {
141        int groups = 0;
142        cout << "ALL defined Groups:" << endl;
143        for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup()) {
144            groups++;
145            string name = pGroup->Name;
146            if (name == "") name = "<NO NAME>";
147            else            name = '\"' + name + '\"';
148            cout << "    Group " << groups << ")" << endl;
149            cout << "        Name: " << name << endl;
150        }
151    }
152    
153  void PrintSamples(gig::File* gig) {  void PrintSamples(gig::File* gig) {
154      int samples = 0;      int samples = 0;
155      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;
156      gig::Sample* pSample = gig->GetFirstSample();      gig::Sample* pSample = gig->GetFirstSample();
157      while (pSample) {      while (pSample) {
158          samples++;          samples++;
159            // determine sample's name
160          string name = pSample->pInfo->Name;          string name = pSample->pInfo->Name;
161          if (name == "") name = "<NO NAME>";          if (name == "") name = "<NO NAME>";
162          else            name = '\"' + name + '\"';          else            name = '\"' + name + '\"';
163            // determine group this sample belongs to
164            int iGroup = 1;
165            for (gig::Group* pGroup = gig->GetFirstGroup(); pGroup; pGroup = gig->GetNextGroup(), iGroup++) {
166                if (pGroup == pSample->GetGroup()) break;
167            }
168            // print sample info
169          cout << "    Sample " << samples << ") " << name << ", ";          cout << "    Sample " << samples << ") " << name << ", ";
170            cout << "Group " << iGroup << ", ";
171          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";          cout << pSample->SamplesPerSecond << "Hz, " << pSample->Channels << " Channels, " << pSample->Loops << " Loops";
172          if (pSample->Loops) {          if (pSample->Loops) {
173              cout << " (Type: ";              cout << " (Type: ";
# Line 107  void PrintSamples(gig::File* gig) { Line 184  void PrintSamples(gig::File* gig) {
184      }      }
185  }  }
186    
187    void PrintScripts(gig::File* gig) {
188        cout << "ALL Available Real-Time Instrument Scripts (as there might be more than referenced by Instruments):" << endl;
189        for (int g = 0; gig->GetScriptGroup(g); ++g) {
190            gig::ScriptGroup* pGroup = gig->GetScriptGroup(g);
191            cout << "    Group " << g+1 << ") '" << pGroup->Name << "'\n";
192            for (int s = 0; pGroup->GetScript(s); ++s) {
193                gig::Script* pScript = pGroup->GetScript(s);
194                cout << "        Script " << s+1 << ") '" << pScript->Name << "':\n";
195                cout << "[START OF SCRIPT]\n";
196                cout << pScript->GetScriptAsText();
197                cout << "[END OF SCRIPT]\n";
198            }
199        }
200    }
201    
202  void PrintInstruments(gig::File* gig) {  void PrintInstruments(gig::File* gig) {
203      int instruments = 0;      int instruments = 0;
204      cout << "Available Instruments:" << endl;      cout << "Available Instruments:" << endl;
# Line 119  void PrintInstruments(gig::File* gig) { Line 211  void PrintInstruments(gig::File* gig) {
211          cout << "    Instrument " << instruments << ") " << name << ", ";          cout << "    Instrument " << instruments << ") " << name << ", ";
212    
213          cout << " MIDIBank=" << pInstrument->MIDIBank << ", MIDIProgram=" << pInstrument->MIDIProgram << endl;          cout << " MIDIBank=" << pInstrument->MIDIBank << ", MIDIProgram=" << pInstrument->MIDIProgram << endl;
214    
215            cout << "        ScriptSlots=" << pInstrument->ScriptSlotCount() << endl;
216            for (int s = 0; s < pInstrument->ScriptSlotCount(); ++s) {
217                gig::Script* pScript = pInstrument->GetScriptOfSlot(s);
218                string name = pScript->Name;
219                cout << "        ScriptSlot[" << s << "]='" << name << "'\n";
220            }
221    
222          PrintRegions(pInstrument);          PrintRegions(pInstrument);
223    
224          pInstrument = gig->GetNextInstrument();          pInstrument = gig->GetNextInstrument();
# Line 178  void PrintRegions(gig::Instrument* instr Line 278  void PrintRegions(gig::Instrument* instr
278                  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
279                      cout << "RANDOM";                      cout << "RANDOM";
280                      break;                      break;
281                    case gig::dimension_smartmidi: // For MIDI tools like legato and repetition mode
282                        cout << "SMARTMIDI";
283                        break;
284                    case gig::dimension_roundrobinkeyboard: // Different samples triggered each time a note is played, any key advances the counter
285                        cout << "ROUNDROBINKEYBOARD";
286                        break;
287                  case gig::dimension_modwheel: // Modulation Wheel (MIDI Controller 1)                  case gig::dimension_modwheel: // Modulation Wheel (MIDI Controller 1)
288                      cout << "MODWHEEL";                      cout << "MODWHEEL";
289                      break;                      break;
# Line 257  void PrintRegions(gig::Instrument* instr Line 363  void PrintRegions(gig::Instrument* instr
363                  case gig::split_type_normal:                  case gig::split_type_normal:
364                      cout << "NORMAL" << endl;                      cout << "NORMAL" << endl;
365                      break;                      break;
                 case gig::split_type_customvelocity:  
                     cout << "CUSTOMVELOCITY" << endl;  
                     break;  
366                  case gig::split_type_bit:                  case gig::split_type_bit:
367                      cout << "BIT" << endl;                      cout << "BIT" << endl;
368                      break;                      break;
# Line 324  void PrintDimensionRegions(gig::Region* Line 427  void PrintDimensionRegions(gig::Region*
427  }  }
428    
429  string Revision() {  string Revision() {
430      string s = "$Revision: 1.17 $";      string s = "$Revision$";
431      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
432  }  }
433    

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

  ViewVC Help
Powered by ViewVC