Debian: Failed to open audio: No available audio device

Hello, I don’t know if this is the right place to ask, but I tried my distros forums and someone told me to come here.

So basically:

I’ve been trying to get SDL’s sound to work, but all SDL applications fail with the Failed to open audio: No available audio device error.

I’ve tried googling it and none of the solutions worked for me. I also know very little about sound cards and general sound drivers on linux, and this is driving me nuts.

To be more precise, I’m trying to get Visual Boy Advances sound to work, but other SDL games (sauerbraten for instance), have the same problem. And for the record, other kinds of sounds seem to work, banshee works, flash works, etc. the problem seems to be linked to SDL only.

Up untill now I’ve tried to set SDL_AUDIODRIVER=alsa. Before that I tried with pulseaudio, but it didn’t solve it and they sugested me to completely remove pulseaudio to see if that would fix it… it didn’t.

I’m using CrunchBang, based on Debian Wheezy.

Any ideas?

Alright, I managed to fix it. Here’s what I did in detail and this should work for anyone else having this problem while having everything (apparently) set up correctly.

Ok, first I (as a sugestion from Alad) installed the ALSA drivers and completely removed PulseAudio from my system following the instructions in this thread:
I must point out that I don’t know if this is really needed tho.

Ok, after that it didn’t work so I searched around and found this thread:
In which Ryan C. Gordon states:

If you built your own SDL, you probably didn't have development headers
for PulseAudio (or ALSA), so it's trying to use /dev/dsp, which doesn't
exist on many modern Linux systems (hence, SDL_Init(SDL_INIT_AUDIO)
succeeds, but no devices are found when you try to open one). "apt-get
install libasound2-dev libpulse-dev" and rebuild SDL...let the configure
script find the new headers so it includes PulseAudio and ALSA support.

So I got the ALSA development packages

sudo apt-get install libasound2-dev

and built and installed SDL from scratch. This time tho it detected the ALSA dev libs and compiled it with ALSA support, which made it instantly work!

And that is it. I hope the instructions are clear.