any way to increase PSP_NUM_AUDIO_SAMPLES?

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

Moderators: cheriff, TyRaNiD

Post Reply
cooleyandy
Posts: 41
Joined: Sat Jul 02, 2005 10:12 am

any way to increase PSP_NUM_AUDIO_SAMPLES?

Post by cooleyandy »

The default is 1024 samples per second when using pspaudiolib. Is there any way to increase this value to be 8192 instead?
I've tried the function sceAudioSetChannelDataLen but it had no effect and the callback still asks for 1024 samples.
My guess is to use pspaudio instead, but I'm a bit clueless on how it works exactly.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

There's sample code using pspaudio in the SDL port (src/audio/psp/SDL_pspaudio.c). Basically, once you reserve your channel(s) (you set the sample size explicitly) you call either sceAudioOutputBlocking() or sceAudioOutputPannedBlocking() to output mono or stereo sound, respectively. You need to call these in a thread that's running at a lower priority than your main() thread. If you don't have any audio to output for that frame, then call sceAudioOutput* with buffers filled with silence.
cooleyandy
Posts: 41
Joined: Sat Jul 02, 2005 10:12 am

Post by cooleyandy »

ah, so pspaudiolib basically creates a thread that calls the audio callback, and then call sceAudioOutputBlocking() to output the data.
What is Main's priority number? or rather, when creating the thread, what should I use as the priority number?
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

By default the main() thread is started with a priority of 32. You can override that by using a statement such as:

Code: Select all

PSP_MAIN_THREAD_PRIORITY(100);
All of the PSPSDK sample code creates callbacks with a priority of 17 (dunno why :). You want the callback threads to have the lowest priority, so set your audio thread somewhere above that.
cooleyandy
Posts: 41
Joined: Sat Jul 02, 2005 10:12 am

Post by cooleyandy »

thanks mrbrown for the help and pspsdk.
Post Reply