If I call the following :
sound = Gdx.audio.newSound(Gdx.files.getFileHandle("sound/bullet.mp3",
FileType.Internal));
Followed by:
sound.play();
Play the sound does not come out, wait for a while and then play is OK!
The reason is not yet fully loaded resources
Under Will this have a good solution? Thank you
解决方案:
不是很优雅。
private long waitForLoadCompleted(Sound sound) { long id; while ((id = sound.play(0)) == -1) { long t = TimeUtils.nanoTime(); while (TimeUtils.nanoTime() - t < 100000000); } return id; }做延时等待了 。