Line 26... |
Line 26... |
class Args {
|
class Args {
|
public:
|
public:
|
int skip;
|
int skip;
|
string filename;
|
string filename;
|
string outputfile;
|
string outputfile;
|
Args( int argc, char *argv[]) : skip(0), outputfile("out.wav") {
|
bool stereo;
|
|
Args( int argc, char *argv[]) : skip(0), outputfile("out.wav"), stereo(false) {
|
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 45... |
Line 46... |
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],"-s")==0 ) { // stereo
|
|
k++;
|
|
stereo = true;
|
|
continue;
|
|
}
|
if( filename_known ) {
|
if( filename_known ) {
|
cout << "Unknown parameter " << argv[k] << "\n";
|
cout << "Unknown parameter " << argv[k] << "\n";
|
throw "Incorrect command line";
|
throw "Incorrect command line";
|
}
|
}
|
filename = argv[k];
|
filename = argv[k];
|
Line 104... |
Line 110... |
fout.write( fmt, 4 );
|
fout.write( fmt, 4 );
|
aux=16;
|
aux=16;
|
fout.write( (char*)&aux, 4 );// suubchunk 1 size
|
fout.write( (char*)&aux, 4 );// suubchunk 1 size
|
short int aux_short = 1;
|
short int aux_short = 1;
|
fout.write( (char*)&aux_short, 2 ); // audio format (1)
|
fout.write( (char*)&aux_short, 2 ); // audio format (1)
|
|
aux_short = ar.stereo ? 2 : 1;
|
fout.write( (char*)&aux_short, 2 ); // num channels (1)
|
fout.write( (char*)&aux_short, 2 ); // num channels (1)
|
aux=44100;
|
aux=44100;
|
fout.write( (char*)&aux, 4 );
|
fout.write( (char*)&aux, 4 );
|
aux=44100*1*2;
|
aux=44100*1*2 * (ar.stereo?2:1);
|
fout.write( (char*)&aux, 4 ); // byte rate
|
fout.write( (char*)&aux, 4 ); // byte rate
|
aux_short=2;
|
aux_short= ar.stereo ? 4 : 2;
|
fout.write( (char*)&aux_short, 2 ); // block align
|
fout.write( (char*)&aux_short, 2 ); // block align
|
aux_short=16;
|
aux_short=16;
|
fout.write( (char*)&aux_short, 2 ); // bits per sample
|
fout.write( (char*)&aux_short, 2 ); // bits per sample
|
RIFF="data";
|
RIFF="data";
|
fout.write( RIFF, 4 );
|
fout.write( RIFF, 4 );
|