[maemo-developers] [maemo-developers] Audio on scratchbox and 770

From: Gustavo Sverzut Barbieri barbieri at gmail.com
Date: Sun Feb 5 11:49:23 EET 2006
On 2/4/06, Ralph Giles <giles at xiph.org> wrote:
> On Sat, Feb 04, 2006 at 04:18:02AM +0100, Danny Milosavljevic wrote:
> > I don't understand why esound is still around at all (even on desktops).
> > What good does it do?
> IIRC the story went something like this: Most desktop (and perhaps
> otherwise) applications would would like to be able to just play
> a sound when they want to. The expected behavior is for this to
> be mixed into the output channel so that e.g. ui feedback sounds
> just overlay the output of a music player. But, /dev/dsp can only
> be written to by one process. This is because (a) having multiple
> open behavior would be break some applications that assume only
> one process can hold a write lock, (b) it's a denial of service
> opportunity since a hostile process could easily tie up lots of
> kernelspace cpu by submitting more streams for mixing than the
> hardware supports, forcing fallback to software mixing which (c)
> doesn't belong in kernel space anyway ("multimedia is icky").
> Ergo, we must have a server process in userspace that arbitrates
> access to the kernel sound device, holding the write lock and
> accepting streams for mixing over IPC. esd is the most popular
> of such programs, and because the IPC interface means custom
> code, it's become entrenched.
> I believe since about mid-2005, ALSA started doing something like
> what the kernel developers declined to do in OSS, so (at least
> for sound cards with a reasonably capable hardware mixer, and
> possibly with hooks into a userspace software mixer for fallback--
> I'm hazy on the details) things work as you'd "expect". ESD is
> therefore expected to fade away over the next 5 years or so as
> support for the older kernel configs is dropped.

ALSA does it pretty well and in a configurable way by using dmix
(output) and dsnoop (input). You can choose if just one user may use
the device or if other users may use it too, which is great for
desktops that uses many X sessions with different user. Imagine that
your father left some program holding the sound card and he left, you
want to use the machine to listen to music... :-)

More info:

 * Gentoo Wiki: http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix
 * http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
 * http://alsa.opensrc.org/index.php?page=DmixPlugin

Gustavo Sverzut Barbieri
Computer Engineer 2001 - UNICAMP
Mobile: +55 (19) 9165 8010
 Phone:  +1 (347) 624 6296; 08122692 at sip.stanaphone.com
Jabber: gsbarbieri at jabber.org
  ICQ#: 17249123
   MSN: barbieri at gmail.com
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net

More information about the maemo-developers mailing list