Hi all!
Here is my code:
public static final int SOUND_CLICK = 1;
public static final int SOUND_DEATH = 2;
public static SoundPool soundPool;
public static HashMap<Integer, Integer> soundPoolMap;
...
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100);
soundPoolMap = new HashMap<Integer, Integer>();
soundPoolMap.put(SOUND_CLICK, soundPool.load(Context, R.raw.click,
1));
soundPoolMap.put(SOUND_DEATH, soundPool.load(Context, R.raw.death,
1));
...
public static void playSound(int sound)
{
AudioManager mgr = (AudioManager)Context.getSystemService
(Context.AUDIO_SERVICE);
int streamVolume = mgr.getStreamVolume
(AudioManager.STREAM_MUSIC);
soundPool.play(soundPoolMap.get(sound), streamVolume,
streamVolume, 1, 0, 1f);
}
After loading this sounds I'm waiting few seconds and than start
playing them. Usually all is fine, but sometimes one of this sounds
( even both ) just disappear.
What's the problem with it?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---