问题
What is difference between Sound and Music types in LibGDX? This worked both on desktop and Android:
Music gameMusic = Gdx.audio.newMusic(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();:
Sound gameMusic = Gdx.audio.newSound(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();
回答1:
Music is streamed, while Sound is loaded into memory. (Because Android with libgdx has limit of 1mb file for 'sound', Music can be of greater size)
It is said so here:
https://github.com/libgdx/libgdx/wiki/Sound-effects
https://github.com/libgdx/libgdx/wiki/Streaming-music
And according to another question on SO, you must wait a frame before you can play a Sound directly after loading: No Sound in Android Application with Libgdx
来源:https://stackoverflow.com/questions/24305630/whats-the-difference-between-libgdx-sound-and-music-types