[Openal] Software premixing
niklas at grin.se
Mon Oct 24 00:34:12 PDT 2005
I have some (at this stage) rather vague ideas about using software
premixing to be able to play more sounds given a limited number of
sources. Specifically, I am thinking about premixing all 2D (stereo)
samples into one stream (since I have a fair number of those and they
should be easy to mix in software) while leaving the 3D sounds at one
sound / source.
However, I have some concerns:
1) To do this, many of the nice things and standard practices of OpenAL
have to be bypassed. I have to keep the sounds in application memory
instead of in OpenAL buffers. I have to do ADPCM decoding and frequency
matching myself, etc. (The same problem arises if I want to do
on-the-fly DSP processing on the sounds.)
2) If the user has a software device, all of this extra work is
pointless, because I will only be duplicating what the software device
already does. With hardware devices, I don't know, I guess it is
possible that some hardware devices already premix their stereo sources,
while others don't.
At any rate, it seems a waste to hand code my own mixer and introduce
the complexity of having several different mixing systems, with
different kinds of input (system memory vs OpenAL buffers) when there
are already perfectly good mixers (hardware and software) in OpenAL.
As I said before, my thoughts are rather vague at this stage, but some
of the things I would like to know are:
- Has anyone used premixing in an OpenAL based sound engine? What did
you do? What were the results? Were you happy with them?
- Is there any point in premixing stereo sounds for hardware devices or
do they already premix stereo sounds internally?
- Are there any plans for supporting premixing in OpenAL -- i.e. playing
several buffers on a single source?
- Will it be (or is it in fact already) possible to chain OpenAL
devices. I. e. use one OpenAL devices to mix sources into a buffer which
is then played on a second OpenAL device. (Much as you would use
render-to-texture to achieve special effects in OpenGL.)
More information about the Openal