[AD] ALSA and dmix - small fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


My troubles with arts, and Elias post about his Jack driver prompted me to try ALSA and dmix again. With its dmix plugin, ALSA can be setup to do software mixing. Until recently, very few programs actually worked with a dmixed ALSA, but the situation is getting better.

I tried the ALSA driver of allegro 4.1.14 with dmix. Although install_sound() succeeded, the exstream example didn't produce any sound, and stayed forever on "update #1".

After tweaking the driver a bit, it turned out that after initialization, ALSA was on the state "SND_PCM_STATE_SUSPENDED". Adding "snd_pcm_start(pcm_handle)" in the initialization of the driver made it work perfectly. I attached the corresponding one-line patch. I'm no expert on ALSA, so whoever wrote the driver should check that this won't break anything... it however seems harmless enough!

This patch isn't needed when ALSA isn't dmixed, but according to the docs, it might be. From what I gather, a dmixed ALSA is much stricter, and "incorrect" code that was tolerated before isn't anymore. This is why a lot of programs like KDE, xine and xmms needed to be updated before they would work with a dmixed ALSA.

As KDE 3.2.2 works on a dmixed ALSA, I don't need arts anymore, and this is a very good thing :-).

--
Julien Cugnière
--- alsa9.c.old	2004-05-16 15:25:46.280896848 +0200
+++ alsa9.c	2004-05-16 15:24:11.308334872 +0200
@@ -443,6 +443,7 @@
 	     alsa_rate, uconvert_ascii((alsa_stereo ? "stereo" : "mono"), tmp2));
 
    digi_driver->desc = alsa_desc;
+   snd_pcm_start(pcm_handle);
    return 0;
 
  Error:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/