On Sat, Jun 27, 2009 at 3:08 PM, Baratong <pwalter...@gmail.com> wrote:

>
> What I ended up doing was this:
> 1. Use Audacity to create a 1-second .wav of total silence and add the
> wave into my manifest as a raw resource referenced in the app as
> R.raw.silence.
> 2. On startup, create a MediaPlayer instance, load the R.raw.silence
> resource and play in a loop constantly.
>
>
I'm new to the SDK and I did have some troubles with sounds, but I found
what worked for me was to load all the sounds (at least the ones that will
be used frequently) into their own MediaPlayer object using
MediaPlayer.create(). Set each of the MediaPlayer objects to have an
OnCompletionListener() to call MediaPlayer.seekTo(0) to reset the sound. You
could extend the idea to store a bunch of MediaPlayer's in a hashmap if your
situation called for it.

Using this method I haven't really seen much latency at all in my sound
effects. Does this method still cause the audio system to fall asleep during
disuse? I didn't notice much at all.


-- 
--Paul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to