Can an AudioQueue's buffers be flushed

121 views Asked by At

I'm trying to implement a "seek" function where the user can move the playback position on a slider and have my player start playing from the new position. The problem I'm encountering is that the AudioQueue still has buffers in its queue and will keep playing them. I haven't figured out any way to tell the queue to disregard the remaining queued buffers and start playing from a new buffer I pass in. I have tried pausing (AudioQueuePause) the queue and flushing the buffers (AudioQueueFlush) but that doesn't do what I expected. Do I need to toss the old audio queue and start fresh?

1

There are 1 answers

5
Gordon Childs On

You need to restart the audio queue.

You can do this by call AudioQueueStop(audioQueue, true) and then AudioQueueStart().

The flag in AudioQueueStop() means "stop synchronously".