Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - laser_beamer

Pages: [1]
1
Audio / SFML Audio is broken in Ubuntu 20
« on: September 26, 2021, 05:48:53 pm »
It seems in Ubuntu 20, the sound is broken.

Even something has simple as:

#include "Sound.hpp"

int main()
{
    Sound sound("sound.wav");
    sound.play();

    return 0;
}

Gives an error that starts with:

ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': Device or resource busy
Failed to open the audio device

And you get the same error using Music

This error happens sometimes and sometimes it doesn't. Upon research it has to do with OpenAL using alsa and apparently alsa can now only be used by 1 device at at time, so if someone alsa is already being used, the device is busy.

At times I was able to fix this error by finding the process using alsa by using:

        fuser -v /dev/snd/*

as per this link: https://stackoverflow.com/questions/526132/finding-processes-using-alsa-sound-fast
and then running `kill -9 <process-id>` on the process id found.

That did work, until it didn't.

I also tried to switch OpenAL to use pulse instead of alsa, by setting drivers=pulse in /etc/openal/alsoft.conf
as per this link: https://www.reddit.com/r/linuxaudio/comments/d8mxpi/psa_force_openal_to_use_pulseaudio_when_gaming_on/

It didn't work, in fact it changed the error to start with:

Failed to open the audio device
An internal OpenAL call failed in SoundBuffer.cpp(46).
Expression:
   alGenBuffers(1, &m_buffer)
Error description:
   AL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

so drivers=pulse is a device that can't be opened? Or it doesn't recognize it?

So I changed that back.

I also had found another solution that involved using jack instead of alsa, which worked a couple days ago, then it stopped working too. Although I forget where the website for those instructions were.

Why does this sound system have to suddenly break just because I am using Ubuntu 20? Why can't SFML have some way of making sure the audio works in any environment? This is not an error that is supposed to be. This error is not my bug, it's just because people try to make things not work cohesively together.


Pages: [1]
anything