nitlang / nit

Nit language
http://nitlanguage.org
Apache License 2.0
239 stars 65 forks source link

Android / sound: the fist sound.play does not play #1728

Open privat opened 8 years ago

BlackMinou commented 8 years ago

can't reproduce :(

xymus commented 8 years ago

I've encountered this issue in sputnit. It looks like the lazy loading is not viable on Android. The sound is loaded in the background, so a play right after loading from the SoundPool may not yet have data available. The SoundPool Java doc says something about that:

[SoundPool.load()] should typically be done early in the process to allow time for decompressing the audio to raw PCM format before they are needed for playback.

There's a workaround, explicilty load all sounds at on_create: https://gitlab.com/xymus/sputnit/commit/521071af1d0