OpenCores
URL https://opencores.org/ocsvn/sqmusic/sqmusic/trunk

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [1942/] [log2wav.cc] - Diff between revs 6 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 9
Line 28... Line 28...
public:
public:
  int skip;
  int skip;
  string filename;
  string filename;
  string outputfile;
  string outputfile;
  bool stereo;
  bool stereo;
  Args( int argc, char *argv[]) : skip(0), outputfile("out.wav"), stereo(false) {
        const char *waitline;
 
  Args( int argc, char *argv[]) :
 
                skip(0), outputfile("out.wav"), stereo(false), waitline(NULL)
 
        {
    int k=1;
    int k=1;
    bool filename_known=false;
    bool filename_known=false;
    while( k < argc ) {
    while( k < argc ) {
      if( strcmp(argv[k],"-l")==0 ) {
      if( strcmp(argv[k],"-l")==0 ) {
        k++;
        k++;
Line 47... Line 50...
        if( k >= argc ) throw "Expected output file name after -o";
        if( k >= argc ) throw "Expected output file name after -o";
        outputfile = argv[k];
        outputfile = argv[k];
        k++;
        k++;
        continue;
        continue;
      }
      }
 
      if( strcmp(argv[k],"--wait")==0 ) {
 
        k++;
 
        if( k >= argc ) throw "Expected output file name after --wait";
 
        waitline = argv[k];
 
        k++;
 
        continue;
 
      }
      if( strcmp(argv[k],"-s")==0 ) { // stereo
      if( strcmp(argv[k],"-s")==0 ) { // stereo
        k++;
        k++;
        stereo = true;
        stereo = true;
        continue;
        continue;
      }
      }
Line 60... Line 70...
      }
      }
      filename = argv[k];
      filename = argv[k];
      filename_known = true;
      filename_known = true;
      k++;
      k++;
    }
    }
    if( filename=="-" ) filename=string("/dev/stdin");
    if( filename=="-" || !filename_known ) filename=string("/dev/stdin");
  }
  }
};
};
 
 
bool sigint_abort=false;
bool sigint_abort=false;
 
 
Line 91... Line 101...
                // starts to come out   
                // starts to come out   
                for( int k=0; k<ar.skip && !fin.eof(); k++ ) {
                for( int k=0; k<ar.skip && !fin.eof(); k++ ) {
                        fin.getline( buffer, sizeof(buffer) );
                        fin.getline( buffer, sizeof(buffer) );
                        //if( strcmp(buffer,"ncsim> run" )==0) break;
                        //if( strcmp(buffer,"ncsim> run" )==0) break;
                }
                }
 
                // wait for a given line in the output
 
                buffer[0]=0;
 
                if( ar.waitline )
 
                        while( !fin.eof() && strcmp( buffer, ar.waitline) )
 
                                fin.getline( buffer, sizeof(buffer) );
 
 
 
                // start conversion
                if( fin.eof() ) throw "Data not found";
                if( fin.eof() ) throw "Data not found";
                fout.seekp(44);
                fout.seekp(44);
                signal( 2, sigint_handle ); // capture CTRL+C in order to save the
                signal( 2, sigint_handle ); // capture CTRL+C in order to save the
                // WAV header before quiting
                // WAV header before quiting
                while( !fin.eof() && !fin.bad() && !fin.fail() && !sigint_abort ) {
                while( !fin.eof() && !fin.bad() && !fin.fail() && !sigint_abort ) {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.