×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    4

    Help extracting data from a wave file using TLex not working

    Hello everyone,
    Please please please help i am new to symbian c++ programming
    i am trying to create a function that can read a wave file to extract information from the header such as the samplerate, compession, blockalign etc.

    i have managed to be able to get the positions of the format and data chunks of the file using a loop and comparing a lit string with a string read from the filebuffer(TBuf8) however i am seeking to the various positions where the data i want is and i can get it.

    i want to get the samplerate and store it into and TInt so i do this

    plus12 = Fmtpos +12;

    wavefile.Seek(ESeekStart,plus12);//seek to samplerate position
    wavefile.Read(filebuffer,4); //read 4 bytes into the file buffer
    TLex8 LexS(filebuffer); // copy the buffer into Tlex
    TUint SampRate =0; // int variable for samplerate
    LexS.Val(SampRate,EHex); // convert the number string in tlex to int SampRate

    only the samplerate is in hex format preceded with 0x so it wont put anything into my TUint and samplerate remains 0.

    do i just need to remove the 0x? if yes how do i do that

    or am i doing this wrong and is there another way to do this?


    thanks in advance God bless

  2. #2
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: Help extracting data from a wave file using TLex not working

    in normal condition, exclude you self defined wave type, the samplerate, channel data, etc is hex/numercal data, so you just read it in TUint, not need use TLex8.

    like the data is 0x00001234, not is string "0x00001234", so the code is like
    Code:
    TUint SampRate =0;
    wavefile.Read(&sampRate,4);
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    4

    Re: Help extracting data from a wave file using TLex not working

    thanks for replying qxiaoyuan,

    this is not working
    i have a Rfile wavefile

    wavefile.read() takes TDes8& aDes and TInt aPos

    it wont read into a TUint i'm getting compiler error

    function call '[RFile].Read(unsigned int *, int)' does not match

    thanks for your help

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    4

    Re: Help extracting data from a wave file using TLex not working

    please please please help somebody

Similar Threads

  1. Problem with GCCE build in Carbide.vs
    By raffaelbechara in forum Symbian
    Replies: 6
    Last Post: 2008-10-20, 16:06
  2. Replies: 7
    Last Post: 2006-11-03, 01:52
  3. GPRS connection problems on 6600..
    By suckho in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2005-12-02, 14:00
  4. Replies: 1
    Last Post: 2005-05-26, 14:22
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×