forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug? Canīt read an wav header

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
PeterLeRoi



Joined: 16 May 2007
Posts: 31

PostPosted: Thu Jul 12, 2007 8:55 am    Post subject: Bug? Canīt read an wav header Reply with quote

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
View user's profile Send private message
kururin



Joined: 05 Jul 2006
Posts: 36

PostPosted: Thu Jul 12, 2007 9:29 am    Post subject: Re: Bug? Canīt read an wav header Reply with quote

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
View user's profile Send private message
PeterLeRoi



Joined: 16 May 2007
Posts: 31

PostPosted: Thu Jul 12, 2007 9:53 am    Post subject: Reply with quote

Thanks ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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