Android SoundPool向每个用户的日志文件抛出错误



我正在使用SoundPool在我的android应用程序中播放一些音效。声音似乎工作得很好,但我在我的LogCat显示器上收到了以下错误

E/AudioTrack: AudioTrack ctr
E/AudioTrack: start 0x2e6068
E/AudioTrack: Underrun user: 0, server: 0, flags 0003
E/AudioTrack: AudioTrack dtor
E/AudioTrack: stop 0x2d4348
E/AudioTrack: Underrun user: bd00, server: bd00, flags 0002
E/AudioTrack: stop 0x2e6068

声音仍在播放,但偶尔应用程序会崩溃。

代码片段soundPool:

private void setupSounds() {
    soundPool = new SoundPool(100, AudioManager.STREAM_MUSIC, 100);
    soundPoolMap = new HashMap<String, Integer>(16);
    // Add all note references into a hashmap with the string that will be attached
    soundPoolMap.put("LOWC", soundPool.load(getContext(), R.raw.lowc, 1));
    soundPoolMap.put("LOWD", soundPool.load(getContext(), R.raw.lowd, 1));
    soundPoolMap.put("LOWE", soundPool.load(getContext(), R.raw.lowe, 1));
    soundPoolMap.put("LOWF", soundPool.load(getContext(), R.raw.lowf, 1));
    soundPoolMap.put("LOWG", soundPool.load(getContext(), R.raw.lowg, 1));
    soundPoolMap.put("LOWA", soundPool.load(getContext(), R.raw.lowa, 1));
    soundPoolMap.put("LOWB", soundPool.load(getContext(), R.raw.lowb, 1));
    soundPoolMap.put("LOWZ", soundPool.load(getContext(), R.raw.lowz, 1));
    soundPoolMap.put("MIDDLEC", soundPool.load(getContext(), R.raw.middlec, 1));
    soundPoolMap.put("MIDDLED", soundPool.load(getContext(), R.raw.middled, 1));
    soundPoolMap.put("MIDDLEE", soundPool.load(getContext(), R.raw.middlee, 1));
    soundPoolMap.put("MIDDLEF", soundPool.load(getContext(), R.raw.middlef, 1));
    soundPoolMap.put("MIDDLEG", soundPool.load(getContext(), R.raw.middleg, 1));
    soundPoolMap.put("MIDDLEA", soundPool.load(getContext(), R.raw.middlea, 1));
    soundPoolMap.put("MIDDLEB", soundPool.load(getContext(), R.raw.middleb, 1));
    soundPoolMap.put("MIDDLEZ", soundPool.load(getContext(), R.raw.middlez, 1));
}

这是我播放声音的地方

soundPool.play(soundPoolMap.get(getSoundFromHashmap(xPos, yPos)), Constants.VOLUME, Constants.VOLUME, 1, 0, 1f);

从我读到的内容来看,这似乎是正确的代码,所以我被难住了。任何想法都将不胜感激。

好吧,我已经测试这个应用程序大约一个月了,这个错误从未导致过异常或任何类型的崩溃。看起来这几乎就像是调试信息被喷到日志文件中,但我不认为这是一个问题。现在我称这件事已经解决了。

最新更新