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 

Audio usage - functions

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



Joined: 18 Oct 2005
Posts: 8
Location: Moscow

PostPosted: Wed Nov 16, 2005 8:53 pm    Post subject: Audio usage - functions Reply with quote

I've just had a look to audio programming and noticed that there's too little info available on functions' usage and meanings.

So, what is the difference between sceAudioOutput and sceAudioOutputBlocking and what *Panned means?

Is it also possible to use interrupts when buffer ends ?

p.s. I know about the audiolib, but maybe there's a better way? :)
Back to top
View user's profile Send private message
Duo



Joined: 21 Oct 2005
Posts: 25

PostPosted: Thu Nov 17, 2005 3:42 am    Post subject: Reply with quote

http://www.fumi2kick.com/pspapp/ Download the source for tcgs car. It has a lot of functions with sound channels and playing .wavs over each other. This may not be exactly what you're looking for. The pspsdk examples have something on sound, too? It's hard to find a lot of examples, but the playstation is still early.
Back to top
View user's profile Send private message
Shinen



Joined: 18 Oct 2005
Posts: 8
Location: Moscow

PostPosted: Fri Nov 18, 2005 8:58 pm    Post subject: Reply with quote

replying to myself ;)

Maybe it is well-known and everyone is too lazy to write a few words ;) but maybe it`d be useful to somebody.

The functions with Blocking postfix wait while for the buffer to stop playing and then play the new one (ordinary functions, like sceAudioOutput, start playing the new one immediately).

The functions with Panned postfix play sounds with different volume on the left and right channels (imho useful for hardware mix of a few mono-channels).

I still don't know anything about interrupt usage, at this moment it can be probably found in official SDK only.

2 Duo:
Thanks for your reply, but these sources didn't give any useful info to me, because they use SDL_auduo libs.
Back to top
View user's profile Send private message
starman2049



Joined: 19 Sep 2005
Posts: 75

PostPosted: Sun Nov 20, 2005 6:09 am    Post subject: Reply with quote

I am trying to get audio to work to and have not found a good foothold yet. The PS2 game I am porting needs to be able to play a long, looping .WAV (or .MP3) background piece of music, and then various sound effect need to be able to be cued overtop.

I figured that since the PSP is such a rich multimedia device this kind of stuff should be easy, but I have not yet been able to find sample code that would allow me to do this.

Any help from one of the audio experts on this forum would be greatly appreciated!!
Back to top
View user's profile Send private message
Duo



Joined: 21 Oct 2005
Posts: 25

PostPosted: Sun Nov 20, 2005 7:40 am    Post subject: Reply with quote

The link above has a racecar game source with exactly that. It uses sdl, though.
Back to top
View user's profile Send private message
starman2049



Joined: 19 Sep 2005
Posts: 75

PostPosted: Sun Nov 27, 2005 3:34 pm    Post subject: Reply with quote

Thanks for the tip, but I agree with Shinen I would rather not introduce SDL into this when all I want to do is play a .WAV file.

It looks like the hooks are there to output buffers, but the buffers would need to be fed/filled by hand. If data does not fit in memory then streaming would need to be written. If format is other than RAW data than it would need to be converted realtime, and if more than 8 Mono/4 stereo channels are needed then mixing would need to be done by hand as well.

Has anyone done this without using SDL or other OpenSource routines?
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Nov 27, 2005 6:22 pm    Post subject: Reply with quote

Shinen wrote:
I still don't know anything about interrupt usage, at this moment it can be probably found in official SDK only.


You could take a look at the PSPSDK samples at http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2Fpspsdk%2Fsrc%2Fsamples%2Faudio%2F&rev=0&sc=0 . The audio functions uses callback functions, which are called from interrupt, I think.

If you just want to play some WAV files, take a look at mikmodlib or libmikmod in the SVN repository and e.g. at Lua Player in the pspware SVN repository to see how to use mikmod for playing WAVs and MODs.
Back to top
View user's profile Send private message
Shinen



Joined: 18 Oct 2005
Posts: 8
Location: Moscow

PostPosted: Sun Nov 27, 2005 8:10 pm    Post subject: Reply with quote

Shine wrote:
You could take a look at the PSPSDK samples at http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2Fpspsdk%2Fsrc%2Fsamples%2Faudio%2F&rev=0&sc=0 . The audio functions uses callback functions, which are called from interrupt, I think.


Audiolib makes threads with higher priority and use "*blocking" functions.
So callback functions called from thread of audiolib.
Back to top
View user's profile Send private message
Shinen



Joined: 18 Oct 2005
Posts: 8
Location: Moscow

PostPosted: Sun Nov 27, 2005 8:47 pm    Post subject: Reply with quote

starman2049 wrote:

Has anyone done this without using SDL or other OpenSource routines?


I'm on the way ;) but too lazy.
Back to top
View user's profile Send private message
dsn



Joined: 09 Nov 2005
Posts: 47
Location: Indianapolis, Indiana, USA

PostPosted: Mon Nov 28, 2005 5:15 pm    Post subject: Reply with quote

starman2049 wrote:
Has anyone done this without using SDL or other OpenSource routines?


This is still a work-in-progress, but you might be interested in trying the audio portion of a framework I'm writing: http://captaindan.org/sw/GameKit/

Documentation is available there and is also included in the download. Like I said, it's still a work-in-progress, so there are some rough edges and one or two things mentioned in the docs that don't actually work yet. (Most notably, texture swizzling isn't implemented.) But the audio stuff is pretty solid.

Please let me know if you need any help with it.
Back to top
View user's profile Send private message Send e-mail
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