Audio usage - functions

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

Moderators: cheriff, TyRaNiD

Post Reply
Shinen
Posts: 8
Joined: Tue Oct 18, 2005 6:45 am
Location: Moscow

Audio usage - functions

Post by Shinen »

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? :)
Duo
Posts: 25
Joined: Fri Oct 21, 2005 5:15 am

Post by Duo »

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.
Shinen
Posts: 8
Joined: Tue Oct 18, 2005 6:45 am
Location: Moscow

Post by Shinen »

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.
starman2049
Posts: 75
Joined: Mon Sep 19, 2005 5:41 am

Post by starman2049 »

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!!
Duo
Posts: 25
Joined: Fri Oct 21, 2005 5:15 am

Post by Duo »

The link above has a racecar game source with exactly that. It uses sdl, though.
starman2049
Posts: 75
Joined: Mon Sep 19, 2005 5:41 am

Post by starman2049 »

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?
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

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?repna ... 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.
Shinen
Posts: 8
Joined: Tue Oct 18, 2005 6:45 am
Location: Moscow

Post by Shinen »

Shine wrote:You could take a look at the PSPSDK samples at http://svn.ps2dev.org/listing.php?repna ... 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.
Shinen
Posts: 8
Joined: Tue Oct 18, 2005 6:45 am
Location: Moscow

Post by Shinen »

starman2049 wrote: Has anyone done this without using SDL or other OpenSource routines?
I'm on the way ;) but too lazy.
User avatar
dsn
Posts: 47
Joined: Wed Nov 09, 2005 11:48 am
Location: Indianapolis, Indiana, USA

Post by dsn »

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.
Post Reply