2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2017 by Christian Schoenebeck * |
* Copyright (C) 2003-2018 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This program is part of libgig. * |
* This program is part of libgig. * |
37 |
|
|
38 |
string Revision(); |
string Revision(); |
39 |
void PrintVersion(); |
void PrintVersion(); |
40 |
void PrintFileInformations(gig::File* gig); |
void PrintFileInformation(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); |
void PrintScripts(gig::File* gig); |
44 |
void PrintInstruments(gig::File* gig); |
void PrintInstruments(gig::File* gig); |
45 |
|
void PrintInstrumentNamesOnly(gig::File* gig); |
46 |
void PrintRegions(gig::Instrument* instr); |
void PrintRegions(gig::Instrument* instr); |
47 |
void PrintUsage(); |
void PrintUsage(); |
48 |
void PrintDimensionRegions(gig::Region* rgn); |
void PrintDimensionRegions(gig::Region* rgn); |
65 |
{ |
{ |
66 |
bool bVerify = false; |
bool bVerify = false; |
67 |
bool bRebuildChecksums = false; |
bool bRebuildChecksums = false; |
68 |
|
bool bInstrumentNamesOnly = false; |
69 |
|
|
70 |
if (argc <= 1) { |
if (argc <= 1) { |
71 |
PrintUsage(); |
PrintUsage(); |
88 |
bVerify = true; |
bVerify = true; |
89 |
} else if (opt == "--rebuild-checksums") { |
} else if (opt == "--rebuild-checksums") { |
90 |
bRebuildChecksums = true; |
bRebuildChecksums = true; |
91 |
|
} else if (opt == "--instrument-names") { |
92 |
|
bInstrumentNamesOnly = true; |
93 |
} else { |
} else { |
94 |
cerr << "Unknown option '" << opt << "'" << endl; |
cerr << "Unknown option '" << opt << "'" << endl; |
95 |
cerr << endl; |
cerr << endl; |
120 |
if (OK) cout << "All checks passed successfully! :-)\n"; |
if (OK) cout << "All checks passed successfully! :-)\n"; |
121 |
return (OK) ? EXIT_SUCCESS : EXIT_FAILURE; |
return (OK) ? EXIT_SUCCESS : EXIT_FAILURE; |
122 |
} else { |
} else { |
123 |
PrintFileInformations(gig); |
if (bInstrumentNamesOnly) { |
124 |
cout << endl; |
PrintInstrumentNamesOnly(gig); |
125 |
PrintGroups(gig); |
} else { |
126 |
cout << endl; |
PrintFileInformation(gig); |
127 |
PrintSamples(gig); |
cout << endl; |
128 |
cout << endl; |
PrintGroups(gig); |
129 |
PrintScripts(gig); |
cout << endl; |
130 |
cout << endl; |
PrintSamples(gig); |
131 |
PrintInstruments(gig); |
cout << endl; |
132 |
|
PrintScripts(gig); |
133 |
|
cout << endl; |
134 |
|
PrintInstruments(gig); |
135 |
|
} |
136 |
} |
} |
137 |
delete gig; |
delete gig; |
138 |
delete riff; |
delete riff; |
149 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
150 |
} |
} |
151 |
|
|
152 |
void PrintFileInformations(gig::File* gig) { |
void PrintFileInformation(gig::File* gig) { |
153 |
cout << "Global File Information:" << endl; |
cout << "Global File Information:" << endl; |
154 |
cout << " Total instruments: " << gig->Instruments << endl; |
cout << " Total instruments: " << gig->Instruments << endl; |
155 |
if (gig->pVersion) { |
if (gig->pVersion) { |
302 |
} |
} |
303 |
} |
} |
304 |
|
|
305 |
|
void PrintInstrumentNamesOnly(gig::File* gig) { |
306 |
|
int instruments = 0; |
307 |
|
gig::Instrument* pInstrument = gig->GetFirstInstrument(); |
308 |
|
for (; pInstrument; pInstrument = gig->GetNextInstrument()) { |
309 |
|
instruments++; |
310 |
|
string name = pInstrument->pInfo->Name; |
311 |
|
if (name == "") name = "<NO NAME>"; |
312 |
|
else name = '\"' + name + '\"'; |
313 |
|
cout << "Instrument " << instruments << ") " << name << endl; |
314 |
|
} |
315 |
|
} |
316 |
|
|
317 |
void PrintRegions(gig::Instrument* instr) { |
void PrintRegions(gig::Instrument* instr) { |
318 |
int iRegion = 1; |
int iRegion = 1; |
319 |
gig::Region* pRegion = instr->GetFirstRegion(); |
gig::Region* pRegion = instr->GetFirstRegion(); |
625 |
cout << endl; |
cout << endl; |
626 |
cout << " --verify Checks raw wave data integrity of all samples." << endl; |
cout << " --verify Checks raw wave data integrity of all samples." << endl; |
627 |
cout << endl; |
cout << endl; |
628 |
|
cout << " --instrument-names Print only instrument names." << endl; |
629 |
|
cout << endl; |
630 |
} |
} |