[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libcdio-help] 44 bit difference
From: |
Robert William Fuller |
Subject: |
Re: [Libcdio-help] 44 bit difference |
Date: |
Sun, 19 Apr 2009 19:31:18 -0400 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20090125) |
So it was a 44 byte difference, not a "44 bit" difference. I might have
guessed something like that if you had said "bytes" instead of "bits" in
the subject. It helps to be very careful when you state a problem. I'm
glad to hear you solved it :-)
Cuke wrote:
> Ok so with the help of rocky i found that my program i post you didn't add
> the wav header. So i just add this lines of code after the OUTFILE open:
>
> //Get the track size in bytes and conver
> int bytes= ( i_last_lsn - i_first_lsn + 1 ) * CDIO_CD_FRAMESIZE_RAW;
> cout << "Nr Bytes:" << bytes+44 << endl;
>
> //Open the output file
> ofstream outfile ("temp.wav",ofstream::binary | ofstream::app |
> ofstream::out);
>
> //Waw format header specification
> int waweChunkLength=bytes+44-8;
> int fmtChunkLength=16;
> int compressionCode=1;
> int numberOfChannels=2;
> int sampleRate=44100;
> int blockAlign=44100*2*2;
> int significantBps=4;
> int extraFormatBytes=16;
>
> outfile.write("RIFF",4);
> outfile.write((char*)&waweChunkLength,4);
> outfile.write("WAVEfmt ",8);
> outfile.write((char*)&fmtChunkLength,4);
> outfile.write((char*)&compressionCode,2);
> outfile.write((char*)&numberOfChannels,2);
> outfile.write((char*)&sampleRate,4);
> outfile.write((char*)&blockAlign,4);
> outfile.write((char*)&significantBps,2);
> outfile.write((char*)&extraFormatBytes,2);
> outfile.write("data",4);
> outfile.write((char*)&bytes,4);
>
> //Track Rip
> for ( i_cursor = i_first_lsn; i_cursor <= i_last_lsn; i_cursor ++) {
>
> Bare in mind hwr that the (char *) conversion is platform dependent and that
> this changed doesn't deal with endianness.
> http://www.nabble.com/file/p23128111/main.cpp main.cpp i included a working
> c++ source file.