OpenAL problem on ubuntu 20.04

Hi all,

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

any ideas?

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…

As a temporary workaround, I am executing my game through wine. Audio still does not work with the following error:

ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave

But at least it does not break anymore

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.

Thanks for your help!

2 Likes

Can confirm I resolved this issue by uninstalling the vs code from the ubuntu software center and download a deb package from their website.

Thanks for mentioning what the problem was