Hello, all ...
I am having a hard time getting this to work well. I'm streaming / playing an MP3 from a server, and some things i'm seeing with Core Audio are confusing me, so i've questions. If anyone could answer them and provide some insight, i'd be very appreciative!
1. When is kAudioQueueProperty_isRunning set? Is it set when there are no more buffers to play, or after I call AudioQueueStop()?
2. I'm using an NSURLConnection to talk to the server, and I have the receivedData calling AudioFileStreamParseBytes(). When I get the message that the NSURLConnection finished loading, does it follow, then, that there is no more data from the NSURLConnection to send to the audio queue? I ask this because the very end of the song still gets cut off, and i've tried calling AudioQueueStop() with true as well as false, as well as waiting for the kAudioQueueProperty_isRunning property to be set. No matter what i've tried, the end of the song is almost always cut off, which makes me wonder ...
3. How _exactly_ does the boolean parameter for AudioQueueStop() work? The documentation seems to say that setting it to true makes the call synchronous i.e. it won't return until the audio queue has played (and thus emptied) all of its' buffers. If I set it to false, the documentation seems to say that it's async, and I need to wait for the kAudioQueueProperty_isRunning property to be set to false. Is this correct, or am I confusing this boolean param with this property?
It's maddening. This doesn't seem like it would be a hard problem to solve, but it continues to vex me. All I want to be able to do is play a stream from a server, and be able to stop the playback at any time in order to play another stream, without it locking up or pieces of earlier streams playing before the new stream is played, yet I somehow can't seem to get it to work reliably at all.
Regards,
John
Falling You - exploring the beauty of voice and sound
|