Hi all,

I'm developing an audio app that uses AudioTrack's MODE_STATIC to
efficiently loop through a sound sample.

Using MODE_STATIC, AudioTrack.write() to set the sample, and
AudioTrack.setLoopPoints() to loop through the sample, I'm able to
tell the hardware to simply keep looping through my sound buffer until
I tell it to stop ( either on exit or using an event )

The problem I'm running into is that if my application is *killed*, I
no longer have a way to tell that buffer to stop.  My audio code is
running in a Service (local, not remote), and the service's
onDestroy() doesn't get called on a kill - this means I have no way to
clean up this audio stream as my application goes down.

I can't find any discernable way to re-attach to that audio stream
once the service is lost, or any way to trigger it to be cleaned up
when my application dies unexpectedly.

This results in my audio continuing to loop forever after my app dies
- the only way to stop it is to reboot the phone or explcicitly kill
the mediaserver service.

I think this may be a bug as the AudioTrack binding to mediaserver
should probably be notified to 'stop' if it's caller disappears.

Does anyone have a suggestion for how I might be able to work around
this behavior and either a) somehow catch the kill and clean up my
buffers or b) re-attach the existing buffer when my app re-loads and
kill it then.   I can't seem to find a way to do either.


Thanks for any insight anyone can give

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