So,
When a call comes in, I close the CFStream, call AudioQueueDispose(), and call AudioFileStreamClose(). After that my AudioStreamer() object is released. If the call is dismissed, a new AudioStreamer is created as if the song was being loaded from scratch, with a new CFStream, AudioFileStream, and AudioQueue. (Eventually I will try to restart the play from the interrupted position.)
This works until the user presses the pause button subsequent to the interruption, and then chooses to resume play: at the first AudioQueueEnqueueBuffer call (called from my PacketsProc) after resume I get the error !act. The documentation for this error says that "the function cannot act on the audio queue because it is being asynchronously disposed of." But after the interruption, this is an entirely new AQ from the one that was previously (and synchronously) dismissed.
One other note: if the pause/resume is very quick (<= 1s or 2s or so) the AudioQueueEnqueueBuffer error does not occur. It only occurs if the AQ is paused for several seconds. I am using AudioQueuePause and AudioQueueStart (w/o delay) to perform the pause and resume.
If anybody has any ideas on the cause of this error, I would much appreciate them.
Thanks,
David |