When I try to run an application compiled with monogame 3.7.1 if there is any other audio being played in the system I get the following error:
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
It looks like OpenAL is trying to use the Alsa backend. It makes sense that it cannot open the device, because it is already being use by pulseaudio.
If I force OpenAL to use the pulseaudio backend I don’t see the previous error anymore, but it crashes anyway
Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL device could not be initialized, see console output for details.
I can reproduce this with mono and with netcore3.1
I had a kind of similar problem on Ubuntu 18.04. Using PulseAudio it doesn’t seem to respect my choice of default sync and instead always chooses the worst device to output sound on. I had a stackoverflow post about it but never ended up resolving it.
Thanks for your answer. I’m not sure that this is a problem with PulseAudio, though.
I’ve compiled a C++ application using OpenAL and it does work properly.
I’d say the problem has something to do with the MonoGame binaries using an outdated library or something…
I have found the root cause of this: Visual Studio Code.
If I run my application from a regular terminal it does work as expected, it is only from VSCode that doesn’t. This could just be because code is run from a snap and it might not have access to some stuff.