Saturday, June 18, 2011

Re: [android-developers] Re: AudioTrack help - pause after mute

Below is the gist of what I'm trying. This works sometimes, but other
times I get a glitch when trying to play-- the glitch appears to be
anywhere from a few ms to 20 ms or so of the PCM data (possibly from
what it previously played, or was about to play before paused), and
immediately precedes the data that should play.

If I remove the setPlaybackHeadPosition, I don't seem to get the
glitches-- but of course then it doesn't reset to the beginning. Can
anyone suggest a better way? Is setPlaybackHeadPosition known to
cause intermittent glitching upon replay?

On init:
write(...)
setLoopPoints(100,140);

On button click:
setVolume(1,1)
play()

On release:
setVolume(0,0)
sleep(30)
pause()
setPlaybackHeadPosition(0)


On Fri, Jun 17, 2011 at 10:56 AM, Stefan Alder <twigbranch@gmail.com> wrote:
> Doug,
> I'm using MODE_STATIC as the latency is too high with MODE_STREAM.
>
> On Fri, Jun 17, 2011 at 10:38 AM, Doug <beafdefx@gmail.com> wrote:
>> Are you using stream or static mode?  With stream, you need to feed
>> the AudioTrack a stream of zeroes to get it to silence without
>> clicking.  I don't think that you can pause in stream mode, but I
>> might be wrong.
>>
>> Doug
>>
>> On Jun 15, 5:27 pm, Stefan Alder <twigbra...@gmail.com> wrote:
>>> I need to pause the AudioTrack after its volume is set to zero.  If I
>>> pause immediately after muting, there's a glitch, so I've added a
>>> sleep -- but this creates other problems and doesn't seem reliable. I
>>> still get glitches.  Is there a reliable way to do this?  For example,
>>> some sort of callback after the volume reaches 0?
>>
>> --
>> 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+unsubscribe@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment