[Openal] xfi issues
Xavier Bouchoux
xavier at nadeo.com
Tue Aug 28 06:50:55 PDT 2007
Xavier Bouchoux a écrit :
> hello,
> [...]
>
> And I seem to have related issues with streamming sounds. I'll
> investigate a bit further.
So the issue I have is that a source incorrectly (I think!) changes state:
- create a source
- queue some buffer
- play the source
- wait until the sources eats all its buffer
(at this point the source is AL_STOPPED)
- dequeue all the buffers
the sources changes to AL_INITIAL with the X-fi driver. (with the
software it stays "AL_STOPPED".)
I'd says by reading the spec that that the correct behaviour would be to
stay AL_STOPPED.
Additionally, If you don't empty the queue but replace the processed
buffers by fresh ones, one by one, it stays "stopped".
That is, if when the source has processed all its buffers,
you dequeue all and requeue all -> it will be in AL_INITIAL state,
whereas if
you dequeue and requeue the buffers one by one, -> AL_STOPPED
At the end of the mail is a patch for PlayStream.cpp that shows the problem.
(To be honest both issues are minor for me:
the buffer changing name only bothered me because it triggered an assert
in my code,
and this streamming issue only revealed a bug in my code, I was
refilling the buffer queue twice after a starvation...)
xavier.
@@ -104,6 +104,23 @@
iTotalBuffersProcessed = 0;
+ Sleep(3000); // starve the source.
+
+ alGetSourcei(uiSource, AL_SOURCE_STATE, &iState);
+ ALFWprintf("State before = 0x%x\n", iState);
+
+ iBuffersProcessed = 0;
+ alGetSourcei(uiSource, AL_BUFFERS_PROCESSED, &iBuffersProcessed);
+ ALFWprintf("processed buffers = 0x%x\n", iBuffersProcessed);
+ while (iBuffersProcessed>0) {
+ alSourceUnqueueBuffers(uiSource, 1, &uiBuffer);
+ iBuffersProcessed--;
+ }
+ // at this point, all the buffers are unqueued
+
+ alGetSourcei(uiSource, AL_SOURCE_STATE, &iState);
+ ALFWprintf("State after = 0x%x\n", iState);
+
while (!ALFWKeyPress())
{
Sleep( SERVICE_UPDATE_PERIOD );
More information about the Openal
mailing list