is it possible to load more than one sound at a time if so how would i do it
do i have to load them on different chanels or what?
also is it possible to compile a sound into a c file and play it from there?
more than one sound
Yes you can have multiple sounds play on one audio channel. check out the WAVLoader software on this site http://labs.wonderbyte.com/.
That loader will load the wave files into memory so you don't need to convert it to C.
That loader will load the wave files into memory so you don't need to convert it to C.
You can simply transform binary sound data into a C table. There are some programs for that.
However, if you do this, beware, GCC compiles large tables extremely slowly. Instead of including it into a .h file, use preferably another source (.c) file, and compile it once.
You can also render your own sound stream, as emulators do. Basically, mixing of two sounds is simply an addition of both, so rendering of signed 16-bit sound data could be something like this (in an unoptimized form):
But I don't think there are any advantage doing this, except for emulators, or if you will use your own sound format or a format not supported by the PSP sound hardware, such as modules, or spc data.
Just my 2 cents ^^
Brunni
However, if you do this, beware, GCC compiles large tables extremely slowly. Instead of including it into a .h file, use preferably another source (.c) file, and compile it once.
You can also render your own sound stream, as emulators do. Basically, mixing of two sounds is simply an addition of both, so rendering of signed 16-bit sound data could be something like this (in an unoptimized form):
Code: Select all
void RenderSound (s16 *soundbuffer, s16 **voicesdata, u32 streamoffset, u32 streamsize)
{
u32 i, curstreamdata;
s32 curdata;
//We must render a certain number of 16-bit values for each frame (streamsize). At each frame, the offset of each voice data is incremented (from streamsize), but data are always written to the same location (soundbuffer).
for (curstreamdata=0; curstreamdata<streamsize; curstreamdata++)
{
curdata = 0;
//Add together the current 16-bit value from each voice
for (i=0; i<NUMBER_OF_VOICES; i++)
{
//Here, no sound decoding, just plain copy
curdata += voicesdata[i][curstreamdata+streamoffset];
}
//Verify if there is an overflow
if (curdata > SIGNED16_MAX_VALUE)
curdata = SIGNED16_MAX_VALUE;
if (curdata < SIGNED16_MIN_VALUE)
curdata = SIGNED16_MIN_VALUE;
//Copy it next to the buffer
*soundbuffer++ = curdata;
}
}
Just my 2 cents ^^
Brunni
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released