问题描述
我试图用GDX-音频扩展,但我有麻烦解码MP3文件。它的工作原理,但速度很慢! 10秒的文件正在6.57秒脱code :(这里是方法:
I'm trying to use the gdx-audio extensions, but am having trouble decoding mp3s. It works, but very slowly!! A 10-second file is taking 6.57 seconds to decode :( Here is the method:
public void decode() {
Mpg123Decoder decoder = new Mpg123Decoder(externalFile);
short[] sampleArray = new short[1024];
// read until we reach the end of the file
while (decoder.readSamples(sampleArray, 0, sampleArray.length) > 0) {}
}
谁能告诉我这是为什么要花这么长时间?
Can anyone tell me why this is taking so long?
推荐答案
由于libmpg123是一个软件去codeR,这并不在CPU上的所有工作。根据你所拥有的CPU,你通常只能得到2倍的实时解码。我们没有太多启用ARM汇编在我们libmpg123构建,可以帮助它加速了一点,但通常不是。
Because libmpg123 is a software decoder, that does all the work on the CPU. Depending on what CPU you have, you usually only get 2x real-time decoding. We haven't enabled ARM assembly in our libmpg123 build, that could help speeding it up a little, but usually not by much.
这篇关于为什么本土libmpg123这么长时间在Android上libgdx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!