Skip to content

Constant buffer underruns when using plain ALSA audio (native SDL2 worked fine) #539

@vanfanel

Description

@vanfanel

Hi there,

Using plain ALSA audio, I get constant buffer underruns when running SDL2 games using SDL2-compat instead of "native" SDL2.

For example, with SDLPop (https://github.com/NagyD/SDLPoP) I get this constantly and audio is constantly cut off:

manuel@debian:~/prince$ prince.exe
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8772:(snd_pcm_recover) underrun occurred

IMPORTANT

  • It does not happen with native SDL2 as I said.
  • It does not happen when using pipewire audio instead of plain ALSA audio.

MORE INFO

I think something is still off with SDL2-compat when plain ALSA audio is used, probably related to period/buffer sizes since mangling with /etc/asound.conf I can get it somewhat working.

I usually have this on /etc/asound.conf to simply have my direct hardware output (DP-1) selected:

pcm.!default {
        type hw
        card Generic
        device 8
}

ctl.!default {
        type hw
        card Generic
}

...and that works fine with native SDL2, but with SDL2-compat the aforementioned buffer underruns are constanly breaking audio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions