//
// Programmer:    Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Wed Feb  6 13:59:17 PST 2013
// Last Modified: Wed Feb  6 13:59:20 PST 2013
// Filename:      ...sig/examples/all/smfinfo.cpp
// Web Address:   http://sig.sapp.org/examples/museinfo/humdrum/smfinfo.cpp
// Syntax:        C++; museinfo
//
// Description:   Converts a single melody MIDI file/track into an ASCII text 
//	          format with starting time and pitch.
//

#include "Array.h"
#include "Options.h"

#include <iostream>
#include <fstream>

using namespace std;

// user interface variables
Options options;
int     fixQ  = 0;          // used with -f option

// function declarations:
void      checkOptions(Options& opts, int argc, char** argv);
void      example(void);
void      usage(const char* command);
void      fixTrackByteCounts(const char* filename);
void      printInfo(const char* filename);

//////////////////////////////////////////////////////////////////////////

int main(int argc, char* argv[]) {
   checkOptions(options, argc, argv);

   int i;
   const char* filename;
   for (i=1; i<=options.getArgCount(); i++) {
      filename = options.getArg(i);
      if (fixQ) {
         fixTrackByteCounts(filename);
      } else {
         printInfo(filename);
      }
   }
   return 0;
}


//////////////////////////////////////////////////////////////////////////


//////////////////////////////
//
// fixTrackByteCounts -- Fix the byte sizes of a Standard MIDI file.
//

void fixTrackByteCounts(const char* filename) {
   ifstream infile(filename, fstream::in | ifstream::binary);
   infile.seekg(0, fstream::end);
   long length = infile.tellg();   
   cout << "LENGTH = " << length << endl;
}



//////////////////////////////
//
// fixTrackByteCounts -- Fix the byte sizes of a Standard MIDI file.
//

void printInfo(const char* filename) {

}


//////////////////////////////
//
// example --
//

void example(void) {

}



//////////////////////////////
//
// usage --
//

void usage(const char* command) {

}


// md5sum: 4af655463c2dc2f9530ad56a4d0be9f1 smfinfo.cpp [20130319]