--- libgig/trunk/src/gigdump.cpp 2005/02/22 19:18:16 402 +++ libgig/trunk/src/gigdump.cpp 2006/05/06 11:29:29 858 @@ -2,8 +2,8 @@ * * * libgig - C++ cross-platform Gigasampler format file loader library * * * - * Copyright (C) 2003, 2004 by Christian Schoenebeck * - * * + * Copyright (C) 2003-2005 by Christian Schoenebeck * + * * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -27,11 +27,14 @@ #include #include +#include #include "gig.h" using namespace std; +string Revision(); +void PrintVersion(); void PrintSamples(gig::File* gig); void PrintInstruments(gig::File* gig); void PrintRegions(gig::Instrument* instr); @@ -44,6 +47,13 @@ PrintUsage(); return EXIT_FAILURE; } + if (argv[1][0] == '-') { + switch (argv[1][1]) { + case 'v': + PrintVersion(); + return EXIT_SUCCESS; + } + } FILE* hFile = fopen(argv[1], "r"); if (!hFile) { cout << "Invalid file argument!" << endl; @@ -90,6 +100,7 @@ case gig::loop_type_backward: cout << "reverse)"; break; } cout << ", LoopFraction=" << pSample->LoopFraction << ", Start=" << pSample->LoopStart << ", End=" << pSample->LoopEnd; + cout << ", LoopPlayCount=" << pSample->LoopPlayCount; } cout << ", Length=" << pSample->SamplesTotal << " Compressed=" << ((pSample->Compressed) ? "true" : "false") << endl; pSample = gig->GetNextSample(); @@ -161,6 +172,12 @@ case gig::dimension_keyboard: // Key Position cout << "KEYBOARD"; break; + case gig::dimension_roundrobin: // Different samples triggered each time a note is played, dimension regions selected in sequence + cout << "ROUNDROBIN"; + break; + case gig::dimension_random: // Different samples triggered each time a note is played, random order + cout << "RANDOM"; + break; case gig::dimension_modwheel: // Modulation Wheel (MIDI Controller 1) cout << "MODWHEEL"; break; @@ -231,7 +248,7 @@ cout << "EFFECT5DEPTH"; break; default: - cout << "UNKNOWN - please report this !"; + cout << "UNKNOWN (" << int(DimensionDef.dimension) << ") - please report this !"; break; } cout << ", Bits=" << (uint) DimensionDef.bits << ", Zones=" << (uint) DimensionDef.zones; @@ -240,9 +257,6 @@ case gig::split_type_normal: cout << "NORMAL" << endl; break; - case gig::split_type_customvelocity: - cout << "CUSTOMVELOCITY" << endl; - break; case gig::split_type_bit: cout << "BIT" << endl; break; @@ -260,7 +274,7 @@ void PrintDimensionRegions(gig::Region* rgn) { int dimensionRegions = 0; gig::DimensionRegion* pDimensionRegion; - while (dimensionRegions < 32) { + while (dimensionRegions < rgn->DimensionRegions) { pDimensionRegion = rgn->pDimensionRegions[dimensionRegions]; if (!pDimensionRegion) break; @@ -273,7 +287,7 @@ cout << "\"" << pSample->pInfo->Name << "\", "; } cout << pSample->SamplesPerSecond << "Hz, "; - cout << "UnityNote=" << (int) pDimensionRegion->UnityNote << ", FineTune=" << (int) pDimensionRegion->FineTune << endl; + cout << "UnityNote=" << (int) pDimensionRegion->UnityNote << ", FineTune=" << (int) pDimensionRegion->FineTune << ", Gain=" << (-pDimensionRegion->Gain / 655360.0) << "dB, SampleStartOffset=" << pDimensionRegion->SampleStartOffset << endl; } else { cout << " Sample: " << endl; @@ -306,8 +320,21 @@ } } +string Revision() { + string s = "$Revision: 1.18 $"; + return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword +} + +void PrintVersion() { + cout << "gigdump revision " << Revision() << endl; + cout << "using " << gig::libraryName() << " " << gig::libraryVersion() << endl; +} + void PrintUsage() { cout << "gigdump - parses Gigasampler files and prints out the content." << endl; cout << endl; - cout << "Usage: gigdump FILE" << endl; + cout << "Usage: gigdump [-v] FILE" << endl; + cout << endl; + cout << " -v Print version and exit." << endl; + cout << endl; }