[Openal-devel] Streaming issues

LT ltmt2k at gmail.com
Fri Mar 9 19:22:25 PST 2007


Is there a way to poll to see if a buffer is in use or not?
I took a peek into AL.h, and saw:
/** * Buffer state.  * * Not supported for public use (yet). */
#define AL_UNUSED                                 0x2010
#define AL_PENDING                                0x2011
#define AL_PROCESSED                              0x2012

Which (I think) is what I need, since what I am trying to do now, is
not working out very well.  I get very distorted sound.

What I am trying to do is to stream memory buffers to openAL.
I set up 20 buffers, (	alGenBuffers( NUMBUFFERS, uiBuffers );) then
start feeding the buffers, ( alBufferData((...) ), and then doing
alSourceQueueBuffers(...).
The data size can be as low as 256 bytes, up to a max of 32k bytes,
depending on the codec.  If it is 256, then each read is also 256
bytes, never more, maybe less when reach the end of the video.
I then check alGetSourcei(uiSource, AL_BUFFERS_PROCESSED,
&iBuffersProcessed); to see if any buffers are 'processed/done', and
if so, I unqueued them.  I check alGetError() before & after all
openAL calls just for testing now, to make sure it wasn't a error
above the call I am doing now.

However, I then get some AL_INVALID_OPERATION(0xA004) messages on
alBufferData() call, which is not listed in the SDK for a proper
return?

Assuming it is supposed to be AL_INVALID_VALUE(0xA003), then I know
the data is of the same type/frequency/samples & size, so the only
other thing according to the SDK is "The size parameter is not valid
for the format specified, the buffer is in use, or the data is a NULL
pointer."  That leaves the buffer is in use, but  it was the buffer
returned back from  alSourceUnqueueBuffers(uiSource, 1, &uiBuffer).

I then tracked the array myself, using another array, and marking it
used if I would use it in alSourceQueueBuffers(), and then free it
when alSourceUnqueueBuffers().

This resulted in :  (nodes is just my array that tracks the buffers)
nodes[00] = free    nodes[01] = used nodes[02] = used  nodes[03] = used
nodes[04] = used  nodes[05] = used  nodes[06] = used  nodes[07] = used
nodes[08] = free    nodes[09] = free   nodes[10] = free   nodes[11] = free
nodes[12] = free   nodes[13] = free   nodes[14] = free   nodes[15] = free
nodes[16] = free  nodes[17] = free  nodes[18] = free  nodes[19] = free
~~~~~~done dump~~~~
Using buffer  nodes[00]..
AL_INVALID_OPERATION call -->alBufferData : [0] (size=8144 bytes)
[uiBuffers[0] is the translation]

I should mention that I followed the SDK playstream sample program,
but I do *NOT* fill up all buffers at once.  I just can't do that with
the media I am streaming in, I just get the audio data when available,
then proceed to load it into a buffer.  At max, it loads 1 buffer up
per main loop, then checks if it is being processed, and if not, then
add another buffer.
I then thought maybe the queue used by openAL was moving entries
up/down in the array, where once something is "processed", it moves
the other entries in the array up (or down) but that isn't documented
I don't think, so I didn't account for that.

This is on windows XP, with onboard audio (Nvidia chipset).

So I dunno what to do to fix this issue?
Ideas?


--Jake.
p.s the repository is also down. :(


More information about the Openal-devel mailing list