[patch] als4000.c recording mixer problem
Watanabe Kazuhiro
CQG00620 at nifty.ne.jp
Sun Nov 6 04:49:02 PST 2005
Hi, everyone.
I have an AOpen AW200 sound card which uses the AvanceLogic ALS4000
soundchip.
When I try to record from the card's line input with wavrec (a part of
ports/audio/wavplay) on FreeBSD 5.4, only record the left channel. The
right channel has no sound.
But on FreeBSD-7-current (CVSup'ed Nov. 5), it can record both left
and right channel. It looks like correct, however, it also selects an
another input(s) to the recording source.
To find out this problem, add a bit of modify to
sys/dev/sound/pci/als4000.c and run mixer(1) command.
@@ -616,7 +616,9 @@ alsmix_setrecsrc(struct snd_mixer *m, u_
if (src & SOUND_MASK_SYNTH)
mask |= 0x60;
+printf("l=%x\n", l|mask);
als_mix_wr(sc, SB16_IMASK_L, l|mask);
+printf("r=%x\n", r|mask);
als_mix_wr(sc, SB16_IMASK_R, r|mask);
return src;
}
* Environment
$ uname -a
FreeBSD scorpio.zodiac.org 7.0-CURRENT FreeBSD 7.0-CURRENT #3: Sat Nov 5 17:23:54 JST 2005 nabe at scorpio.zodiac.org:/FreeBSD/obj-current/FreeBSD/FreeBSD-current/src/sys/GENERIC i386
$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <Avance Logic ALS4000> at io 0xe800 irq 9 kld snd_als4000 (1p/1r/0v channels duplex default)
pcm1: <SB16 DSP 4.13> at io 0x240 irq 5 drq 1:5 bufsz 4096d kld snd_sb16 (1p/1r/0v channels duplex)
pcm2: <CS423x> at io 0x534 irq 10 drq 3:0 bufsz 4096 (1p/1r/0v channels duplex)
* Test commands and summary of the results
Command Actual recording source
Left channel Right channel
--------------------------------------------------------
mixer =rec mic mic mic&cd
mixer =rec cd dummy&cd dummy&cd&line
mixer =rec line dummy&line line&dummy&synth
I've referred to the Avance Logic ALS4000 datasheet pp14 ("MX3D" and
"MX3E"). The datasheet is available from:
http://www.alsa-project.org/alsa/ftp/manuals/avance_logic/ALS4000a.PDF
It's a fix patch.
--- sys/dev/sound/pci/als4000.c.orig Thu Oct 6 05:05:52 2005
+++ sys/dev/sound/pci/als4000.c Sun Nov 6 20:20:56 2005
@@ -591,33 +591,23 @@ static int
alsmix_setrecsrc(struct snd_mixer *m, u_int32_t src)
{
struct sc_info *sc = mix_getdevinfo(m);
- u_int32_t i, l, r, mask;
+ u_int32_t i, l, r;
for (i = l = r = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (src & (1 << i)) {
- l |= amt[i].iselect;
- r |= amt[i].iselect << 1;
+ if (amt[i].iselect == 1) { /* microphone */
+ l |= amt[i].iselect;
+ r |= amt[i].iselect;
+ } else {
+ l |= amt[i].iselect;
+ r |= amt[i].iselect >> 1;
+ }
+
}
}
- /* ALS mixer is really an SB16 mixer */
-
- mask = 0;
-
- if (src & SOUND_MASK_MIC)
- mask |= 0x01;
-
- if (src & SOUND_MASK_CD)
- mask |= 0x06;
-
- if (src & SOUND_MASK_LINE)
- mask |= 0x18;
-
- if (src & SOUND_MASK_SYNTH)
- mask |= 0x60;
-
- als_mix_wr(sc, SB16_IMASK_L, l|mask);
- als_mix_wr(sc, SB16_IMASK_R, r|mask);
+ als_mix_wr(sc, SB16_IMASK_L, l);
+ als_mix_wr(sc, SB16_IMASK_R, r);
return src;
}
---
Watanabe Kazuhiro (CQG00620 at nifty.ne.jp)
More information about the freebsd-multimedia
mailing list