Bug 90226 - [patch] wavrec(1) cannot record from the second time on half-duplex mode (ports/audio/wavplay)
Summary: [patch] wavrec(1) cannot record from the second time on half-duplex mode (por...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Simon Barner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-11 07:10 UTC by WATANABE Kazuhiro
Modified: 2005-12-11 23:18 UTC (History)
0 users

See Also:


Attachments
file.diff (1.41 KB, patch)
2005-12-11 07:10 UTC, WATANABE Kazuhiro
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description WATANABE Kazuhiro 2005-12-11 07:10:02 UTC
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: <SB16 DSP 4.13> 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: <SB16 DSP 4.13> 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
$
Comment 1 Simon Barner freebsd_committer 2005-12-11 23:07:48 UTC
Responsible Changed
From-To: freebsd-ports-bugs->barner

I'll take it.
Comment 2 Simon Barner freebsd_committer 2005-12-11 23:18:44 UTC
State Changed
From-To: open->closed

Committed, thanks! I also bumped PORTREVISION.