AndroidAudio soundPool Call problem
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
ソリューション:
優雅ではありません.
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;
}
は遅延待ちをしました.