Re: Calibrating Buffer Size and Count

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Friday, May 28, 2010 12:14:47 pm Kip Warner wrote:
> Thanks Chris. What about the size of the individual buffers? How do you
> determine how large they should be? I see the term "frame size" and
> "buffer size" used in a couple places and I'm not sure what the
> difference is.

A "frame size", in this case, is the size of a single sample multiplied by the 
channel count (ie. channels * bits / 8; which would be 4 for 16-bit stereo, or 
1 for 8-bit mono, for example). A "buffer size" would be the size of a given 
buffer (typically in bytes, but sometimes it may be measured in frames or even 
time).

So, for instance, you would generate 4 to 8 buffers, and fill them each with 
frequency/4*channels*bits/8 bytes (where frequency, channels, and bits are 
taken from the stream data format that's given to OpenAL):

int framesize = stream->channels * stream->bits / 8;
BytesPerBuffer = stream->Freq / 4 * framesize;

When queued onto a source, the buffers should give a total play time of one to 
two seconds before it all runs out, and approximately 1/4th of a second 
between each buffer.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.