简体   繁体   English

Android SoundPool抛出错误以在每个用户上记录文件

[英]Android SoundPool throwing errors to log file on each user

I'm using SoundPool to play a few sound effects in my android app. 我正在使用SoundPool在我的android应用中播放一些音效。 The sounds seem to work really well, but I'm getting the following errors posted to my LogCat display 声音似乎工作得很好,但是我将以下错误发布到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

The sounds are still playing, but occasionally the app is crashing. 声音仍在播放,但有时应用程序崩溃。

Code snippet 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));
}

And here's where I'm playing the sound 这是我播放声音的地方

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

From what I've read, this seems like the correct code, so I'm stumped. 从我阅读的内容来看,这似乎是正确的代码,所以我很困惑。 Any ideas would be appreciated. 任何想法,将不胜感激。

Well, I've been testing this app now for about a month and not once has this error caused an exception or any kind of crash. 好吧,我已经对该应用程序进行了大约一个月的测试,而且没有一次该错误导致异常或任何类型的崩溃。 Looks like it's almost like debug information being spewed into the log files, but I don't think it's a concern. 看起来几乎像是将调试信息喷入了日志文件,但我认为这不是问题。 For now I'm calling this solved. 现在,我称此解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM