Question about memory stick access and threads
Question about memory stick access and threads
I searched the forums and couldn't find a direct answer. I am writing a program for PSP that uses a thread to stream MP3s as background music using cooleye's example. Now the thread is reading the memory stick every time it needs a new frame in the mp3. The main program is also reading the memory stick fairly often. Do I need to worry about that? Does the kernel handle it alright or do I need to lock anything?
Thanks.
Thanks.
You shouldnt need to worry about it, but I would optimise the mp3 player to take larger chunks than just the next frame, I would advise taking in multiple frames, and using slightly more memory, This will also have less reading from the ms. Just my two cents ;)
Code: Select all
.øOº'ºOø.
'ºOo.oOº'
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
some tips:
sceAudioOutput and sceAudioOutputBlocking are two functions that do the ouput. One starts the output and then executes the next bit of code. The other starts the output then waits before going to the next line of code. The trick is to have the sceAudioOutputBlocking in a different thread because when it executes this line of code it is really just waiting the thread so then you have you're decoding thread automatically get control and make sure the cpu has allways got something to do.
also if you're not sure of the sample size when you call:
sceAudioChReserve(int channel, int samplecount, int format);
the other way is to use:
sceAudioSetChannelDataLen(int channel, int samplecount);
before every output.
sceAudioOutput and sceAudioOutputBlocking are two functions that do the ouput. One starts the output and then executes the next bit of code. The other starts the output then waits before going to the next line of code. The trick is to have the sceAudioOutputBlocking in a different thread because when it executes this line of code it is really just waiting the thread so then you have you're decoding thread automatically get control and make sure the cpu has allways got something to do.
also if you're not sure of the sample size when you call:
sceAudioChReserve(int channel, int samplecount, int format);
the other way is to use:
sceAudioSetChannelDataLen(int channel, int samplecount);
before every output.
-
- Posts: 110
- Joined: Tue Feb 27, 2007 9:43 pm
- Contact:
If anyone's interested, found a little while ago:
Prototypes are different to the the sceAudioChReserve/sceAudioChRelease/sceAudioOutputBlocking, something like this:
That should complete the audio lib now.
Code: Select all
0x38553111 sceAudioSRCChReserve
0x5c37c0ae sceAudioSRCChRelease
0xe0727056 sceAudioSRCOutputBlocking
Code: Select all
int sceAudioSRCChReserve(int samplecount, int freq, int format);
int sceAudioSRCChRelease(void);
int sceAudioSRCOutputBlocking(int vol, void *buf);
-
- Posts: 110
- Joined: Tue Feb 27, 2007 9:43 pm
- Contact:
http://forums.ps2dev.org/viewtopic.php?t=8742SilverSpring wrote:Well those nids I was finding for cswindle so I'm guessing he might have a sample on the proper usage.Viper8896 wrote:have you tried that, found out what it does and do you know what SRC means?SilverSpring wrote:If anyone's interested, found a little while ago:.....
-
- Posts: 110
- Joined: Tue Feb 27, 2007 9:43 pm
- Contact:
Oh ok, wow over 8 months ago too.crazyc wrote:http://forums.ps2dev.org/viewtopic.php?t=8742
Well at least we have the proper names now so the post wasnt completely redundant :)