Closed Hello71 closed 3 years ago
System-level downmixing occurs in SDL, not FAudio:
https://hg.libsdl.org/SDL/file/92d175b1eba6/src/audio/SDL_audiocvt.c#l1011
Any downmixing done by the application is done with matrix coefficients, which are application-defined, or done through a XAPO, also application-defined. X3DAudio does fill in matrix coefficients for 3D mixing but that wouldn't apply in this scenario.
ALSA bugs are always at the SDL level, not FAudio.
tl;dr
AUDIODEV=default
doesn't work, but it's (probably) not FAudio's fault.In #158, it was suggested to set
AUDIODEV=default
. This workaround doesn't actually work, at least for Skyrim. Center audio is simply dropped, making characters directly ahead completely mute. I was able to work around this by forcibly downmixing audio in asoundrc using this configuration:I got the constants from https://superuser.com/questions/852400/properly-downmix-5-1-to-stereo-using-ffmpeg, but other constants ought to work fine.
This issue does not manifest on PulseAudio systems because instead of ignoring the extra channels, the default configuration assumes you have only stereo output so forcibly downmixes all audio to stereo.
I'm not sure if FAudio is doing the correct thing at:
https://github.com/FNA-XNA/FAudio/blob/0f3f1e6df74da481d466dd97aa4345ea9fe56ca4/src/FAudio_platform_sdl2.c#L188
I suspect that at least for ALSA though, either the open totally fails, or the extra channels are accepted but silently ignored.
I think the "correct" solution would be to allow the application to select from a variety of output formats. However, my impression is that SDL doesn't provide a method to select an appropriate output format, and even if it does, I'm not sure if the XAudio API supports it. In case it does though, it might be necessary to move to GStreamer, SDL_mixer, or something other than raw SDL for audio output.
I understand that this is not a high-priority issue, especially if it only affects ALSA users. So, this issue is mostly filed for documentation; in particular, to notify users that the workaround in #158 mostly doesn't work. Thanks again for providing this excellent software.