great initial delay on android

Hi,

I’m developing a cross-platform game using cocos2dx and FMOD.
No problem on iOS, but on android I got some troubles: in the first place I was using my original FMOD Studio bank with Vorbis compression (about 25 MB), but the slightest drop of frame rate caused heavy stuttering, and latency occurred already, making the tween of System::setDSPBufferSize and System::setSoftwareFormat kind of pointless.

Since you suggest to use FADPCM as primary compression format for android, I gave it a try and, as a matter of fact, latency has been decreased and the stuttering had been drastically reduced (but sadly, still present sometimes).

But now I have a new major issue: sounds start to be played with a great delay after the launch of the app. This delay time varies between sound events, but, for example, the background music track starts after about an entire minute!

At the very beginning of the application I load the banks (with the FMOD_STUDIO_LOAD_BANK_NORMAL option) and, just after that, I call the loadSampleData() method on them. I suppose that, considering that FMOD runs on its own thread, the loading of the banks is not stopping the main thread, so maybe I need to wait for the banks to be loaded, but I didn’t find a callback for that.

Any idea or suggestion about this delay? My new FADPCM bank is 52 MB. Is it too large?

Thanks in advance

loadSampleData does indeed occur on one of our threads, you can query the progress of the loading with Studio::bank::getSampleLoadingState.

Once loaded the events should play instantly.

FADPCM has a fixed 3.66:1 compression ratio so it will produce larger banks, but has very good decoding performance compared with Vorbis on mobile devices.

1 Like

I did already use that method, but it seems that I made some mistake, because it used to return always LOADED state. My fault!

Anyway, now I can properly wait for loading completion on my loading screen.

Nevertheless, I had to split my single bank into multiple context-based banks, in order to reduce and spread the large amount of loading time. Unfortunately, as a result the total size of the banks is much larger than the original single one, due to some sound duplications.

But now the situation is greatly improved!

Thanks again!