Blocking ALSA

Hello,

I’m using libSDL 1.2.7 on Gentoo. I have SDL_AUDIODRIVER set to “alsa”,
and am using the ALSA sound system in kernel 2.6.3. ALSA is set up to
use dmix on the “default” device. As a result, I can play multiple sound
streams from multiple alsaplayers and XMMS happily.

However, SDL appears to engage in blocking behaviour, even though the
changelog shows this being fixed in 1.2.6. For example, if I try to
start FreeCiv (a SDL game) while playing music in XMMS:

ALSA lib pcm_hw.c:1055:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p
failed: Device or resource busy
ALSA lib pcm_dmix.c:812:(snd_pcm_dmix_open) unable to open slave
1: Error calling Mix_OpenAudio
1: Plugin sdl found but can’t be initialized.
2: Proceeding with sound support disabled

Conversely, if I start it with nothing else playing, sound works fine,
but other applications are ‘locked out’ from playing sound. Similar
behaviour is demonstratable with other SDL apps, like BZFlag.

Why does SDL behave this way? Is it by design (Why? It’s quite
annoying), or is it a bug?

Philip “LionsPhil” Boulain

However, SDL appears to engage in blocking behaviour, even though the
changelog shows this being fixed in 1.2.6.

Why does SDL behave this way? Is it by design (Why? It’s quite
annoying), or is it a bug?

I think it’s a bug… try it with the latest SDL CVS:
http://www.libsdl.org/cvs.php

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment