[Openal] Typical settings for streaming sources
Nolan Darilek
nolan at thewordnerd.info
Wed Oct 11 08:28:19 PDT 2006
I'm writing an Ogg Vorbis streamer and am noticing some odd behavior.
My sources would mysteriously stop, despite the fact that data should
have been continuously buffered. I scaled up the buffer size from
4096*4 to 4096*32, but that only seemed to postpone the inevitable
stoppage. I added code to my buffer update routines, and saw that the
buffers were getting cycled in order. The streamed source is never
assigned to without using alQueueBuffers(), and nothing in my code
should be stopping it. I noticed that when I placed an AL_STOPPED
check in the code, the source would be restarted once and would then
be fine. Similarly, if I removed this check, then did something in my
game to make the source start again (I.e. pausing gameplay then
resuming, which stops/restarts game music) then it would continue
cycling the queue as normal. I added debug printlns to display the
interval in seconds since the last update, and this didn't reveal any
particularly longer update times, all at around 0.03 seconds. I also
inserted checks around areas in my code that stop sounds for whatever
reason, but nothing was triggered. I also ensured that reads from the
file were getting a full load on each buffer queue, and they were.
First and foremost, are there any "well, duh" factors that I might be
missing? :) I think I've checked everything, but I may not habe.
Second, what streaming settings are typical for a 3-D game, if such
"typical" values can be said to exist? :) The various streaming
examples I've seen seem to use two buffers of size 4096*4. I seem to
have just gotten it to work by changing the number of buffers from 2
to 3, even with the smallest size of 4096*4. It also seems as if the
flow of data through the stream is more steady--that is, my debugging
code always shows 1 buffer as needing filled at a time, whereas
befire it'd show 1 needing filled, 0 for a couple more frames then 2
as the source showed as being stopped. The jump from 0 to 2 without a
significant time interval and even with a large buffer size seemed
odd to me.
I suppose I should be happy about whatever works, but I'm wondering
if this deviation from what I've read to be "normal" is indicative of
a defect in my underlying streaming logic. Am I missing something? Or
is it common to have to tack on more buffers/use buffers of 128K or
more of PCM data when streaming Vorbis samples?
More information about the Openal
mailing list