tags:

views:

35

answers:

1

I am trying opening a audio file(.wav) and retrieve the raw data. I got the below code from the link. When I am trying to implement the code DWORD is not supported in Objective c.

Please help me out in implementing the code.Please help me out.

FILE *fp;
fp = fopen("sound.wav","rb");
if (fp)
{
    BYTE id[4]; //four bytes to hold 'RIFF'
    DWORD size; //32 bit value to hold file size

    fread(id,sizeof(BYTE),4,fp); //read in first four bytes
    if (!strcmp(id,"RIFF"))
    { //we had 'RIFF' let's continue
        fread(size,sizeof(DWORD),1,fp);
        //read in 32bit size value
    }
}
+2  A: 

You could use any 32-bit unsigned integer value for DWORD, e.g. uint32_t.

#include <stdint.h>
typedef uint32_t DWORD;
...
KennyTM
@Warrior: I don't know what more detail can be given. Just stick that `typedef` to the start of the file and the code shall compile.
KennyTM
Thanks, i was totally confused.Sorry for it.
Warrior
@Kenny TM:Please give your views to my previous questions,I trying to implement FFT to a wav file.I struggling badly for 4 days.Please help me out.
Warrior
@Kenny TM:i have used the below line fread(format_length, sizeof(DWORD),1,audioView);it shows the exception "passing argument 1 of 'fread' makes pointer from integer without a cast".How to solve this exception.
Warrior
@Warrior: `fread(`. Have you learned C before? If not, do so.
KennyTM
I dont know c.thanks for the help.
Warrior
@Kenny TM:(!strcmp(id,"RIFF"))-->shows a warning "pointer targets in passing argument 1 of 'strcmp' differ in signedness".
Warrior
KennyTM