I’m trying to benchmark the number of concurrent sounds I can play on the iPhone and right now, the figure worries me a bit.
Without any audio playing, the profiler shows 4% CPU consumption (3.3% DSP). This is already too expensive for a game.
With 7 sounds (IMA-ADPCM from separate fsb files) the consumption in DSP is up to 17.5% for a total of 18.5%. The same occurs in regular PCM.
Of course, this means my sounds are being played back in software, however, is there a way to play stuff in hardware on the iPhone? If there is, can you tell me what kind of setup you would advise?
Also, I want to be using DSP effects on my sounds. If adding effects on hardware sounds isn’t possible, I could play some in software and leverage some nice results this way.
- fredsifu asked 8 years ago
mono output wouldnt really save you anything (and i’m not even sure if we support this i’ll have to verify it) but yes lowering the output rate is the best way to increase performance, at the sacrifice of quality.
First thing though is I would recommend turning off interpolation, or matching your samples to the same rate as the output rate, so that they are not resampled at all, saving cpu time.
You seem to be under the assumption that the iphone has any hardware at all for sound. It doesnt. It has to be software mixed.
If you lower the output rate it will improve performance. I’m fairly sure we benchmarked at 22khz about 10% for 32 pcm sounds, so you might have to show how you got those numbers. I assume you’re not playing them as streams and are instead playing them as in memory samples?
3% for sound is not too expensive, the usual use in a game for audio is between 5 and 10% from our experience with past titles.
I was indeed under the assumption there was hardware decoding but you’re right, there isn’t.
Now, here is my setup, starting with data layout:
26 looping samples 44100Hz, stereo, PCM16 wave files loaded in memory.
I tried both pure PCM16 and IMA encoding. I forgot to use the FMOD_CREATECOMPRESSEDSAMPLE flag for the profiling figures in my first post. After a recompile, the % increased to about 32% for the DSP for 7 sounds.
Here’s how I initialize the system:
I set the software mixer to 44100Hz, PCM16, 2 output and 2 input channels and linear resampling.
System is inited in normal and enable profile mode, with 1000 channels available.
For the 4% consumption comment I made, sorry, I guess I’m too used to hardware helping out.
In any case, thanks for helping out.
- fredsifu answered 8 years ago
Please login first to submit.