I've been perplexed by the AudioRecord documentation on the
OnRecordPositionUpdateListener interface but I think I got it figured
out. All of the posts in this group asking why the callbacks are never
called were assuming that the callbacks would tell you when to do a
read. But what you need to be doing is reading at the same time as you
have callbacks.

Setting up a listener with setPositionNotificationPeriod will cause
the callback to be called every time you get that many frames read.
Setting up a listener with setNotificationMarkerPosition will cause
that callback to be called whenever you first get to that many frames
total. Let's say you start a thread that loops on your AudioRecord,
reading 1000 frames at a time. You could get periodic callbacks every
2500 frames, or you could get a marker callback after 100,000 frames.
If you're not reading, you won't trigger callbacks. So don't do the
reads in your callbacks. Use the callbacks to trigger other actions.

I'm pretty sure I'm right about this, but if someone wants to chime in
with corrections, please let us know.

- dave
www.androidbook.com

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