[openal] 5.1 and 7.1 speaker setups

Ian Reed support at blindaudiogames.com
Mon Feb 6 14:04:13 EST 2017

Thanks again for the in depth explanation.

Our goal was to give users a menu where they could select headphones, 
stereo speakers, 5.1 speakers, and 7.1 speakers.
It sounds like we should just give them an option to enable or disable 
HRTF when using headphones and let OpenAL Soft do its thing otherwise.
I am very glad to hear OpenAL Soft ensures that a user still hears 
everything when the input and output formats don't match.

I have another question.
I have a 5.1 speaker system connected to my computer.
My default playback device is called:
Speakers; Realtek High Definition Audio
It will play through those speakers, or through my headphones when I 
plug them into a 3.5mm jack.
Starting OpenALSoft while my headphones are connected does not seem to 
detect that I am using headphones (since it does not enable HRTF due to 
I can still enable HRTF in alsoft.ini or by using the correct parameters 
when creating the AL context or resetting the device.

Since OpenAL Soft does not detect me using headphones, is it still 
trying to output to a 5.1 speaker system?
Do I lose certain sounds or quality because of this?
When I explicitly tell OpenAL Soft to use HRTF, does it switch to 2 
channel output and ignore that DSound (or whatever API) is reporting a 
5.1 system is connected?

On 2/6/2017 4:38 AM, Chris Robinson wrote:
> On 02/05/2017 06:19 PM, Ian Reed wrote:
>> Hi Chris,
>> Thanks for your help in the other thread.
>> I have a new question.
>> Can you explain how the support for 5.1 and 7.1 speaker systems works?
>> I don't see anywhere to tell OpenAL Soft that the user has a 5.1 or 7.1
>> speaker setup.
> OpenAL Soft will try to detect it from the system. With PulseAudio, 
> MMDevAPI, DSound, and CoreAudio, it can query the current channel 
> setup and configure itself to fit what it reports back (i.e. it will 
> automatically use 5.1 or 7.1 output if that's what the system says it 
> has, or HRTF if it's told stereo headphones are being used). 
> Unfortunately, other APIs like ALSA, OSS, and OpenSL don't have a way 
> to query the current channel setup, so it just has to set stereo by 
> default for them.
> The OpenAL API doesn't have a way to explicitly request a channel 
> configuration. From what I understand, this is partly deliberate so 
> playback isn't restricted from using what it can due to apps not 
> knowing what's available (e.g. not being able to select hypothetical 
> 10.1 output, because apps only knows about support up to 7.1 and there 
> not being a 10.1 enum defined).
> For OpenAL Soft's part, there is a config file the user can edit to 
> set a specific output configuration (alsoft-config being a GUI 
> front-end for that), in case the library can't or doesn't autodetect 
> the optimal one for the user's system. That handles not only the 
> channel configuration, but also the mode like 'headphones' or 
> 'speakers' which it can use to automatically apply HRTF or cross-feed 
> filters as needed, or methods like UHJ which encode a surround sound 
> mix in stereo-compatible output.
>> I do see that I could supply 6 or 8 channels when creating the buffer,
>> and set the format to be Multi51Chn16Ext or Multi71Chn16Ext (OpenTK enum
>> names).
>> Does OpenAL Soft then use the virtual speakers to place the 6 or 8
>> channels, and then mix that down to a single wave form the sound card 
>> uses?
> OpenAL requires multi-channel buffer formats to automatically be 
> remixed to fit the output configuration. If you play a 7.1 buffer with 
> quad channel output, for example, the front-center and side channels 
> will be virtualized using the available speakers so the user still 
> hears it all.
>> Do all sound libraries use virtual speakers to mix down to a single wave
>> form when it goes to the sound card, or do sound APIs ever tell the
>> sound card directly that they have 5.1/7.1 sound channels?
> Most sound libraries generally have the programmer/user specify the 
> output configuration they want. The results from that vary, where 
> setup can fail or fall back to some default if the requested 
> configuration isn't available, or it simply pretends you got what you 
> asked for and remixes it to the channels that are actually available 
> (which can create odd results depending on your use case), or it gives 
> you what you asked and simply drops any missing output channels. The 
> behavior depends on both the library and the audio system/hardware.
> OpenAL takes a different approach. Rather than having the 
> programmer/user specify a desired output configuration, it uses the 
> configuration that's already been set on the system. If it knows the 
> system has 5.1 output, for instance, there's no need to try anything 
> else or have the programmer specify anything else. Since the API's 
> mostly designed for 3D audio, the app doesn't really need to care 
> about the output configuration either. The app specifies sound 
> positions in virtual 3D space and the library automatically fits it to 
> the output as best it can. Multi-channel buffers will be properly 
> remixed to fit the output as well, using the best methods the 
> implementation has available.
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal

More information about the openal mailing list