[uae] ALSA

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Thu, 15 Jun 2006 01:39:58 -0400

Hi All

I've checked some modifications to the ALSA driver into CVS. Hopefully, this 
should cure the problems that people have been experiencing.

If you don't want to muck about with CVS, then grab the two updated files 
from:
http://uaedev.cvs.sourceforge.net/*checkout*/uaedev/uae/src/sd-alsa/sound.c
http://uaedev.cvs.sourceforge.net/*checkout*/uaedev/uae/src/sd-alsa/sound.h

and copy them into src/sd-alsa (they should work with any version of E-UAE 
that already has ALSA support).

To configure with ALSA support, use the '--with-alsa' config option.

Okay.

One significant change in this is that the ALSA ring-buffer is configured by 
buffer size in microseconds rather than bytes. Tests here have shown that 
it's much more reliable doing it this way.

As a temporary measure, the sound_max_buff option with the ALSA driver now 
specifies the sound buffer size in microseconds (so update your config 
files). The default is 100000 us, which is a tolerable latency. Reduce this 
to 50000 or 25000 to reduce the latency but increase CPU load.

The sound_max_buff size will be replaced with a new config 
option, 'sound_latency' or something (suggestions welcome). To me it makes 
little sense to have to specify the buffer in bytes. Doing it as a period of 
time is much more easily understandable (especially with a GUI control to do 
this). The other sound drivers will have to be modified for this to work, 
though.

This new ALSA driver spits out a lot more info. This is for debugging purposes 
only. If you have problems, cut and paste this info into an email to me. Note 
that, amongst other things, that it'll tell you the size of the buffer it 
managed to obtain in microseconds.

This underlines the problem with the ALSA dmix plug-in with libasound 1.0.9 
and 1.1.10. Whatever buffer size you try to specify (with the default dmix 
config at least), you end up with a buffer of around 300000 us (which is 
totally unacceptable). Solution: don't use dmix, upgrade to libasound 1.0.11, 
or modify your dmix config.

The next step will be to add ALSA-specific config options: e.g., for 
specifying the device to use (rather than 'default'), etc.

Let me know how you get on with this.

Cheers,
Rich

Other related posts: