Re: Calibrating Buffer Size and Count

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Sunday, May 30, 2010 12:39:40 pm Kip Warner wrote:
> For audio effects, probably 48 KHz files will be used. For music, they
> may end up being 96 KHz / 24-bit.

FWIW, I'd imagine most games use 44.1khz, or possibly 48khz, for music, and 
either 22khz or 44.1khz for sound effects (16-bit for each). There's nothing 
really wrong with using more, though, as long as you're okay with the 
increased memory use.

Also be aware that OpenAL doesn't support 24-bit samples. They would need to 
be converted on load to 32-bit float for use with the AL_EXT_FLOAT32 
extension, or else convert to 16-bit.

> Do you recommend having the sole
> configurable aspect being the total length of the entire buffer queue
> for a source? That way a user can select 500 ms, 1s, 2s, etc. for their
> machine and it can automatically calculate the size of each buffer
> required, given the number of hard coded buffers, bit rate, frequency,
> channels, etc..

I'd recommend that any hard-coded buffer size be specified using sample 
frames, so it can increase with higher-resolution samples (eg. multiply by 2 
for 16-bit mono, and 8 for 32-bit float stereo). But beyond that, increasing 
the number of buffers for higher sample rates should be fine. eg:

BufferBytes = 16384 * (channels*bitspersample/8);
BufferCount = max(4*samplerate/44100, 2);

So that rates above 44.1khz will use more buffers to keep from running out too 
fast (and rates below will use less, but you'll need at least two regardless).

> Very helpful and thank you. You're very knowledgeable and this is
> helping greatly as I finish up the audio component of the engine design
> for my game (https://www.avaneya.com). Actually, when the design is
> done, it would be really helpful if you were able to take a moment and
> look at just the AudioManager's UML.

You're welcome. And I can take a look at it when it's done, sure. :)
_______________________________________________
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.