[openal] Querying speaker configuration

Chris Robinson chris.kcat at gmail.com
Sat Oct 4 09:51:13 EDT 2014


On 10/03/2014 10:02 AM, Leszek Godlewski wrote:
> I was wondering why doesn't OpenAL offer any way to query the system
> speaker configuration? I need it for the sound backend of a game I'm
> working on. For the time being I'm trying to parse the config files
> ($ALSOFT_CONF, ~/.alsoftrc, /etc/openal/alsoft.conf) for the "channels" and
> "format" options with fallback to stereo, but it's an unreliable way of
> doing so.

Mainly because it's problematic. Though I can understand the utility in 
knowing whether you're playing out stereo or 5.1 when it's just being 
used as a pass-through, you get into issues when it could start 
reporting unexpected configurations. Like if an app were made and tested 
against stereo, quad, 5.1, and 7.1 systems, what is it going to do if a 
user's system suddenly has it return 6.1? And in the future, new formats 
can be added like 8-channel cube, 3D7.1 (which is sort-of-compatible 
with 5.1), B-Format, or a completely user-specified custom setup, which 
such an app would have no way to properly acknowledge or deal with.

It would quickly get to a point where all OpenAL could do is lie about 
what it is and remix the input to fit the output, putting you back where 
you are now.

It's unfortunate that SDL's audio API doesn't work that great for 
surround sound, because OpenAL really isn't designed to be a thin audio 
API wrapper. Not only does it have its own channel remixing, but it adds 
latency for real-time streams because the buffer queue is another 
buffering layer on top of the card (the system may even have its own 
latency-adding buffer in addition to that).

Though since you're rendering the audio yourself to stream, a possible 
option may be to render to something like B-Format, which is speaker 
agnostic. Unfortunately OpenAL Soft doesn't yet support B-Format buffer 
formats <https://icculus.org/alextreg/wiki/AL_EXT_BFORMAT>, but 
hopefully it will soon.


More information about the openal mailing list