[ltp] ALSA setup on T30 and T40
Russell Williamson
linux-thinkpad@linux-thinkpad.org
Sat, 22 May 2004 10:02:30 -0500
I recently upgraded my T30 to Slackware-current and made the switch
from OSS to ALSA. Being new to ALSA, it took me several days to get
over the silent treatment from the new setup. Maybe this will help
others. I saw a post in the mailing list archives from a T40 owner
with some of the same problems, so I think it applies to them also.
The Intel 82801CA-ICH3 chipset has both an audio device and a modem
device. ALSA recognizes both and provides separate modules for
each device, snd-intel8x0 and snd-intel8x0m. That means that ALSA is
treating them NOT as separate devices on the same card, but as separate
sound cards. Unfortunately, on my system it loads the modem driver
first and makes it "card 0". Every sound-aware program assumes card 0
is the default sound device, which means they try to play sound through
the modem instead of through the speakers. Sometimes I could get around
this with command line options (alsamixer -c 1) or setting the right
options in your ~/.asoundrc, but it was an unnecessary struggle. The
real solution is to force the sound device to be card 0 by editing
my /etc/modules.conf to contain:
options snd cards_limit=2
alias snd-card-0 snd-intel8x0 # generated by alsaconf
alias snd-card-1 snd-intel8x0m
alias sound-slot-0 snd-intel8x0 # generated by alsaconf
alias sound-slot-1 snd-intel8x0m
options snd-intel8x0 index=0
options snd-intel8x0m index=1
The 'index=1' option on the last line means that even if the modem
driver loads first, it will still configure itself as card 1, leaving
card 0 free for the real audio device. Restart using this configuration
and 'cat /proc/asound/cards' shows the devices in the correct order.
I really like the dmix plugin. With the following ~/.asoundrc, I can
play sound via any combination of mpg321, 'aoss mpg321', xmms using
ALSA, xmms using OSS, noatun, xine, and KDE sound effects applet all
at the same time without any extra mixing software. (Sounds awful
but it works.)
------------------------- start ~/.asoundrc -------------------------
pcm.amix {
type dmix
ipc_key 50557
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
}
bindings {
0 0
1 1
}
}
pcm.!default { # route ALSA software through pcm.amix
type plug
slave.pcm "amix"
}
pcm.dsp0 { # route OSS software through pcm.amix
type plug
slave.pcm "amix"
}
ctl.mixer0 {
type hw
card 0
}
------------------------- end ~/.asoundrc -------------------------
I have been using it for about a week with one minor glitch, but
I'm not sure if it is an ALSA problem. Very rarely, xmms will stop
in the middle of a song and refuse to continue. (If I hit the play
button, the equalizer bars jump and immediately drop.) If I move to
a different song and immediately move back, it will play the entire
song, so it cannot be a bad mp3. Maybe one of the settings in pcm.amix
should be different, but I don't know the hardware well enough. Also,
the problem is intermittent, so I cannot set up a test case to work
on it. Anyone else run into this?