I get this to work fine through something like

        audioTrack.setPositionNotificationPeriod(bufSize/8);
        audioTrack.setPlaybackPositionUpdateListener(this);

        ...

        public void onPeriodicNotification(AudioTrack track) {
                int frames = track.getPositionNotificationPeriod();
                track.write(samples, 0, frames*2);
        }

However - the callback is *Not* called from the thread that created
the AudioTrack (as it says in the documentation) but from the UI
thread, so you have to make sure you never write so you fill the
buffer or the UI thread will block.



On May 5, 10:45 am, blindfold <seeingwithso...@gmail.com> wrote:
> On May 1, 6:43 pm, Jean-Michel <jmtr...@gmail.com> wrote:> Blindfold,
>
> Yes, with the marker set at 1000 I would now *sometimes* get the
> onMarkerReached() callback, but extremely rarely (maybe once in a
> hundred one-second 8-bit mono PCM sample playbacks on my ADP, which is
> why I had not even noticed it at first). It may depend on parameter
> settings, sample length, CPU load, whatever, but for my use it is
> totally unreliable and useless. At least it proves that my coding was
> not totally wrong, or else the callback would *never* have been
> invoked. :-)
>
> I think we need some feedback from the Android Team about how
> onMarkerReached() is supposed to behave or under what conditions it
> works. Some undocumented statement order that one has to adhere to?
> Timing assumptions? By contrast, MediaPlayer's OnCompletionListener()
> works just fine for me.
>
> Thanks

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