android 上的 AssetManager 加载声音太慢
AssetManager loads sound too slow on android
我想使用 LibGDX AssetManager 从我的资产文件夹加载 'bang.ogg' 文件:
am.load("bang.ogg", Sound.class);
am.finishLoading();
在我的小米红米 4X 上加载这个 42Kb 的声音需要 2 分钟! Apk 大小为 2Mb。
我加载一张图片。但它在工厂中加载:
am.load("test.jpg", Texture.class);
我必须做什么?是什么导致了这个问题?
Sound implementation is that it will load the entire file into memory. According to the wiki you should not use it on Android if the file size exceeds 1MB 的问题:
note: On Android, a Sound instance can not be over 1mb in size. If you have a bigger file, use Music
您的音频小于 1MB,但使用 Music implementation allows you to stream the audio so it will not get loaded on startup but streamed while playing:
For any sound that's longer than a few seconds it is preferable to stream it from disk instead of fully loading it into RAM. Libgdx provides a Music interface that lets you do that.
我会试一试。
我想使用 LibGDX AssetManager 从我的资产文件夹加载 'bang.ogg' 文件:
am.load("bang.ogg", Sound.class);
am.finishLoading();
在我的小米红米 4X 上加载这个 42Kb 的声音需要 2 分钟! Apk 大小为 2Mb。
我加载一张图片。但它在工厂中加载:
am.load("test.jpg", Texture.class);
我必须做什么?是什么导致了这个问题?
Sound implementation is that it will load the entire file into memory. According to the wiki you should not use it on Android if the file size exceeds 1MB 的问题:
note: On Android, a Sound instance can not be over 1mb in size. If you have a bigger file, use Music
您的音频小于 1MB,但使用 Music implementation allows you to stream the audio so it will not get loaded on startup but streamed while playing:
For any sound that's longer than a few seconds it is preferable to stream it from disk instead of fully loading it into RAM. Libgdx provides a Music interface that lets you do that.
我会试一试。