AudioQueueFreeBuffer Warning

I get the warning " AudioQueueObject :: FreeBuffer: AQBuffer * 0x6273fd0 has 1 queue " for the AudioQueueFreeBuffer API ... How to avoid this warning?

I get this warning in the 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; } 
+7
source share
2 answers

This happens when you try to call AudioQueueFreeBuffer () in a buffer that was set in a running audio course. You must call AudioQueueStop () in the appropriate audio course before attempting to free the buffers.

The document for AudioQueueFreeBuffer () will say:

Call this function only if you want to get rid of a specific buffer while continuing to use the audio queue. You can only get rid of the buffer when the audio queue to which it belongs is stopped (that is, not processing audio data).

+2
source

Try the following:

 for(int i = 0; i < NUM_BUFFERS; i++) { AudioQueueFreeBuffer(playState.queue, playState.buffers[i]); } AudioQueueDispose(playState.queue, true); AudioFileClose(playState.audioFile); 
+1
source

All Articles