 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
PeterLeRoi
Joined: 16 May 2007 Posts: 31
|
Posted: Thu Jul 12, 2007 8:55 am Post subject: Bug? Canīt read an wav header |
|
|
Hello! I have one wav file need to read. The header has 44 bytes: 37-40 bytes contains "data" and 41-44 contains the size of data chunk. So:
| Code: |
int fp = sceIoOpen(segmentoElegido, PSP_O_RDONLY, 0777);
sceIoRead(fp,dheader,36);
char data[5];
sceIoRead(fp,data,4);
printf("\ndata = %#x", data[0]);
printf("\ndata = %#x", data[1]);
printf("\ndata = %#x", data[2]);
printf("\ndata = %#x", data[3]);
char size[5];
sceIoRead(fp,size,4);
printf("\ntamfich1 = %#x", size[0]);
printf("\ntamfich1 = %#x", size[1]);
printf("\ntamfich1 = %#x", size[2]);
printf("\ntamfich1 = %#x", size[3]);
|
If the byte doesnīt begin with a letter (ie 0x90) it prints the byte ok (0x90) but if begins with a letter (ie 0xa0) it prints 0xffffffa0.
Has anybody had this problem?
Thanks :) |
|
| Back to top |
|
 |
kururin
Joined: 05 Jul 2006 Posts: 36
|
Posted: Thu Jul 12, 2007 9:29 am Post subject: Re: Bug? Canīt read an wav header |
|
|
| PeterLeRoi wrote: | Hello! I have one wav file need to read. The header has 44 bytes: 37-40 bytes contains "data" and 41-44 contains the size of data chunk. So:
| Code: |
int fp = sceIoOpen(segmentoElegido, PSP_O_RDONLY, 0777);
sceIoRead(fp,dheader,36);
char data[5];
sceIoRead(fp,data,4);
printf("\ndata = %#x", data[0]);
printf("\ndata = %#x", data[1]);
printf("\ndata = %#x", data[2]);
printf("\ndata = %#x", data[3]);
char size[5];
sceIoRead(fp,size,4);
printf("\ntamfich1 = %#x", size[0]);
printf("\ntamfich1 = %#x", size[1]);
printf("\ntamfich1 = %#x", size[2]);
printf("\ntamfich1 = %#x", size[3]);
|
If the byte doesnīt begin with a letter (ie 0x90) it prints the byte ok (0x90) but if begins with a letter (ie 0xa0) it prints 0xffffffa0.
Has anybody had this problem?
Thanks :) |
Use u8 (or unsigned char) instead of chars. |
|
| Back to top |
|
 |
PeterLeRoi
Joined: 16 May 2007 Posts: 31
|
Posted: Thu Jul 12, 2007 9:53 am Post subject: |
|
|
| Thanks ;) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|