kondrak / vkQuake2

id Software's Quake 2 v3.21 with mission packs and Vulkan support (Windows, Linux, macOS, FreeBSD, Raspberry Pi 4)
GNU General Public License v2.0
906 stars 90 forks source link

Game doesn't try hard enough to initialize the alsa drivers available. #139

Closed arabek closed 2 years ago

arabek commented 3 years ago
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.4/work/alsa-lib-1.2.4/src/dlmisc.c:337:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pulse.so (/usr/lib64/alsa-lib/libasound_module_pcm_pulse.so: cannot open shared object file: No suchfile or directory)
ALSA sound error: cannot open device 

yet in the same directory:

[ /usr/lib64/alsa-lib ]$ ls -al *pcm_pipewire*
-rwxr-xr-x 1 root root 97048 10-26 09:34 libasound_module_pcm_pipewire.so

moreover:

[ arab: /usr/lib64/alsa-lib ]$ ls -al *pcm*
-rwxr-xr-x 1 root root 22632 10-25 19:12 libasound_module_pcm_a52.so
-rwxr-xr-x 1 root root 22568 10-25 19:12 libasound_module_pcm_jack.so
-rwxr-xr-x 1 root root 97048 10-26 09:34 libasound_module_pcm_pipewire.so
-rwxr-xr-x 1 root root 14264 10-25 19:12 libasound_module_pcm_speex.so
-rwxr-xr-x 1 root root 14552 10-25 19:12 libasound_module_pcm_upmix.so
-rwxr-xr-x 1 root root 14544 10-25 19:12 libasound_module_pcm_usb_stream.so
-rwxr-xr-x 1 root root 14304 10-25 19:12 libasound_module_pcm_vdownmix.so

which also seem to be ignored. The initialization code isn't robust enough to handle alsa properly.

kondrak commented 2 years ago

I cannot seem to reproduce this even if I deliberately remove the PulseAudio driver - makes me wonder why your ALSA package doesn't come with it bundled like it does in my case, but that's another story. Which distro are you using and can you post the full log from application start?

arabek commented 2 years ago

that's the thing. I don't. I'm using pipewire as pulseaudio replacement. had hoped the bug report made that clear enough.

mackron commented 2 years ago

I've had a look in snd_alsa.c and what vkQuake2 is doing is very standard for ALSA. The only thing I can think of is perhaps you don't have a "default" device configured in your ALSA config, or your "default" device is configured to use PulseAudio. My instinct is the latter just based on the error you're getting but not 100% sure. My advice would be to run aplay -L which will list all of your devices, including the "default" device that vkQuake2 is using. If the "default" device says "Playback/recording through the PulseAudio sound server", I'm pretty sure it's a system configuration error on your end. If that is indeed the problem, I'm not sure how to resolve it.

As for robustness in vkQuake2, what I do in my audio library is first try "default", but then fall back to "dmix", and then "hw" after that. Still, it's expected that users would have a working "default" device because otherwise a whole bunch of ALSA programs are going to break so I don't think it's necessarily a vkQuake2 problem.

kondrak commented 2 years ago

I will close this issue, since rewriting the sound driver would be out of the scope of this project and I cannot reliably replicate the problem. There is in fact a fork of vkQuake2 created by @mackron which exclusively uses MiniAudio for sound support, so it might be worth to check it out and see if the problem persists also there.