[openal] Making OpenAL Soft more "portable"?

Chris Robinson chris.kcat at gmail.com
Sat Jun 4 11:27:30 EDT 2016

On 06/04/2016 07:20 AM, Luís Felipe Safady wrote:
> Hello, something just occurred to me and I need to ask.
> How does OpenAl Soft handles mismatched sample rate frequencies on Windows
> when using HRTF?

OpenAL Soft will use the sample rate given by mmdevapi, since it won't 
accept any other rate. Once the OpenAL device is set up with the 
backend's sample rate, it will look for an HRTF data set that has the 
same sample rate and use it if it exists, and if not, HRTF will be disabled.

> Windows will always resample automatically even when mismatched, so OpenAl
> Soft doesn't even need to care what frequency the sound card is set as
> everything will just work (maybe not when using WASAPI, but I believe
> DirectSound is the only backend for Windows that is implemented).
> The error that OpenAl Soft throws when the sample rate is mismatched makes
> me think that it disables HRTF when it happens.

Windows has an MMDevAPI/WASAPI backend that gets used by default. The 
DSound backend can deal with mismatched sample rates because its an 
extra layer on top of WASAPI that implements an additional mixer which 
will handle resampling. But in doing so, it's also adding latency, and 
the DSound API itself is rather antiquated with a number of.. odd 
behaviors, to put it lightly (which is why MMDevAPI is preferred).

An XAudio2 backend might be more preferable than a DSound one, as it's 
more up-to-date and also does resampling, but I've not really looked 
into its behavior with regards to latency and such.

> Also, for some reason the version 1.17.2 on Windows is outputting that
> bsinc, sinc8, sinc4 are not supported as a resample algorithm on the log
> for some reason, and this is strange as the code on line 230 in mixer.c
> should be correct. Is the binary in the zip file the correct DLL? (I just
> tested 64-bit)

It looks correct from what I can see. Make sure both the 32-bit and 
64-bit DLLs for 1.17.2 are installed properly (if you've only updated 
the 64-bit DLL, a 32-bit app would still be using an older version, and 
vice-versa), and check that the app you're testing with doesn't have its 
own older version of OpenAL Soft that may be taking precedence.

More information about the openal mailing list