I'm adding sound into my game now and need the ability to have sound
effects concurrent (like 2 of the same explosion playing at the same
time, etc) so using the MediaPlayer is less than optimal for me. I was
thinking of just adding a traditional sound update into the main loop
which would probably work and isn't _that_ hard to write but I don't
think I have access to the decoder and sound buffer.

I found a class called SoundPool that appears to be suited for exactly
what I'm trying to do however the documentation is very weak -
http://code.google.com/android/reference/android/media/SoundPool.html

Has anyone used this with success? If so, could I see a little code
snippet?

I tried this:
Java:

          private void initSounds() {
               // 4 streams
               // stream type 3 is music
               soundPool = new SoundPool(4, 3, 100);
               int explosionSound = soundPool.load(getContext(),
R.raw.explosion, 1);
               soundPool.play(explosionSound, 100, 100, 1, 0, 1);
          }


but it didn't appear to do anything. I didn't get errors but I also
heard no sound. Perhaps I need to configure something for the emulator
to work like that?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to