0
0

On the iPhone simulator I am observing position values from getPosition that on average jump by 1800 samples. I use a timer to call getPosition 180 times per second, so when I log these values I see something like:

20000
20000
20000
20000
20000
20000
20000
20000
20000
21800
21800
21800
21800
21800
21800
21800
23600
23600
23600
23600
23600
23600
23600
23600
23600
…and so on.

Searching the forum tells me that positions are updated in chunks of 256 samples, but for some reason I’m not getting this resolution.
A resolution of < 1024 samples would be good enough for me, but 1800 is not. I tried FMOD_ACCURATETIME, but it didn’t help.
Does this have something to do with the fact that the simulator has no threading support?

  • You must to post comments
0
0

First some background…
You set the granularity of FMOD via System::setDSPBufferSize, by default this is 1024 x 4, which is a good safe default. This means every mix that FMOD does it pulls 1024 samples to the output. On iPhone FMOD defaults to 24KHz as the sample rate which can be set via System::setSoftwareFormat (also a good default for performance).

If the file you are playing is not 24KHz then you will not see the position changing in increments of 1024 samples, you will see it change with respect to its source rate (due to resampling). So if the file source rate was 44.1KHz you would see the ~1800 samples you are getting.

Generally it’s best to have all your source media pre-resampled to 24KHz for iPhone. This will give you a significant performance improvement at runtime for sounds which don’t adjust their pitch.

  • You must to post comments
0
0

Thanks for the explanation! I was able to get the granularity I wanted using the 2 functions. I did notice a huge performance difference between 24 and 44 Khz.

  • You must to post comments
0
0

Yes there is a large performance difference, I highly recommend you leave the sample rate at 24KHz for performance reasons. Just because the number of samples per granular chunk is larger doesn’t mean it’s more time.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.