// Is the buffer empty?
alGetSourcei(uiSource, AL_BUFFERS_QUEUED, &iQueuedBuffers);
if (iQueuedBuffers == 0)
{
// Fill all the Buffers with decoded audio data from the OggVorbis file
for (iLoop = 0; iLoop < PS_NUM_BUFFERS; iLoop++)
{
ulBytesWritten = DecodeOggVorbis(&sOggVorbisFile, pDecodeBuffer, ulBufferSize, ulChannels);
if (ulBytesWritten)
{
alBufferData(uiBuffers[iLoop], ulFormat, pDecodeBuffer, ulBytesWritten, ulFrequency);
}
}
alGetError();
alSourceQueueBuffers(uiSource, PS_NUM_BUFFERS, uiBuffers);
ALenum err = alGetError();
}
// Start playing source
alSourcePlay(uiSource);
I'm using XCode 4 (10.6 SDK) I get an error code "-50" after alSourceQueueBuffers.