I am getting warning "AudioQueueObject::FreeBuffer: AQBuffer * 0x6273fd0 has enqueue count of 1" for API AudioQueueFreeBuffer... How to avoid this warning?
I am getting this warning in AudioQueueFreeBuffer API
for (int i = 0; i < kNumberBuffers; ++i) {
if(mAudioInfo.mBuffers[i] != NULL)
{
AudioQueueFreeBuffer(mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);
mAudioInfo.mBuffers[i] = NULL;
}
XThrowIfError(AudioQueueAllocateBuffer(mAudioInfo.mQueue, mBufferByteSize, &mAudioInfo.mBuffers[i]), "AudioQueueAllocateBuffer failed");
AQTestBufferCallback (&mAudioInfo, mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);
if (mAudioInfo.mDone) break;
}
This occurs when you attempt to call AudioQueueFreeBuffer() on a buffer that has been enqueued in an AudioQueue that is running. You should call AudioQueueStop() on the associated AudioQueue before attempting to free the buffers.
The doc's for AudioQueueFreeBuffer() say:
Call this function only if you want to dispose of a particular buffer while continuing to use an audio queue. You can dispose of a buffer only when the audio queue that owns it is stopped (that is, not processing audio data).
Try this:
for(int i = 0; i < NUM_BUFFERS; i++)
{
AudioQueueFreeBuffer(playState.queue, playState.buffers[i]);
}
AudioQueueDispose(playState.queue, true);
AudioFileClose(playState.audioFile);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With