« Return to Thread: Why does alDeleteBuffers gives a AL_INVALID_OPERATION error?

Re: Why does alDeleteBuffers gives a AL_INVALID_OPERATION error?

by Chris Robinson-5 :: Rate this Message:

Reply to Author | View in Thread

On Saturday 21 March 2009 8:14:17 pm Martin Cote wrote:
> I'm sorry, I didn't transcript the original program properly.  I'm actually
> passing &bufferId to the alDeleteBuffers function, but I still get the
> error.
>
> I've noticed something weird though.  If I add a sleep (I used a 1 sec
> sleep) between the alSourceUnqueueBuffers and the alDeleteBuffers function,
> it works fine.  The problem only seem to occur if the delete function
> occurs too fast.

Ah, I see. Yeah, that does sound like an issue I've heard of before. For some
reason, the iPhone version of OpenAL seems to delay the actual command, as if
it was acting in another thread/process. So the Unqueue command returned and
gave you the buffer, but the buffer was not actually unqueued yet.
Unfortunately, the next command on the buffer doesn't wait for previous
commands to finish, so when you call alDeleteBuffer, it's still technically
queued on the source.

I'm not sure if this is a bug or a design decision on Apple's part, but given
the lack of alFlush/alFinish commands, it leaves the programmer in a bind
since there is no way in standard OpenAL to force previous commands to
complete or determine when they have finished. Resting can work since it gives
time for the command to finish, but it's hardly ideal.
_______________________________________________
Openal-devel mailing list
Openal-devel@...
http://opensource.creative.com/mailman/listinfo/openal-devel

 « Return to Thread: Why does alDeleteBuffers gives a AL_INVALID_OPERATION error?