Technical:Sound

From K12LTSP Wiki

Jump to: navigation, search

Preface

The /etc/sysinit (/opt/ltsp/i386/etc/sysinit) script does most of the work of loading things during the client's bootup. If you look at this file, you'll notice, near the end, that it calls the rc.sound script. The rc.sound script does the work of trying to load sound modules, and other pieces for sound to work. If you're having trouble getting sound to work, start by having a look at rc.sound to get an idea of how sound works. One thing to notice is the 'pci_scan -a -f audiolist' command, which tries to load the appropriate driver based on what lspci reports.

There are two aspects to sound on terminals:

  1. hacks to LTSP
  2. hacks to the server.

Hacks to LTSP

LTSP skips over sound initialization unless "SOUND = Y" is set in /opt/ltsp/i386/etc/lts.conf

Sound drivers may be set in lts.conf as well, for example:

SMODULE_01  sb io0x220 irq5 dma1

which would try to load the Sound Blaster (sb) module for a card with its io port at 0x220, irq at 5, and dma enabled.

If "SOUND = Y" is set in lts.conf, this script is executed:

/opt/ltsp/i386/etc/rc.sound

The first thing this script will do is attempt to load any sound modules which have been defined (SMODULE_0? = ????) in lts.conf.

If no sound modules were manually specified, or the ones specified did not load properly, the rc.sound script probes the PCI bus and tries to load the modules for any sound cards it finds (as defined in /opt/ltsp/i386/etc/audiolist).

If a sound card is detected at this point (it greps for "sound" in /proc/devices), the esound daemon is started on the terminal, listening on TCP port 16001.

Hacks to the server

K12LTSP adds a new profile script, /etc/profile.d/ltsp-esound.sh, which makes a number of sanity checks and if all seems sane sets a couple environment variables. This happens everytime a new session or a new shell is started. The sanity checks include:

  • check that the $DISPLAY variable is set and that it is non-local
  • if netcat (nc) is installed, use it to verify that the remote display has the esound daemon running on port 16001
  • don't run as root
  • make sure that the libraries, /usr/lib/libesd.so.0 and /usr/lib/libesddsp.so.0, exist

If all of the above are true, the ltsp-esound.sh script does the following magic:

  • The $ESPEAKER and $ESDDSP_MIXER variables are set. This is all that is needed for native ESD apps to function
  • The libesd.so
Personal tools