summaryrefslogtreecommitdiffstats
path: root/share/man/man4/pcm.4
blob: 718d8c441273dc629781479eda82a2e7492d3218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
.\"
.\" 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.
.\"
.\" $FreeBSD$
.\"
.Dd November 14, 2003
.Dt PCM 4
.Os
.Sh NAME
.Nm pcm ,
.Nm snd
.Nd
.Fx
PCM audio device infrastructure
.Sh SYNOPSIS
For a card with bridge driver support, and a PnP card:
.Cd "device pcm"
.Pp
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"
.Sh DESCRIPTION
The
.Nm
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 .
True full duplex operation is available on most cards.
.Pp
If the sound card is supported by a bridge driver, the
.Nm
driver works in conjunction with the bridge driver.
.Pp
Apart from the usual parameters, the flags field is used to specify
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
channel, or to 0x10 + C to specify channel C.
.Pp
The driver works best with
.Tn WSS/MSS
cards, which have a very clean
architecture and an orthogonal set of features.
They also happen to be
among the cheapest audio cards on the market.
.Pp
The driver does its best to recognize the installed hardware and drive
it correctly so the user is not required to add several lines in
.Pa /boot/device.hints .
For
.Tn PCI
and
.Tn ISA
.Tn PnP
cards this is actually easy
since they identify themselves.
For legacy
.Tn ISA
cards, the driver looks for
.Tn MSS
cards at addresses 0x530 and 0x604 (unless overridden
in
.Pa /boot/device.hints ) .
.Ss Boot Variables
In general, the module
.Pa snd_foo
corresponds to
.Cd "device foo"
and can be
loaded by the boot
.Xr loader 8
via
.Xr loader.conf 5
or from the command line using the
.Xr kldload 8
utility.
Options which can be specified in
.Pa /boot/loader.conf
include:
.Bl -tag -width ".Va snd_emu10k1_load" -offset indent
.It Va snd_driver_load
.Pq Dq Li NO
If set to
.Dq Li YES ,
this option loads all available drivers.
.It Va snd_emu10k1_load
.Pq Dq Li NO
If set to
.Dq Li YES ,
only the SoundBlaster 5.1 driver and dependent modules will be loaded.
.It Va snd_foo_load
.Pq Dq Li NO
If set to
.Dq Li YES ,
load driver for card/chipset foo.
.El
.Ss VCHANs
Each device can optionally support more playback channels
that physical hardware provides by using
.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
variables are available:
.Bl -tag -width ".Va hw.snd.report_soft_formats" -offset indent
.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
.Pa /dev/dsp Ns Va ${hw.snd.unit} .
.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,
three, should be used when reporting problems.
Other options include:
.Bl -tag -width 2n
.It 0
Installed devices and their allocated bus resources.
.It 1
The number of playback, record, virtual channels, and
flags per device.
.It 2
Channel information per device including the channel's
current format, speed, and pseudo device statistics such as
buffer overruns and buffer underruns.
.It 3
File names and versions of the currently sound loaded modules.
.El
.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
supported natively and in
.Tn Linux
emulation, memory mapped recording is
not due to
.Tn VM
system design.
As a consequence, some applications may need to be recompiled
with a slightly modified audio module.
See
.In sys/soundcard.h
for a complete list of the supported
.Fn ioctl
functions.
.Ss Supported Cards
Below we include a list of supported codecs/cards.
If your sound card
is not listed here, it may be supported by a bridge driver.
.Bl -tag -width 2m
.It CS4237, CS4236, CS4232, CS4231 (ISA)
All these cards work perfectly in full duplex using the MSS mode.
This chipset is used, among others, on the A/Open AW35 and AW32, on
some Intel motherboards, and (the CS4231) on some non-PnP cards.
.Pp
The CS4232 is reported as buggy in the Voxware documentation but
I am not sure if this is true.
On one of my Intel motherboards,
capture does not work simply because the capture DMA channel is
not wired to the ISA DMA controller.
.It Yamaha OPL-SAx (ISA)
Works perfectly in all modes.
This chip is used in several PnP cards,
but also (in non-PnP mode) on motherboards and laptops (e.g., the
Toshiba Libretto).
.It OPTi931 (ISA)
The chip is buggy, but the driver has many workarounds to make it work
in full duplex because for some time these were the only full duplex
cards I could find.
U-law format uses U8 format internally because of
a bug in the chip.
.It Trident 4DWave DX/NX (PCI)
.It ENSONIQ AudioPCI ES1370/1371 (PCI)
Creative Labs SoundBlaster PCI is supported as well.
.It ESS Solo-1/1E (PCI)
.It NeoMagic 256AV/ZX (PCI)
.El
.Sh FILES
The
.Nm
drivers may create the following
device nodes:
.Pp
.Bl -tag -width ".Pa /dev/audio%d.%d" -compact
.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
Like
.Pa /dev/dsp ,
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.
.El
.Pp
The first number in the device node
represents the unit number of the
.Nm
device.
All
.Nm
devices are listed
in
.Pa /dev/sndstat .
Additional messages are sometimes recorded when the
device is probed and attached, these messages can be viewed with the
.Xr dmesg 8
utility.
.Sh DIAGNOSTICS
.Bl -diag
.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.
.El
.Sh BUGS
Some features of your cards (e.g., global volume control) might not
be supported on all devices.
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 2.2.6
written by
.An Luigi Rizzo .
It was later
rewritten in
.Fx 4.0
by
.An Cameron Grant .
The API evolved from the VOXWARE
standard which later became OSS standard.
.Sh SEE ALSO
.Xr csa 4 ,
.Xr gusc 4 ,
.Xr sbc 4 ,
.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
.Sh AUTHORS
.An -nosplit
.An Luigi Rizzo Aq luigi@iet.unipi.it
initially wrote the
.Nm
device driver and this manual page.
.An Cameron Grant Aq gandalf@vilnya.demon.co.uk
later revised the device driver for
.Fx 4.0 .
.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
revised this manual page.
It was then rewritten for
.Fx 5.2 .
OpenPOWER on IntegriCloud