Bug? Can´t read an wav header

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PeterLeRoi
Posts: 31
Joined: Wed May 16, 2007 11:08 am

Bug? Can´t read an wav header

Post by PeterLeRoi »

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: Select all

	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 :)
kururin
Posts: 36
Joined: Wed Jul 05, 2006 7:19 am

Re: Bug? Can´t read an wav header

Post by kururin »

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: Select all

	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.
PeterLeRoi
Posts: 31
Joined: Wed May 16, 2007 11:08 am

Post by PeterLeRoi »

Thanks ;)
Post Reply