Actually what you described is exactly how I handle the audio in this
app. It's a video poker app but I preload all sounds and even on
payout sounds of the coins dropping I load 4 instances of it so they
can overlap while the game is in that mode. What I found was after 3
seconds of no audio at all the audio system goes to sleep. While I
would see in the log a message about xx millsecond delay on startup
again -- generally less than 100mseconds I still had the problem with
the sound I immediately tried playing to 'queue' instead of actually
playing...

On Jun 29, 2:13 pm, Paul Kilgo <[email protected]> wrote:
> On Sat, Jun 27, 2009 at 3:08 PM, Baratong <[email protected]> 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 [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