/[svn]/libgig/trunk/src/gigextract.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gigextract.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 517 by persson, Thu Feb 10 19:16:31 2005 UTC revision 518 by schoenebeck, Sun May 8 16:19:34 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *   *   Copyright (C) 2003-2005 by Christian Schoenebeck                      *
6   *                               <cuse@users.sourceforge.net>              *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   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  *
# Line 40  Line 40 
40  #include <iostream>  #include <iostream>
41  #include <cstdlib>  #include <cstdlib>
42  #include <string.h>  #include <string.h>
43    #include <string>
44  #include <stdlib.h>  #include <stdlib.h>
45  #include <sys/types.h>  #include <sys/types.h>
46  #include <sys/stat.h>  #include <sys/stat.h>
# Line 66  using namespace std; Line 67  using namespace std;
67  typedef map<unsigned int, bool> OrderMap;  typedef map<unsigned int, bool> OrderMap;
68  OrderMap* pOrderedSamples = NULL;  OrderMap* pOrderedSamples = NULL;
69    
70    string Revision();
71    void PrintVersion();
72  void PrintUsage();  void PrintUsage();
73  void ExtractSamples(gig::File* gig, char* destdir, OrderMap* ordered);  void ExtractSamples(gig::File* gig, char* destdir, OrderMap* ordered);
74  int writeWav(const char* filename, void* samples, long samplecount, int channels, int bitdepth, long rate);  int writeWav(const char* filename, void* samples, long samplecount, int channels, int bitdepth, long rate);
# Line 88  int(*_afCloseFile)(AFfilehandle file); Line 91  int(*_afCloseFile)(AFfilehandle file);
91  #endif // !HAVE_SNDFILE  #endif // !HAVE_SNDFILE
92    
93  int main(int argc, char *argv[]) {  int main(int argc, char *argv[]) {
94         if (argc >= 2) {
95            if (argv[1][0] == '-') {
96                switch (argv[1][1]) {
97                    case 'v':
98                        PrintVersion();
99                        return EXIT_SUCCESS;
100                }
101            }
102        }
103      if (argc < 3) {      if (argc < 3) {
104          PrintUsage();          PrintUsage();
105          return EXIT_FAILURE;          return EXIT_FAILURE;
# Line 328  void closeAFlib() { Line 340  void closeAFlib() {
340  }  }
341  #endif // !HAVE_SNDFILE  #endif // !HAVE_SNDFILE
342    
343    string Revision() {
344        string s = "$Revision: 1.5 $";
345        return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
346    }
347    
348    void PrintVersion() {
349        cout << "gigextract revision " << Revision() << endl;
350        cout << "using " << gig::libraryName() << " " << gig::libraryVersion() << endl;
351    }
352    
353  void PrintUsage() {  void PrintUsage() {
354      cout << "gigextract - extracts samples from a Gigasampler file." << endl;      cout << "gigextract - extracts samples from a Gigasampler file." << endl;
355      cout << endl;      cout << endl;
356      cout << "Usage: gigextract GIGFILE DESTDIR [SAMPLENR] [ [SAMPLENR] ...]" << endl;      cout << "Usage: gigextract [-v] GIGFILE DESTDIR [SAMPLENR] [ [SAMPLENR] ...]" << endl;
357      cout << endl;      cout << endl;
358      cout << "   GIGFILE  Input Gigasampler (.gig) file." << endl;      cout << "   GIGFILE  Input Gigasampler (.gig) file." << endl;
359      cout << endl;      cout << endl;
# Line 341  void PrintUsage() { Line 363  void PrintUsage() {
363      cout << "            If no sample indices are given, all samples will be extracted" << endl;      cout << "            If no sample indices are given, all samples will be extracted" << endl;
364      cout << "            (use gigdump to look for available samples)." << endl;      cout << "            (use gigdump to look for available samples)." << endl;
365      cout << endl;      cout << endl;
366        cout << "   -v       Print version and exit." << endl;
367        cout << endl;
368  }  }
369    
370  string ToString(int i) {  string ToString(int i) {

Legend:
Removed from v.517  
changed lines
  Added in v.518

  ViewVC Help
Powered by ViewVC