[openal] Querying speaker configuration

Chris Robinson chris.kcat at gmail.com
Tue Oct 7 04:45:17 EDT 2014

On 10/07/2014 01:00 AM, Richard Furse wrote:
> What's the issue here? Is this the case where there are pre-rendered
> surround assets and the upstream code wants to choose the right one
> for the speaker configuration?

In this case, the game audio is being rendered internally in real-time 
(using a customized version of FMOD's software renderer), and its OpenAL 
backend is used to play the mix to avoid having to code for specific 
sound systems. For this situation, the game would ideally render the 
audio using the same configuration OpenAL is using for output, so it 
acts as close to a pass-through device as it can (e.g. if OpenAL has 5.1 
output, the game's audio would be internally rendered to a 5.1 stream 
and played through a typical source buffer queue using 
AL_FORMAT_51CHN16/32; each input channel would then go to a matching 
output channel). If OpenAL's output configuration is not understood, it 
could just pick a fallback format and let OpenAL up-/down-mix it as needed.

In some cases there are secondary streams played which OpenAL will need 
to mix too, but the majority of the audio is mixed and rendered internally.

This is a non-ideal use-case for OpenAL, I know, but for cases like this 
where that's not really possible (it'd be quite a bit of work to fully 
replace FMOD), it can be useful to know the output configuration.

> BTW, just an instinct, and without looking at the source, the
> conversation about 5.1 and stereo assets killing each other sounds
> like a classic "=" which should be a "+=" on a bus. I'm probably
> wrong, but thought I should mention it in case ;-)

Yeah, I'm not sure where that could happen, though. The actual mixer 
(where the samples are added together) is the same for all inputs, be it 
mono, stereo, or whatever (each input channel is processed individually, 
using a set of gains for corresponding output channels). That it works 
with two stereo streams, but not a stereo stream and a 5.1 stream, 
suggests to me it's something wrong with the input.

More information about the openal mailing list