From owner-freebsd-multimedia@FreeBSD.ORG Sun Nov 6 12:49:02 2005 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DF1D16A41F for ; Sun, 6 Nov 2005 12:49:02 +0000 (GMT) (envelope-from CQG00620@nifty.ne.jp) Received: from mail.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73D3143D45 for ; Sun, 6 Nov 2005 12:49:01 +0000 (GMT) (envelope-from CQG00620@nifty.ne.jp) Received: from asahi-net.jp (h204195.ppp.asahi-net.or.jp [61.114.204.195]) by mail.asahi-net.or.jp (Postfix) with ESMTP id 7D4EF1E5F4 for ; Sun, 6 Nov 2005 21:49:00 +0900 (JST) Date: Sun, 06 Nov 2005 21:49:11 +0900 From: Watanabe Kazuhiro To: freebsd-multimedia User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/20.7 (i386--freebsd) MULE/4.0 (HANANOEN) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Message-Id: <20051106124900.7D4EF1E5F4@mail.asahi-net.or.jp> Subject: [patch] als4000.c recording mixer problem X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2005 12:49:02 -0000 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@scorpio.zodiac.org:/FreeBSD/obj-current/FreeBSD/FreeBSD-current/src/sys/GENERIC i386 $ cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: pcm0: at io 0xe800 irq 9 kld snd_als4000 (1p/1r/0v channels duplex default) pcm1: at io 0x240 irq 5 drq 1:5 bufsz 4096d kld snd_sb16 (1p/1r/0v channels duplex) pcm2: 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@nifty.ne.jp)