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 * |
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 |
|
|
40 |
void PrintFileInformations(gig::File* gig); |
void PrintFileInformations(gig::File* gig); |
41 |
void PrintGroups(gig::File* gig); |
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(); |
74 |
cout << endl; |
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; |
96 |
cout << "Global File Informations:" << endl; |
cout << "Global File Informations:" << endl; |
97 |
cout << " Total instruments: " << gig->Instruments << endl; |
cout << " Total instruments: " << gig->Instruments << endl; |
98 |
if (gig->pVersion) { |
if (gig->pVersion) { |
99 |
cout << " Version: " << gig->pVersion->major << "." |
cout << " Version: " << gig->pVersion->major << "." |
100 |
<< gig->pVersion->minor << "." |
<< gig->pVersion->minor << "." |
101 |
<< gig->pVersion->release << "." |
<< gig->pVersion->release << "." |
102 |
<< gig->pVersion->build << endl; |
<< gig->pVersion->build << endl; |
103 |
} |
} |
104 |
if (gig->pInfo) { |
if (gig->pInfo) { |
105 |
if (gig->pInfo->Name.size()) |
if (gig->pInfo->Name.size()) |
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; |
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(); |
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; |
377 |
} |
} |
378 |
} |
} |
379 |
|
|
380 |
|
template<typename T_int> |
381 |
|
static void printIntArray(T_int* array, int size) { |
382 |
|
printf("{"); |
383 |
|
for (int i = 0; i < size; ++i) |
384 |
|
printf("[%d]=%d,", i, array[i]); |
385 |
|
printf("}"); |
386 |
|
fflush(stdout); |
387 |
|
} |
388 |
|
|
389 |
void PrintDimensionRegions(gig::Region* rgn) { |
void PrintDimensionRegions(gig::Region* rgn) { |
390 |
int dimensionRegions = 0; |
int dimensionRegions = 0; |
391 |
gig::DimensionRegion* pDimensionRegion; |
gig::DimensionRegion* pDimensionRegion; |
429 |
cout << "UNKNOWN - please report this !"; |
cout << "UNKNOWN - please report this !"; |
430 |
} |
} |
431 |
cout << ", VelocityResponseDepth=" << (int) pDimensionRegion->VelocityResponseDepth << ", VelocityResponseCurveScaling=" << (int) pDimensionRegion->VelocityResponseCurveScaling << endl; |
cout << ", VelocityResponseDepth=" << (int) pDimensionRegion->VelocityResponseDepth << ", VelocityResponseCurveScaling=" << (int) pDimensionRegion->VelocityResponseCurveScaling << endl; |
432 |
|
cout << " VelocityUpperLimit=" << (int) pDimensionRegion->VelocityUpperLimit << " DimensionUpperLimits[]=" << flush; |
433 |
|
printIntArray(pDimensionRegion->DimensionUpperLimits, 8); |
434 |
|
cout << endl; |
435 |
|
#if 0 // requires access to protected member VelocityTable, so commented out for now |
436 |
|
if (pDimensionRegion->VelocityTable) { |
437 |
|
cout << " VelocityTable[]=" << flush; |
438 |
|
printIntArray(pDimensionRegion->VelocityTable, 127); |
439 |
|
cout << endl; |
440 |
|
} |
441 |
|
#endif |
442 |
cout << " Pan=" << (int) pDimensionRegion->Pan << endl; |
cout << " Pan=" << (int) pDimensionRegion->Pan << endl; |
443 |
|
|
444 |
dimensionRegions++; |
dimensionRegions++; |
446 |
} |
} |
447 |
|
|
448 |
string Revision() { |
string Revision() { |
449 |
string s = "$Revision: 1.21 $"; |
string s = "$Revision$"; |
450 |
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 |
451 |
} |
} |
452 |
|
|