From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Dec 11 07:10:06 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51F5316A41F for ; Sun, 11 Dec 2005 07:10:06 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 949DF43D6D for ; Sun, 11 Dec 2005 07:10:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBB7A20r051225 for ; Sun, 11 Dec 2005 07:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBB7A2AR051224; Sun, 11 Dec 2005 07:10:02 GMT (envelope-from gnats) Resent-Date: Sun, 11 Dec 2005 07:10:02 GMT Resent-Message-Id: <200512110710.jBB7A2AR051224@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Watanabe Kazuhiro Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8D3316A420 for ; Sun, 11 Dec 2005 07:04:37 +0000 (GMT) (envelope-from CQG00620@nifty.ne.jp) Received: from mail.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7139843D45 for ; Sun, 11 Dec 2005 07:04:36 +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 13B7525976 for ; Sun, 11 Dec 2005 16:04:35 +0900 (JST) Message-Id: <20051211070435.13B7525976@mail.asahi-net.or.jp> Date: Sun, 11 Dec 2005 16:07:21 +0900 From: Watanabe Kazuhiro To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: ports/90226: [patch] wavrec(1) cannot record from the second time on half-duplex mode (ports/audio/wavplay) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Watanabe Kazuhiro List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Dec 2005 07:10:06 -0000 >Number: 90226 >Category: ports >Synopsis: [patch] wavrec(1) cannot record from the second time on half-duplex mode (ports/audio/wavplay) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Dec 11 07:10:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Watanabe Kazuhiro >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD scorpio.zodiac.org 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Wed Dec 7 21:36:50 JST 2005 nabe@scorpio.zodiac.org:/FreeBSD/obj-current/FreeBSD/FreeBSD-current/src/sys/GENERIC i386 CVSup'ed Dec. 7. Soundboard: SoundBlaster Vibra16S (CT2800) Software: wavplay-1.4_1 from ports-current $ 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 4096 kld snd_sb16 (1p/1r/0v channels duplex) pcm2: at io 0x534 irq 10 drq 3:0 bufsz 4096 (1p/1r/0v channels duplex) $ >Description: When I try to record with wavrec (a part of ports/audio/wavplay) on half-duplex mode, cannot record from the second time. At the first time it works correctly. Wavrec open a sound device (default: /dev/audio) with O_RDWR flag. Probably it's wrong. Because wavrec doesn't support full-duplex operation. It is documented in "Open Sound System(TM) Programmer's Guide" pp29: | It is recommended that the device file is opened in read only | (O_RDONLY) or write only (O_WRONLY) mode. Read write mode (O_RDWR) | should be used only when it is necessary to record and play back at | the same time (full duplex mode). ("Selecting and Opening the Sound Device" http://www.opensound.com/pguide/oss.pdf) I've posted about the problem to the freebsd-multimedia mailing list, and taken a comment. http://lists.freebsd.org/pipermail/freebsd-multimedia/2005-December/003242.html >How-To-Repeat: * Case 1 (full-duplex mode, works fine) $ grep sbc /boot/device.hints hint.sbc.0.at="isa" hint.sbc.0.port="0x240" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" $ cat /dev/sndstat | grep pcm1 pcm1: at io 0x240 irq 5 drq 1:5 bufsz 4096 kld snd_sb16 (1p/1r/0v channels duplex) $ time wavrec -d /dev/dsp1 -S -s 44100 -b 16 -t 10 test.wav 10.07 real 0.02 user 1.18 sys $ time wavrec -d /dev/dsp1 -S -s 44100 -b 16 -t 10 test.wav 10.07 real 0.01 user 1.19 sys $ ls -l test.wav -rw-r--r-- 1 nabe nabe 1764044 Dec 9 21:23 test.wav $ * Case 2 (half-duplex mode, works only once) $ grep sbc /boot/device.hints hint.sbc.0.at="isa" hint.sbc.0.port="0x240" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0" $ cat /dev/sndstat | grep pcm1 pcm1: at io 0x240 irq 5 drq 1 bufsz 4096 kld snd_sb16 (1p/1r/0v channels) $ time wavrec -d /dev/dsp1 -S -s 44100 -b 16 -t 10 test.wav 10.15 real 0.00 user 1.19 sys $ time wavrec -d /dev/dsp1 -S -s 44100 -b 16 -t 10 test.wav Device busy: Opening audio device /dev/dsp1 1.60 real 0.00 user 1.59 sys $ ls -l test.wav -rw-r--r-- 1 nabe nabe 44 Dec 9 21:30 test.wav $ >Fix: diff -ruN /usr/ports/audio/wavplay/files/patch-af wavplay/files/patch-af --- /usr/ports/audio/wavplay/files/patch-af Fri Jun 7 11:21:52 2002 +++ wavplay/files/patch-af Sun Dec 11 12:57:42 2005 @@ -1,23 +1,30 @@ -*** recplay.c.orig Sat Jan 15 12:56:46 2000 ---- recplay.c Sat Jan 15 13:16:42 2000 -*************** -*** 52,63 **** ---- 52,69 ---- - #include - #include - #include -+ #ifndef FREEBSD - #include -+ #endif - #include - #include - #include - #include -+ #ifndef FREEBSD - #include -+ #else -+ #include -+ #endif - #include "wavplay.h" - #include "server.h" - +--- recplay.c.orig Sat Dec 4 09:06:42 1999 ++++ recplay.c Sun Dec 11 12:56:34 2005 +@@ -52,12 +52,18 @@ + #include + #include + #include ++#ifndef FREEBSD + #include ++#endif + #include + #include + #include + #include ++#ifndef FREEBSD + #include ++#else ++#include ++#endif + #include "wavplay.h" + #include "server.h" + +@@ -184,7 +190,7 @@ + wfile = svr.wfile; /* And the file is already opened */ + } + +- if ( (dfile = OpenDSP(wfile,O_RDWR,v_erf)) == NULL ) ++ if ( (dfile = OpenDSP(wfile,O_RDONLY,v_erf)) == NULL ) + goto errxit; + + if ( RecordDSP(dfile,wfile,samples,svr_work_proc,v_erf) ) >Release-Note: >Audit-Trail: >Unformatted: