I have 3 audioQueueBufferRef to fill my audioqueue and everyting works nice when data comes fast enough. But sometimes the outputCallback ask to fill a buffer when there is no more data. In this case i don't enqueue something and the callback is no more called. (normal ?)
After a this i run with 2 buffers and later (after another lag) 1 buffer and at the very last no more buffers have callbacks resulting in no sound.
I have try to store the empty audioQueueBufferRef in a array and call them when i have data to fill. But since data don't comes fast enough, the buffer just "eat" my low amount of data that remain and the sound is laggy.
What is the best way to go when running low on data to fill ?
The best i have foun is to let the buffer just dead without callback and let the remaining buffer do the job until every buffer are empty. After this i stop the audioQueue, store some data and play again. Notice that i have to call AudioqueueStop() because when every buffer are empty and i refill them, no sound is comming out. Is this normal ?
In general does i do it the good way or is there a better approach ? And is there a callback that detect that all my audioqueueBufferRef are dead (without callback running) ? 2.