libcdio-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-help] 44 bit difference


From: Cuke
Subject: Re: [Libcdio-help] 44 bit difference
Date: Sun, 19 Apr 2009 15:29:47 -0700 (PDT)

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.
-- 
View this message in context: 
http://www.nabble.com/44-bit-difference-tp23065170p23128111.html
Sent from the Gnu - Libcdio - Help mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]