I just began learning about AudioQueues from the CoreAudio book (rough cuts).
I did the AudioQueue playback example tutorial, which is basically the same as the apple tutorial example. Everything is working fine.
The problems start when I try to implement the code in an app with a GUI. I tested it by pasting the code into the 'init' method of a NSObject subclass. The only way I can get the queue to do the callback is by inserting an empty DO...WHILE loop in the end of my init, but that makes the GUI freeze (obviously...)!!
I studied the Speak Here example, and tried to find a loop of some kind or a CFRunLoopRunInMode but, it basically looks like everything just works as soon as AudioQueueStart is called... Is this stuff working in a different way on the iOS (compared to OSX)?
Clearly, there is something fundamental that I don't understand about how things work...
Kasper
@implementation KWPlayer
-(void) start
{
CheckError(
AudioQueueStart(queue, NULL),
"AudioQueueStart failed");
printf("Playing...\n");
do {
} while (0 == 0); WHY IS THIS MAKING IT PLAY???
}
@end