Re: Calibrating Buffer Size and Count
Chris Robinson <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
On Saturday, May 29, 2010 9:28:34 pm Kip Warner wrote: > On Fri, 2010-05-28 at 13:29 -0700, Chris Robinson wrote: > > 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): > > The 4 in the divisor, is that the number of buffers one chose to > generate? It's actually how much of a second, per buffer, to fill (ie. 1/4th of a second in each buffer; 2 would be half, and 8 would be 1/8th of a second, etc). With a one-second long buffer queue, it's the same as the number of buffers to generate. > How do I determine the number of buffers to use for a stream? Do you > reckon to just hardcode it at, say, 8, and instead leave the size of the > buffers themselves as the parameter to fiddle with? It's pretty arbitrary. Generally speaking, it's probably not a problem to hard-code the buffer count (eg. 4 or 8 or so), as long as you make the buffer size flexible depending on the stream format. What I tend to do, when simplicity is called for, is hard-code the buffers to 3 or 4, and specify a buffer size of 16384 sample frames (which is multiplied by 2 or 4, depending on the decoded format, to get the byte size). This should work fine as long as the stream doesn't use a really high sample rate (like 96khz or more). > > int framesize = stream->channels * stream->bits / 8; > > BytesPerBuffer = stream->Freq / 4 * framesize; > > The 4 again in the divisor is the number of buffers chosen for the > stream? It's the same as above. How much of a second's worth of data to fill each buffer. > PS If you remember, please cc me so I get it faster than the batch mode > dispatches. Sure. Sorry about that. _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal