1998-08-09 19:42:53 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1998, Luigi Rizzo
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-08-09 19:42:53 +00:00
|
|
|
.\"
|
2005-11-28 16:47:52 +00:00
|
|
|
.Dd November 28, 2005
|
2004-09-08 08:28:02 +00:00
|
|
|
.Dt SOUND 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1998-08-09 19:42:53 +00:00
|
|
|
.Sh NAME
|
2004-09-08 08:28:02 +00:00
|
|
|
.Nm sound ,
|
2000-07-20 15:47:45 +00:00
|
|
|
.Nm pcm ,
|
|
|
|
.Nm snd
|
2004-06-16 08:33:57 +00:00
|
|
|
.Nd
|
|
|
|
.Fx
|
|
|
|
PCM audio device infrastructure
|
1998-08-09 19:42:53 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-01-15 06:25:09 +00:00
|
|
|
For a card with bridge driver support, and a PnP card:
|
2004-09-08 08:28:02 +00:00
|
|
|
.Cd "device sound"
|
2000-01-15 06:25:09 +00:00
|
|
|
.Pp
|
2001-10-13 09:08:37 +00:00
|
|
|
For a card without bridge driver support, and a non-PnP card,
|
|
|
|
the following lines may be required in
|
|
|
|
.Pa /boot/device.hints :
|
|
|
|
.Cd hint.pcm.0.at="isa"
|
|
|
|
.Cd hint.pcm.0.irq="5"
|
|
|
|
.Cd hint.pcm.0.drq="1"
|
|
|
|
.Cd hint.pcm.0.flags="0x0"
|
1998-08-09 19:42:53 +00:00
|
|
|
.Sh DESCRIPTION
|
2004-09-08 08:28:02 +00:00
|
|
|
.Bf -emphasis
|
|
|
|
Note: There exists some ambiguity in the naming at the moment
|
|
|
|
.Pq Nm sound , pcm , snd .
|
|
|
|
It will be resolved soon by renaming
|
|
|
|
.Cd "device sound"
|
|
|
|
to
|
|
|
|
.Cd "device snd" ,
|
|
|
|
and doing associated changes.
|
|
|
|
.Ef
|
|
|
|
.Pp
|
1998-08-09 19:42:53 +00:00
|
|
|
The
|
2000-02-08 21:32:12 +00:00
|
|
|
.Nm
|
2003-11-15 06:08:57 +00:00
|
|
|
driver provides support for
|
|
|
|
.Tn PCM
|
|
|
|
audio play and capture.
|
|
|
|
This driver also supports various
|
|
|
|
.Tn PCI ,
|
|
|
|
.Tn WSS/MSS
|
|
|
|
compatible,
|
|
|
|
.Tn ISA
|
|
|
|
sound cards, and AC97 mixer.
|
|
|
|
Once the
|
|
|
|
.Nm
|
|
|
|
driver attaches, supported devices provide audio record and
|
|
|
|
playback channels.
|
|
|
|
The
|
|
|
|
.Fx
|
|
|
|
sound system provides dynamic mixing
|
|
|
|
.Dq VCHAN
|
|
|
|
and rate conversion
|
|
|
|
.Dq soft formats .
|
2000-03-01 14:50:24 +00:00
|
|
|
True full duplex operation is available on most cards.
|
2000-01-15 06:25:09 +00:00
|
|
|
.Pp
|
2003-11-15 06:08:57 +00:00
|
|
|
If the sound card is supported by a bridge driver, the
|
2000-02-08 21:32:12 +00:00
|
|
|
.Nm
|
2003-11-15 06:08:57 +00:00
|
|
|
driver works in conjunction with the bridge driver.
|
1998-08-09 19:42:53 +00:00
|
|
|
.Pp
|
|
|
|
Apart from the usual parameters, the flags field is used to specify
|
2003-11-15 06:08:57 +00:00
|
|
|
the secondary
|
|
|
|
.Tn DMA
|
|
|
|
channel (generally used for capture in full duplex cards).
|
|
|
|
Flags are set to 0 for cards not using a secondary
|
|
|
|
.Tn DMA
|
1998-08-09 19:42:53 +00:00
|
|
|
channel, or to 0x10 + C to specify channel C.
|
|
|
|
.Pp
|
2001-03-10 10:19:38 +00:00
|
|
|
The driver does its best to recognize the installed hardware and drive
|
2003-11-15 06:08:57 +00:00
|
|
|
it correctly so the user is not required to add several lines in
|
2001-10-13 09:08:37 +00:00
|
|
|
.Pa /boot/device.hints .
|
2003-11-15 06:08:57 +00:00
|
|
|
For
|
|
|
|
.Tn PCI
|
|
|
|
and
|
|
|
|
.Tn ISA
|
|
|
|
.Tn PnP
|
|
|
|
cards this is actually easy
|
2000-03-01 14:50:24 +00:00
|
|
|
since they identify themselves.
|
2003-11-15 06:08:57 +00:00
|
|
|
For legacy
|
|
|
|
.Tn ISA
|
|
|
|
cards, the driver looks for
|
|
|
|
.Tn MSS
|
|
|
|
cards at addresses 0x530 and 0x604 (unless overridden
|
2001-10-13 09:08:37 +00:00
|
|
|
in
|
2001-11-21 10:33:42 +00:00
|
|
|
.Pa /boot/device.hints ) .
|
2003-11-15 06:08:57 +00:00
|
|
|
.Ss Boot Variables
|
|
|
|
In general, the module
|
|
|
|
.Pa snd_foo
|
2004-06-16 08:33:57 +00:00
|
|
|
corresponds to
|
2004-09-08 08:28:02 +00:00
|
|
|
.Cd "device snd_foo"
|
2004-06-16 08:33:57 +00:00
|
|
|
and can be
|
|
|
|
loaded by the boot
|
|
|
|
.Xr loader 8
|
|
|
|
via
|
|
|
|
.Xr loader.conf 5
|
2003-11-15 06:08:57 +00:00
|
|
|
or from the command line using the
|
|
|
|
.Xr kldload 8
|
|
|
|
utility.
|
|
|
|
Options which can be specified in
|
|
|
|
.Pa /boot/loader.conf
|
|
|
|
include:
|
2004-06-16 08:33:57 +00:00
|
|
|
.Bl -tag -width ".Va snd_emu10k1_load" -offset indent
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Va snd_driver_load
|
2004-06-16 08:33:57 +00:00
|
|
|
.Pq Dq Li NO
|
2003-11-15 06:08:57 +00:00
|
|
|
If set to
|
2004-06-16 08:33:57 +00:00
|
|
|
.Dq Li YES ,
|
2003-11-15 06:08:57 +00:00
|
|
|
this option loads all available drivers.
|
|
|
|
.It Va snd_emu10k1_load
|
2004-06-16 08:33:57 +00:00
|
|
|
.Pq Dq Li NO
|
2003-11-15 06:08:57 +00:00
|
|
|
If set to
|
2004-06-16 08:33:57 +00:00
|
|
|
.Dq Li YES ,
|
|
|
|
only the SoundBlaster 5.1 driver and dependent modules will be loaded.
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Va snd_foo_load
|
2004-06-16 08:33:57 +00:00
|
|
|
.Pq Dq Li NO
|
2003-11-15 06:08:57 +00:00
|
|
|
If set to
|
2004-06-16 08:33:57 +00:00
|
|
|
.Dq Li YES ,
|
2003-11-15 06:08:57 +00:00
|
|
|
load driver for card/chipset foo.
|
|
|
|
.El
|
2004-06-24 17:43:12 +00:00
|
|
|
.Pp
|
|
|
|
To define default values for the different mixer channels,
|
2005-12-05 22:10:09 +00:00
|
|
|
set the channel to the preferred value using hints, e.g.:
|
2004-06-24 17:43:12 +00:00
|
|
|
.Va hint.pcm.0.line Ns = Ns Qq Li 0 .
|
|
|
|
This will mute the input channel per default.
|
2004-06-16 08:33:57 +00:00
|
|
|
.Ss VCHANs
|
2003-11-15 06:08:57 +00:00
|
|
|
Each device can optionally support more playback channels
|
2005-12-05 22:10:09 +00:00
|
|
|
than physical hardware provides by using
|
2003-11-15 06:08:57 +00:00
|
|
|
.Dq virtual channels
|
|
|
|
or
|
|
|
|
.Tn VCHANs .
|
|
|
|
.Tn VCHAN
|
|
|
|
options can be configured via the
|
|
|
|
.Xr sysctl 8
|
|
|
|
interface but can only be manipulated while the device is inactive.
|
|
|
|
.Ss Runtime Configuration
|
|
|
|
The following
|
|
|
|
.Xr sysctl 8
|
2004-06-16 08:33:57 +00:00
|
|
|
variables are available:
|
|
|
|
.Bl -tag -width ".Va hw.snd.report_soft_formats" -offset indent
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Va hw.snd.pcm%d.buffersize
|
|
|
|
Configure the amount of
|
|
|
|
.Tn DMA
|
|
|
|
bufferspace available for a device.
|
|
|
|
.It Va hw.snd.targetirqrate
|
|
|
|
Set the default block size such that continuous
|
|
|
|
playback will achieve this
|
|
|
|
.Tn IRQ
|
|
|
|
rate.
|
|
|
|
This value can be tuned to improve application performance.
|
|
|
|
Increase this value when the sound lags and decrease
|
|
|
|
it if sound stutters or breaks up.
|
|
|
|
.It Va hw.snd.unit
|
|
|
|
When using
|
|
|
|
.Xr devfs 5 ,
|
|
|
|
the default device for
|
|
|
|
.Pa /dev/dsp .
|
|
|
|
Equivalent to a symlink from
|
|
|
|
.Pa /dev/dsp
|
|
|
|
to
|
2004-06-16 08:33:57 +00:00
|
|
|
.Pa /dev/dsp Ns Va ${hw.snd.unit} .
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Va hw.snd.report_soft_formats
|
|
|
|
Controls the internal format conversion if it is
|
|
|
|
available transparently to the application software.
|
|
|
|
When disabled or not available, the application will
|
|
|
|
only be able to select formats the device natively supports.
|
|
|
|
.It Va hw.snd.verbose
|
|
|
|
Level of verbosity for the
|
|
|
|
.Pa /dev/sndstat
|
|
|
|
device.
|
|
|
|
Higher values include more output and the highest level,
|
2004-06-16 08:33:57 +00:00
|
|
|
three, should be used when reporting problems.
|
2003-11-15 06:08:57 +00:00
|
|
|
Other options include:
|
2004-06-16 08:33:57 +00:00
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It 0
|
|
|
|
Installed devices and their allocated bus resources.
|
|
|
|
.It 1
|
|
|
|
The number of playback, record, virtual channels, and
|
2003-11-15 06:08:57 +00:00
|
|
|
flags per device.
|
2004-06-16 08:33:57 +00:00
|
|
|
.It 2
|
|
|
|
Channel information per device including the channel's
|
2003-11-15 06:08:57 +00:00
|
|
|
current format, speed, and pseudo device statistics such as
|
|
|
|
buffer overruns and buffer underruns.
|
2004-06-16 08:33:57 +00:00
|
|
|
.It 3
|
|
|
|
File names and versions of the currently sound loaded modules.
|
|
|
|
.El
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Va hw.snd.maxautovchans
|
|
|
|
Global
|
|
|
|
.Tn VCHAN
|
|
|
|
setting that only affects devices that have only one playback channel.
|
|
|
|
The sound system will dynamically create up this many
|
|
|
|
.Tn VCHANs .
|
|
|
|
Set to
|
|
|
|
.Dq 0
|
|
|
|
if no
|
|
|
|
.Tn VCHANS
|
|
|
|
are desired.
|
|
|
|
.It Va hw.snd.pcm%d.vchans
|
|
|
|
The current number of
|
|
|
|
.Tn VCHANs
|
|
|
|
allocated per device.
|
|
|
|
This can be set to preallocate a certain number of
|
|
|
|
.Tn VCHANs .
|
|
|
|
Setting this value to
|
|
|
|
.Dq 0
|
|
|
|
will disable
|
|
|
|
.Tn VCHANs
|
|
|
|
for this device.
|
|
|
|
.El
|
|
|
|
.Ss Recording Channels
|
|
|
|
On devices that have more than one recording source (ie: mic and line),
|
|
|
|
there is a corresponding
|
|
|
|
.Pa /dev/dspr%d.%d
|
|
|
|
device.
|
|
|
|
.Ss Statistics
|
|
|
|
Channel statistics are only kept while the device is open.
|
|
|
|
So with situations involving overruns and underruns, consider the output
|
|
|
|
while the errant application is open and running.
|
|
|
|
.Ss IOCTL Support
|
|
|
|
The driver supports most of the
|
|
|
|
.Tn OSS
|
|
|
|
.Fn ioctl
|
|
|
|
functions, and most applications work unmodified.
|
|
|
|
A few differences exist, while memory mapped playback is
|
2004-06-16 08:33:57 +00:00
|
|
|
supported natively and in
|
|
|
|
.Tn Linux
|
|
|
|
emulation, memory mapped recording is
|
2003-11-15 06:08:57 +00:00
|
|
|
not due to
|
|
|
|
.Tn VM
|
|
|
|
system design.
|
|
|
|
As a consequence, some applications may need to be recompiled
|
|
|
|
with a slightly modified audio module.
|
2003-06-28 23:53:39 +00:00
|
|
|
See
|
2003-09-08 19:57:22 +00:00
|
|
|
.In sys/soundcard.h
|
2003-11-15 06:08:57 +00:00
|
|
|
for a complete list of the supported
|
|
|
|
.Fn ioctl
|
|
|
|
functions.
|
2000-07-20 14:19:17 +00:00
|
|
|
.Sh FILES
|
2003-11-15 19:53:22 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
drivers may create the following
|
|
|
|
device nodes:
|
2000-07-22 10:23:06 +00:00
|
|
|
.Pp
|
2004-06-16 08:33:57 +00:00
|
|
|
.Bl -tag -width ".Pa /dev/audio%d.%d" -compact
|
2003-11-15 06:08:57 +00:00
|
|
|
.It Pa /dev/audio%d.%d
|
|
|
|
Sparc-compatible audio device.
|
|
|
|
.It Pa /dev/dsp%d.%d
|
|
|
|
Digitized voice device.
|
|
|
|
.It Pa /dev/dspW%d.%d
|
2000-07-22 10:23:06 +00:00
|
|
|
Like
|
|
|
|
.Pa /dev/dsp ,
|
2003-11-15 06:08:57 +00:00
|
|
|
but 16 bits per sample.
|
|
|
|
.It Pa /dev/dspr%d.%d
|
|
|
|
Should be connected to a record codec.
|
|
|
|
.It Pa /dev/sndstat
|
|
|
|
Current
|
|
|
|
.Nm
|
|
|
|
status, including all channels and drivers.
|
2000-07-20 14:19:17 +00:00
|
|
|
.El
|
2000-07-22 10:23:06 +00:00
|
|
|
.Pp
|
2003-11-15 19:53:22 +00:00
|
|
|
The first number in the device node
|
|
|
|
represents the unit number of the
|
2004-06-16 08:33:57 +00:00
|
|
|
.Nm
|
2003-11-15 19:53:22 +00:00
|
|
|
device.
|
|
|
|
All
|
|
|
|
.Nm
|
|
|
|
devices are listed
|
|
|
|
in
|
2004-06-16 08:33:57 +00:00
|
|
|
.Pa /dev/sndstat .
|
2003-11-15 19:53:22 +00:00
|
|
|
Additional messages are sometimes recorded when the
|
|
|
|
device is probed and attached, these messages can be viewed with the
|
2000-07-22 10:23:06 +00:00
|
|
|
.Xr dmesg 8
|
|
|
|
utility.
|
2003-11-15 06:08:57 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2004-06-16 08:33:57 +00:00
|
|
|
.Bl -diag
|
2000-01-15 06:25:09 +00:00
|
|
|
.It ac97: dac not ready
|
|
|
|
AC97 codec is not likely to be accompanied with the sound card.
|
|
|
|
.It unsupported subdevice XX
|
|
|
|
A device node is not created properly.
|
1998-08-09 19:42:53 +00:00
|
|
|
.El
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh SEE ALSO
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_ad1816 4 ,
|
|
|
|
.Xr snd_als4000 4 ,
|
2005-11-28 16:47:52 +00:00
|
|
|
.Xr snd_atiixp 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_audiocs 4 ,
|
|
|
|
.Xr snd_cmi 4 ,
|
|
|
|
.Xr snd_cs4281 4 ,
|
2005-01-21 08:36:40 +00:00
|
|
|
.Xr snd_csa 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_ds1 4 ,
|
|
|
|
.Xr snd_emu10k1 4 ,
|
|
|
|
.Xr snd_es137x 4 ,
|
|
|
|
.Xr snd_ess 4 ,
|
|
|
|
.Xr snd_fm801 4 ,
|
2005-01-21 08:36:40 +00:00
|
|
|
.Xr snd_gusc 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_ich 4 ,
|
|
|
|
.Xr snd_maestro 4 ,
|
|
|
|
.Xr snd_maestro3 4 ,
|
2005-10-10 17:49:40 +00:00
|
|
|
.Xr snd_mss 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_neomagic 4 ,
|
2005-01-21 08:36:40 +00:00
|
|
|
.Xr snd_sbc 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_solo 4 ,
|
2005-08-15 17:56:04 +00:00
|
|
|
.Xr snd_t4dwave 4 ,
|
2005-05-22 15:25:14 +00:00
|
|
|
.Xr snd_uaudio 4 ,
|
|
|
|
.Xr snd_via8233 4 ,
|
|
|
|
.Xr snd_via82c686 4 ,
|
|
|
|
.Xr snd_vibes 4 ,
|
2005-01-21 08:36:40 +00:00
|
|
|
.Xr devfs 5 ,
|
|
|
|
.Xr loader.conf 5 ,
|
|
|
|
.Xr dmesg 8 ,
|
|
|
|
.Xr kldload 8 ,
|
|
|
|
.Xr sysctl 8
|
|
|
|
.Rs
|
|
|
|
.%T "The OSS API"
|
|
|
|
.%O "http://www.opensound.com/pguide/oss.pdf"
|
|
|
|
.Re
|
1998-08-09 19:42:53 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2000-02-08 21:32:12 +00:00
|
|
|
.Nm
|
1998-08-09 19:42:53 +00:00
|
|
|
device driver first appeared in
|
2004-06-16 08:33:57 +00:00
|
|
|
.Fx 2.2.6
|
2004-09-08 08:28:02 +00:00
|
|
|
as
|
|
|
|
.Nm pcm ,
|
2004-06-16 08:33:57 +00:00
|
|
|
written by
|
|
|
|
.An Luigi Rizzo .
|
2003-11-15 06:08:57 +00:00
|
|
|
It was later
|
2000-02-08 21:32:12 +00:00
|
|
|
rewritten in
|
2004-06-16 08:33:57 +00:00
|
|
|
.Fx 4.0
|
|
|
|
by
|
|
|
|
.An Cameron Grant .
|
2003-11-15 06:08:57 +00:00
|
|
|
The API evolved from the VOXWARE
|
|
|
|
standard which later became OSS standard.
|
1999-08-15 10:48:36 +00:00
|
|
|
.Sh AUTHORS
|
2003-11-15 06:08:57 +00:00
|
|
|
.An -nosplit
|
1999-08-15 10:48:36 +00:00
|
|
|
.An Luigi Rizzo Aq luigi@iet.unipi.it
|
2000-03-20 14:18:31 +00:00
|
|
|
initially wrote the
|
2004-09-08 08:28:02 +00:00
|
|
|
.Nm pcm
|
2000-03-20 14:18:31 +00:00
|
|
|
device driver and this manual page.
|
2000-01-15 06:25:09 +00:00
|
|
|
.An Cameron Grant Aq gandalf@vilnya.demon.co.uk
|
2003-11-15 06:08:57 +00:00
|
|
|
later revised the device driver for
|
|
|
|
.Fx 4.0 .
|
2000-01-15 06:25:09 +00:00
|
|
|
.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
|
|
|
|
revised this manual page.
|
2003-11-15 06:08:57 +00:00
|
|
|
It was then rewritten for
|
2004-06-16 08:33:57 +00:00
|
|
|
.Fx 5.2 .
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Some features of your cards (e.g., global volume control) might not
|
|
|
|
be supported on all devices.
|