« Return to Thread: Problem with alSourceUnqueueBuffers

Re: Problem with alSourceUnqueueBuffers

by Luis-33 :: Rate this Message:

Reply to Author | View in Thread

Hi qartar. First of all, how big are your buffers? They might be too small. Also, from what I see, you are only unqueuing a single buffer per iteration, even if count is indicating more than one buffer processed. You should unqueue and refill every processed buffer in each loop iteration, else your source is going to run out of audio data quickly. Hope that helps :)
By the way, is there any reason not to be using buffers in a circular way?

Cheers!

On Wed, Jun 3, 2009 at 6:36 AM, qartar <qartar@...> wrote:

I am trying to implement a streaming sound engine with OpenAL by uploading
small blocks of sound data into buffers as needed instead of the entire
sound at once. Doing this requires a lot of buffers queued onto one source
so I tried to reuse processed buffers when available instead of creating a
new buffer for each block of data. The update loop looks something like
this...

alGetSourceiv( source, AL_BUFFERS_PROCESSED, &count );

if ( count ) {
       alSourceUnqueueBuffers( source, 1, &buffer );
} else {
       alGenBuffers( 1, &buffer );
}

alBufferData( buffer, ... );
alSourceQueueBuffers( source, 1, buffer );

It seems that whenever I use alSourceUnqueueBuffers the source is stopped or
otherwise no longer plays the data queued. This causes any sounds longer
than the initial few buffers (about two tenths of a second worth) to stop or
fail to play entirely. Even if not using the buffer from
alSourceUnqueueBuffers  or calling alSourcePlay afterwards the problem
persists. No errors are being generated. This problem can be circumvented by
not calling alSourceUnqueueBuffers and generating new buffers for each sound
segment.

The questions I have are, is there a significant performance gain from
uploading one buffer per source as opposed to uploading segments at a time?
Is there some functionality of alSourceUnqueueBuffers that I am missing
which is causing this problem?
--
View this message in context: http://www.nabble.com/Problem-with-alSourceUnqueueBuffers-tp23845230p23845230.html
Sent from the OpenAL - User mailing list archive at Nabble.com.

_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal



--
Luis

_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal

 « Return to Thread: Problem with alSourceUnqueueBuffers