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 

audiolib changed...

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



Joined: 31 Aug 2004
Posts: 244
Location: Somewhere over the rainbow

PostPosted: Fri Oct 14, 2005 9:23 pm    Post subject: audiolib changed... Reply with quote

I saw that audiolib changed...

Now the callback registration process need one more arg :

Code:

void pspAudioSetChannelCallback(int channel, pspAudioCallback_t callback, void *pdata);


What should we put into pdata ????

Can someone provide a short example ?
_________________
- TiTAN Art Division -
http://www.titandemo.org
Back to top
View user's profile Send private message Visit poster's website
Paco



Joined: 09 Oct 2005
Posts: 54

PostPosted: Fri Oct 14, 2005 10:30 pm    Post subject: Reply with quote

You just pass data that you want to receive in the callback. Notice the callback function prototype has changed too, it now receives an extra parameter.

Old code can simply pass 0 in pdata, and then ignore the new parameter in the callback.

Every callback system needs to support user-provided data for context.
Imagine you make a MP3 player based on audiolib, and want to play back four MP3 at the same time, one on each channel of the audiolib. Easy enough, you simply register your MP3 callback in each channel you're playing an MP3 on.

Now the problem: when your callback is called, which of the four MP3 you're playing is the one you're supposed to store on the buffer? That's the kind of info you provide in the pdata - stuff that your callback uses to identify what data it should work on; in this case, it would be a pointer to your "struct MP3PlayerData", and the first thing the MP3 callback would do is:

pMP3Data = (MP3PlayerData*)pdata;
_________________
Paco
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