PositionableAudioSource sending setPos (0)


#1

I have a PositionableAudioSource linked to an AudiotransportSource. It is set to resample.

When I want to pause the source, the PositionableAudioSource gets a setPosition(0), followed by two other setPos(+buffer), setPos(+buffer). In my case:

setPosition(0); - block is read
setPosition(2048); - block is read
setPosition (4096); - block is read.

This is regardless of what the position was at just before the pause, which I do by setting the samplerate to zero. After that, as expected, there’s no reads.

When I start again, I see the same three position/read calls, starting from zero, then the position jumps to the correct sample position - whatever we left of at.

The problem seems to crop up in bool BufferingAudioSource::readNextBufferChunk(), where nextPlayPos is 0, and increments from there a few times.

Any clues? Is there no example of a controlled playback audio chain?

Bruce


#2

Sounds like there’s a bit of logic somewhere doing some pre-buffering from the wrong start position…


#3

isPlaying returms false, so I use that. I hope it’s safe to use it in the audio thread.