小编Ste*_*ven的帖子

Soundpool和三星Galaxy S的问题

我最近购买了三星Galaxy S,Android 2.1更新,在运行我的应用程序后,我发现一些声音效果同时播放两次.这很奇怪,因为表现出这种行为的声音效果似乎是随机的 - 在某些情况下,有些人会在其他情况下播放两次,他们将按预期播放一次.我的应用程序的任何其他硬件平台上都没有报告此错误.我在这个网站上只看到一个报道此事件的事件,并且该人转而使用MediaPlayer,但是我真的想得到一个补救措施.

当应用程序运行时,它启动Soundpool,如下所示,

public static final int SOUND_EXPLOSION = 1;
public static final int SOUND_CLEAR = 2;
public static final int SOUND_CLICK = 3;
public static final int SOUND_MAGIC = 4;
public static final int SOUND_ROCKET = 5;
public static final int SOUND_MELT = 6;

private SoundPool soundPool;
private AudioManager mgr;
private HashMap<Integer, Integer> soundPoolMap;

private void initSounds()
{   
     soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100);

     soundPoolMap = new HashMap<Integer, Integer>();

     soundPoolMap.put(SOUND_EXPLOSION, soundPool.load(getContext(), R.raw.explosion3, 1));
     soundPoolMap.put(SOUND_CLEAR, soundPool.load(getContext(), R.raw.pop, …
Run Code Online (Sandbox Code Playgroud)

android

6
推荐指数
1
解决办法
3901
查看次数

标签 统计

android ×1