xref: /netbsd-src/share/man/man4/audio.4 (revision 2e2322c9c07009df921d11b1268f8506affbb8ba)
1.\"	$NetBSD: audio.4,v 1.73 2016/12/12 11:49:27 nat Exp $
2.\"
3.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by John T. Kohl.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd December 11, 2016
31.Dt AUDIO 4
32.Os
33.Sh NAME
34.Nm audio
35.Nd device-independent audio driver layer
36.Sh SYNOPSIS
37.In sys/audioio.h
38.Sh DESCRIPTION
39The
40.Nm
41driver provides support for various audio peripherals.
42It provides a uniform programming interface layer above different
43underlying audio hardware drivers.
44The audio layer provides full-duplex operation if the
45underlying hardware configuration supports it.
46.Pp
47There are four device files available for audio operation:
48.Pa /dev/audio ,
49.Pa /dev/sound ,
50.Pa /dev/audioctl ,
51and
52.Pa /dev/mixer .
53.Pp
54.Pa /dev/audio
55and
56.Pa /dev/sound
57are used for recording or playback of digital samples.
58.Pp
59.Pa /dev/mixer
60is used to manipulate volume, recording source, or other audio mixer
61functions.
62.Pp
63.Pa /dev/audioctl
64accepts the same
65.Xr ioctl 2
66operations as
67.Pa /dev/sound ,
68but no other operations.
69.Pp
70.Pa /dev/sound
71and
72.Pa /dev/audio
73can be opened at
74.Em any
75time and audio sources of different precision and playback
76parameters i.e frequency will be mixed and played back simultaneously.
77.Pp
78.Pa /dev/audioctl
79can be used to manipulate the audio device
80while it is in use.
81.Sh SAMPLING DEVICES
82When
83.Pa /dev/audio
84is opened, it automatically directs the underlying driver to manipulate
85monaural 8-bit mu-law samples.
86In addition, if it is opened read-only
87(write-only) the device is set to half-duplex record (play) mode with
88recording (playing) unpaused and playing (recording) paused.
89When
90.Pa /dev/sound
91is opened, it maintains the previous audio sample mode and
92record/playback mode most recently set on
93.Pa /dev/sound
94by any open channel.
95In all other respects
96.Pa /dev/audio
97and
98.Pa /dev/sound
99are identical.
100.Sh VIRTUAL CHANNELS
101Any process may open a sampling device at a given time.
102There is a constraint of
103.Em one
104device per process and file descriptors may
105.Em not
106be shared between processes.
107.Pp
108Virtual channels are converted to a common format, signed linear encoding,
109frequency channels and precision.
110These can be modified to taste by the following
111.Xr sysctl 8
112variables.
113.Pp
114.Bl -tag -width -compact
115.It hw.driverN.precision
116.It hw.driverN.frequency
117.It hw.driverN.channels
118.It hw.driverN.saturate
119.El
120.Pp
121Where
122.Em driverN
123corresponds to the underlying audio device driver and device number.
124e.g In the case of an hdafg supported device the variables would be:
125hw.hdafg0.channels, hw.hdafg0.precision, hw.hdafg0.frequency.
126.Pp
127For best results, values close to the underlying hardware should be chosen.
128These variables may only be changed when the sampling device is not in use.
129.Pp
130An additional
131.Xr sysctl 8
132variable controls how the samples are combined, hw.driverN.saturate.
133.Pp
134By default it is set to true.
135This means that volumes are not adjusted for each channel to be mixed.
136All virtual channels will use the
137.Em maximum
138set master volume unless the virtual channel volume is lowered by the user.
139.Pp
140If set to false the channels are
141.Em divided
142evenly in volume with respect to the master volume.
143.Pp
144Each virtual channel has a corresponding mixer:
145.Bl -tag -width -compact
146.It outputs.dacN  Output volume
147.It inputs.micN   Recording volume
148.El
149.Pp
150Where N is the virtual channel number.
151e.g ouputs.dac0 controlling playback volume and outputs.mic0 controlling
152recording volume for the first virtual channel.
153.Pp
154On a half-duplex device, writes while recording is in progress will be
155immediately discarded.
156Similarly, reads while playback is in progress
157will be filled with silence but delayed to return at the current
158sampling rate.
159If both playback and recording are requested on a half-duplex
160device, playback mode takes precedence and recordings will get silence.
161.Pp
162On a full-duplex device, reads and writes may operate
163concurrently without interference.
164If a full-duplex capable audio device is opened for both reading and writing
165it will start in half-duplex play mode; full-duplex mode has to be set
166explicitly.
167.Pp
168On either type of device, if the playback mode is paused then silence is
169played instead of the provided samples, and if recording is paused then
170the process blocks in
171.Xr read 2
172until recording is unpaused.
173.Pp
174If a writing process does not call
175.Xr write 2
176frequently enough to provide samples at the pace the hardware
177consumes them silence is inserted.
178If the
179.Dv AUMODE_PLAY_ALL
180mode is not set the writing process must
181provide enough data via
182subsequent write calls to
183.Dq catch up
184in time to the current audio
185block before any more process-provided samples will be played.
186If a reading process does not call
187.Xr read 2
188frequently enough, it will simply miss samples.
189.Pp
190The audio device is normally accessed with
191.Xr read 2
192or
193.Xr write 2
194calls, but it can also be mapped into user memory with
195.Xr mmap 2
196(when supported by the device).
197Once the device has been mapped it can no longer be accessed
198by read or write; all access is by reading and writing to
199the mapped memory.
200The device appears as a block of memory
201of size
202.Va buffersize
203(as available via
204.Dv AUDIO_GETINFO
205or
206.Dv AUDIO_GETBUFINFO ) .
207The device driver will continuously move data from this buffer
208from/to the audio hardware, wrapping around at the end of the buffer.
209To find out where the hardware is currently accessing data in the buffer the
210.Dv AUDIO_GETIOFFS
211and
212.Dv AUDIO_GETOOFFS
213calls can be used.
214The playing and recording buffers are distinct and must be
215mapped separately if both are to be used.
216Only encodings that are not emulated (i.e. where
217.Dv AUDIO_ENCODINGFLAG_EMULATED
218is not set) work properly for a mapped device.
219.Pp
220The audio device, like most devices, can be used in
221.Va select ,
222can be set in non-blocking mode and can be set (with a
223.Dv FIOASYNC
224ioctl) to send a
225.Dv SIGIO
226when I/O is possible.
227The mixer device can be set to generate a
228.Dv SIGIO
229whenever a mixer value is changed.
230.Pp
231The following
232.Xr ioctl 2
233commands are supported on the sample devices:
234.Pp
235.Bl -tag -width indent
236.It Dv AUDIO_SETPROC (struct audio_pid)
237This command will select the audio device opened by pid.
238.Bd -literal
239struct audio_pid {
240        pid_t   pid;
241        lwpid_t lwpid;
242};
243.Ed
244.Pp
245Currently the lpwid value is
246.Em ignored .
247.It Dv AUDIO_FLUSH
248This command stops all playback and recording, clears all queued
249buffers, resets error counters, and restarts recording and playback as
250appropriate for the current sampling mode.
251.It Dv AUDIO_RERROR (int)
252This command fetches the count of dropped input samples into its integer
253argument.
254There is no information regarding when in the sample stream
255they were dropped.
256.It Dv AUDIO_WSEEK (u_long)
257This command fetches the count of samples that are queued ahead of the
258first sample in the most recent sample block written into its integer argument.
259.It Dv AUDIO_DRAIN
260This command suspends the calling process until all queued playback
261samples have been played by the hardware.
262.It Dv AUDIO_GETDEV (audio_device_t)
263This command fetches the current hardware device information into the
264audio_device_t argument.
265.Bd -literal
266typedef struct audio_device {
267        char name[MAX_AUDIO_DEV_LEN];
268        char version[MAX_AUDIO_DEV_LEN];
269        char config[MAX_AUDIO_DEV_LEN];
270} audio_device_t;
271.Ed
272.It Dv AUDIO_GETFD (int)
273The command returns the current setting of the full duplex mode.
274.It Dv AUDIO_GETENC (audio_encoding_t)
275This command is used iteratively to fetch sample encoding names and
276format_ids into the input/output audio_encoding_t argument.
277.Bd -literal
278typedef struct audio_encoding {
279	int index;      /* input: nth encoding */
280	char name[MAX_AUDIO_DEV_LEN]; /* name of encoding */
281	int encoding;   /* value for encoding parameter */
282	int precision;  /* value for precision parameter */
283	int flags;
284#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
285} audio_encoding_t;
286.Ed
287.Pp
288To query
289all the supported encodings, start with an index field of 0 and
290continue with successive encodings (1, 2, ...) until the command returns
291an error.
292.It Dv AUDIO_SETFD (int)
293This command sets the device into full-duplex operation if its integer
294argument has a non-zero value, or into half-duplex operation if it
295contains a zero value.
296If the device does not support full-duplex
297operation, attempting to set full-duplex mode returns an error.
298.It Dv AUDIO_GETPROPS (int)
299This command gets a bit set of hardware properties.
300If the hardware
301has a certain property the corresponding bit is set, otherwise it is not.
302The properties can have the following values:
303.Pp
304.Bl -tag -width AUDIO_PROP_INDEPENDENT -compact
305.It Dv AUDIO_PROP_FULLDUPLEX
306the device admits full duplex operation.
307.It Dv AUDIO_PROP_MMAP
308the device can be used with
309.Xr mmap 2 .
310.It Dv AUDIO_PROP_INDEPENDENT
311the device can set the playing and recording encoding parameters
312independently.
313.It Dv AUDIO_PROP_PLAYBACK
314the device is capable of audio playback.
315.It Dv AUDIO_PROP_CAPTURE
316the device is capable of audio capture.
317.El
318.It Dv AUDIO_GETIOFFS (audio_offset_t)
319.It Dv AUDIO_GETOOFFS (audio_offset_t)
320This command fetches the current offset in the input(output) buffer where
321the audio hardware's DMA engine will be putting(getting) data.
322It mostly useful when the device
323buffer is available in user space via the
324.Xr mmap 2
325call.
326The information is returned in the audio_offset structure.
327.Bd -literal
328typedef struct audio_offset {
329	u_int	samples;   /* Total number of bytes transferred */
330	u_int	deltablks; /* Blocks transferred since last checked */
331	u_int	offset;    /* Physical transfer offset in buffer */
332} audio_offset_t;
333.Ed
334.It Dv AUDIO_GETINFO (audio_info_t)
335.It Dv AUDIO_GETBUFINFO (audio_info_t)
336.It Dv AUDIO_SETINFO (audio_info_t)
337Get or set audio information as encoded in the audio_info structure.
338.Bd -literal
339typedef struct audio_info {
340	struct	audio_prinfo play;   /* info for play (output) side */
341	struct	audio_prinfo record; /* info for record (input) side */
342        u_int	monitor_gain;			/* input to output mix */
343	/* BSD extensions */
344	u_int	blocksize;	/* H/W read/write block size */
345	u_int	hiwat;		/* output high water mark */
346	u_int	lowat;		/* output low water mark */
347	u_int	_ispare1;
348	u_int	mode;		/* current device mode */
349#define AUMODE_PLAY	0x01
350#define AUMODE_RECORD	0x02
351#define AUMODE_PLAY_ALL 0x04	/* do not do real-time correction */
352} audio_info_t;
353.Ed
354.Pp
355When setting the current state with
356.Dv AUDIO_SETINFO ,
357the audio_info structure should first be initialized with
358.Dv AUDIO_INITINFO Po \*[Am]info Pc
359and then the particular values to be changed should be set.
360This allows the audio driver to only set those things that you wish
361to change and eliminates the need to query the device with
362.Dv AUDIO_GETINFO
363or
364.Dv AUDIO_GETBUFINFO
365first.
366.Pp
367The
368.Va mode
369field should be set to
370.Dv AUMODE_PLAY ,
371.Dv AUMODE_RECORD ,
372.Dv AUMODE_PLAY_ALL ,
373or a bitwise OR combination of the three.
374Only full-duplex audio devices support
375simultaneous record and playback.
376.Pp
377.Va hiwat
378and
379.Va lowat
380are used to control write behavior.
381Writes to the audio devices will queue up blocks until the high-water
382mark is reached, at which point any more write calls will block
383until the queue is drained to the low-water mark.
384.Va hiwat
385and
386.Va lowat
387set those high- and low-water marks (in audio blocks).
388The default for
389.Va hiwat
390is the maximum value and for
391.Va lowat
39275 % of
393.Va hiwat .
394.Pp
395.Va blocksize
396sets the current audio blocksize.
397The generic audio driver layer and the hardware driver have the
398opportunity to adjust this block size to get it within
399implementation-required limits.
400Upon return from an
401.Dv AUDIO_SETINFO
402call, the actual blocksize set is returned in this field.
403Normally the
404.Va blocksize
405is calculated to correspond to 50ms of sound and it is recalculated
406when the encoding parameter changes, but if the
407.Va blocksize
408is set explicitly this value becomes sticky, i.e., it remains
409even when the encoding is changed.
410The stickiness can be cleared by reopening the device or setting the
411.Va blocksize
412to 0.
413.Bd -literal
414struct audio_prinfo {
415	u_int	sample_rate;	/* sample rate in samples/s */
416	u_int	channels;	/* number of channels, usually 1 or 2 */
417	u_int	precision;	/* number of bits/sample */
418	u_int	encoding;	/* data encoding (AUDIO_ENCODING_* below) */
419	u_int	gain;		/* volume level */
420	u_int	port;		/* selected I/O port */
421	u_long	seek;		/* BSD extension */
422	u_int	avail_ports;	/* available I/O ports */
423	u_int	buffer_size;	/* total size audio buffer */
424	u_int	_ispare[1];
425	/* Current state of device: */
426	u_int	samples;	/* number of samples */
427	u_int	eof;		/* End Of File (zero-size writes) counter */
428	u_char	pause;		/* non-zero if paused, zero to resume */
429	u_char	error;		/* non-zero if underflow/overflow occurred */
430	u_char	waiting;	/* non-zero if another process hangs in open */
431	u_char	balance;	/* stereo channel balance */
432	u_char	cspare[2];
433	u_char	open;		/* non-zero if currently open */
434	u_char	active;		/* non-zero if I/O is currently active */
435};
436.Ed
437.Pp
438Note:  many hardware audio drivers require identical playback and
439recording sample rates, sample encodings, and channel counts.
440The playing information is always set last and will prevail on such hardware.
441If the hardware can handle different settings the
442.Dv AUDIO_PROP_INDEPENDENT
443property is set.
444.Pp
445The encoding parameter can have the following values:
446.Pp
447.Bl -tag -width AUDIO_ENCODING_SLINEAR_BE -compact
448.It Dv AUDIO_ENCODING_ULAW
449mu-law encoding, 8 bits/sample
450.It Dv AUDIO_ENCODING_ALAW
451A-law encoding, 8 bits/sample
452.It Dv AUDIO_ENCODING_SLINEAR
453two's complement signed linear encoding with the platform byte order
454.It Dv AUDIO_ENCODING_ULINEAR
455unsigned linear encoding with the platform byte order
456.It Dv AUDIO_ENCODING_ADPCM
457ADPCM encoding, 8 bits/sample
458.It Dv AUDIO_ENCODING_SLINEAR_LE
459two's complement signed linear encoding with little endian byte order
460.It Dv AUDIO_ENCODING_SLINEAR_BE
461two's complement signed linear encoding with big endian byte order
462.It Dv AUDIO_ENCODING_ULINEAR_LE
463unsigned linear encoding with little endian byte order
464.It Dv AUDIO_ENCODING_ULINEAR_BE
465unsigned linear encoding with big endian byte order
466.It Dv AUDIO_ENCODING_AC3
467Dolby Digital AC3
468.El
469.Pp
470The
471.Va gain ,
472.Va port
473and
474.Va balance
475settings provide simple shortcuts to the richer mixer
476interface described below and are not obtained by
477.Dv AUDIO_GETBUFINFO .
478The gain should be in the range
479.Bq Dv AUDIO_MIN_GAIN , Dv AUDIO_MAX_GAIN
480and the balance in the range
481.Bq Dv AUDIO_LEFT_BALANCE , Dv AUDIO_RIGHT_BALANCE
482with the normal setting at
483.Dv AUDIO_MID_BALANCE .
484.Pp
485The input port should be a combination of:
486.Pp
487.Bl -tag -width AUDIO_MICROPHONE -compact
488.It Dv AUDIO_MICROPHONE
489to select microphone input.
490.It Dv AUDIO_LINE_IN
491to select line input.
492.It Dv AUDIO_CD
493to select CD input.
494.El
495.Pp
496The output port should be a combination of:
497.Pp
498.Bl -tag -width AUDIO_HEADPHONE -compact
499.It Dv AUDIO_SPEAKER
500to select speaker output.
501.It Dv AUDIO_HEADPHONE
502to select headphone output.
503.It Dv AUDIO_LINE_OUT
504to select line output.
505.El
506.Pp
507The available ports can be found in
508.Va avail_ports
509.Dv ( AUDIO_GETBUFINFO
510only).
511.Pp
512.Va buffer_size
513is the total size of the audio buffer.
514The buffer size divided by the
515.Va blocksize
516gives the maximum value for
517.Va hiwat .
518Currently the
519.Va buffer_size
520can only be read and not set.
521.Pp
522The
523.Va seek
524and
525.Va samples
526fields are only used by
527.Dv AUDIO_GETINFO
528and
529.Dv AUDIO_GETBUFINFO .
530.Va seek
531represents the count of
532samples pending;
533.Va samples
534represents the total number of bytes recorded or played, less those
535that were dropped due to inadequate consumption/production rates.
536.Pp
537.Va pause
538returns the current pause/unpause state for recording or playback.
539For
540.Dv AUDIO_SETINFO ,
541if the pause value is specified it will either pause
542or unpause the particular direction.
543.El
544.Sh MIXER DEVICE
545The mixer device,
546.Pa /dev/mixer ,
547may be manipulated with
548.Xr ioctl 2
549but does not support
550.Xr read 2
551or
552.Xr write 2 .
553It supports the following
554.Xr ioctl 2
555commands:
556.Bl -tag -width indent
557.It Dv AUDIO_GETDEV (audio_device_t)
558This command is the same as described above for the sampling devices.
559.It Dv AUDIO_MIXER_READ (mixer_ctrl_t)
560.It Dv AUDIO_MIXER_WRITE (mixer_ctrl_t)
561These commands read the current mixer state or set new mixer state for
562the specified device
563.Va dev .
564.Va type
565identifies which type of value is supplied in the
566.Va mixer_ctrl_t
567argument.
568.Bd -literal
569#define AUDIO_MIXER_CLASS  0
570#define AUDIO_MIXER_ENUM   1
571#define AUDIO_MIXER_SET    2
572#define AUDIO_MIXER_VALUE  3
573typedef struct mixer_ctrl {
574	int dev;			/* input: nth device */
575	int type;
576	union {
577		int ord;		/* enum */
578		int mask;		/* set */
579		mixer_level_t value;	/* value */
580	} un;
581} mixer_ctrl_t;
582
583#define AUDIO_MIN_GAIN  0
584#define AUDIO_MAX_GAIN  255
585typedef struct mixer_level {
586        int num_channels;
587        u_char level[8];               /* [num_channels] */
588} mixer_level_t;
589#define AUDIO_MIXER_LEVEL_MONO  0
590#define AUDIO_MIXER_LEVEL_LEFT  0
591#define AUDIO_MIXER_LEVEL_RIGHT 1
592.Ed
593.Pp
594For a mixer value, the
595.Va value
596field specifies both the number of channels and the values for each
597channel.
598If the channel count does not match the current channel count, the
599attempt to change the setting may fail (depending on the hardware
600device driver implementation).
601For an enumeration value, the
602.Va ord
603field should be set to one of the possible values as returned by a prior
604.Dv AUDIO_MIXER_DEVINFO
605command.
606The type
607.Dv AUDIO_MIXER_CLASS
608is only used for classifying particular mixer device
609types and is not used for
610.Dv AUDIO_MIXER_READ
611or
612.Dv AUDIO_MIXER_WRITE .
613.It Dv AUDIO_MIXER_DEVINFO (mixer_devinfo_t)
614This command is used iteratively to fetch audio mixer device information
615into the input/output mixer_devinfo_t argument.
616To query all the supported devices, start with an index field of
6170 and continue with successive devices (1, 2, ...) until the
618command returns an error.
619.Bd -literal
620typedef struct mixer_devinfo {
621	int index;		/* input: nth mixer device */
622	audio_mixer_name_t label;
623	int type;
624	int mixer_class;
625	int next, prev;
626#define AUDIO_MIXER_LAST	-1
627	union {
628		struct audio_mixer_enum {
629			int num_mem;
630			struct {
631				audio_mixer_name_t label;
632				int ord;
633			} member[32];
634		} e;
635		struct audio_mixer_set {
636			int num_mem;
637			struct {
638				audio_mixer_name_t label;
639				int mask;
640			} member[32];
641		} s;
642		struct audio_mixer_value {
643			audio_mixer_name_t units;
644			int num_channels;
645			int delta;
646		} v;
647	} un;
648} mixer_devinfo_t;
649.Ed
650.Pp
651The
652.Va label
653field identifies the name of this particular mixer control.
654The
655.Va index
656field may be used as the
657.Va dev
658field in
659.Dv AUDIO_MIXER_READ
660and
661.Dv AUDIO_MIXER_WRITE
662commands.
663The
664.Va type
665field identifies the type of this mixer control.
666Enumeration types are typically used for on/off style controls (e.g. a
667mute control) or for input/output device selection (e.g. select
668recording input source from CD, line in, or microphone).
669Set types are similar to enumeration types but any combination
670of the mask bits can be used.
671.Pp
672The
673.Va mixer_class
674field identifies what class of control this is.
675The
676.Pq arbitrary
677value set by the hardware driver may be determined by examining the
678.Va mixer_class
679field of the class itself,
680a mixer of type
681.Dv AUDIO_MIXER_CLASS .
682For example, a mixer controlling the input gain on the line in circuit
683would have a
684.Va mixer_class
685that matches an input class device with the name
686.Dq inputs
687.Dv ( AudioCinputs ) ,
688and would have a
689.Va label
690of
691.Dq line
692.Dv ( AudioNline ) .
693Mixer controls which control audio circuitry for a particular audio
694source (e.g. line-in, CD in, DAC output) are collected under the input class,
695while those which control all audio sources (e.g. master volume,
696equalization controls) are under the output class.
697Hardware devices capable of recording typically also have a record class,
698for controls that only affect recording,
699and also a monitor class.
700.Pp
701The
702.Va next
703and
704.Va prev
705may be used by the hardware device driver to provide hints for the next
706and previous devices in a related set (for example, the line in level
707control would have the line in mute as its
708.Dq next
709value).
710If there is no relevant next or previous value,
711.Dv AUDIO_MIXER_LAST
712is specified.
713.Pp
714For
715.Dv AUDIO_MIXER_ENUM
716mixer control types,
717the enumeration values and their corresponding names are filled in.
718For example, a mute control would return appropriate values paired with
719.Dv AudioNon
720and
721.Dv AudioNoff .
722For
723.Dv AUDIO_MIXER_VALUE
724and
725.Dv AUDIO_MIXER_SET
726mixer control types, the channel count is
727returned; the units name specifies what the level controls (typical
728values are
729.Dv AudioNvolume ,
730.Dv AudioNtreble ,
731.Dv AudioNbass ) .
732.\" For AUDIO_MIXER_SET mixer control types, what is what?
733.El
734.Pp
735By convention, all the mixer devices can be distinguished from other
736mixer controls because they use a name from one of the
737.Dv AudioC*
738string values.
739.Sh FILES
740.Bl -tag -width /dev/audioctl -compact
741.It Pa /dev/audio
742.It Pa /dev/audioctl
743.It Pa /dev/sound
744.It Pa /dev/mixer
745.El
746.Sh SEE ALSO
747.Xr audioctl 1 ,
748.Xr mixerctl 1 ,
749.Xr ioctl 2 ,
750.Xr ossaudio 3 ,
751.Xr midi 4 ,
752.Xr radio 4 ,
753.Xr sysctl 8
754.Ss ISA bus
755.Xr aria 4 ,
756.Xr ess 4 ,
757.Xr gus 4 ,
758.Xr guspnp 4 ,
759.Xr pas 4 ,
760.Xr sb 4 ,
761.Xr wss 4 ,
762.Xr ym 4
763.Ss PCI bus
764.Xr auacer 4 ,
765.Xr auich 4 ,
766.Xr auixp 4 ,
767.Xr autri 4 ,
768.Xr auvia 4 ,
769.Xr azalia 4 ,
770.Xr clcs 4 ,
771.Xr clct 4 ,
772.Xr cmpci 4 ,
773.Xr eap 4 ,
774.Xr emuxki 4 ,
775.Xr esa 4 ,
776.Xr esm 4 ,
777.Xr eso 4 ,
778.Xr fms 4 ,
779.Xr neo 4 ,
780.Xr sv 4 ,
781.Xr yds 4
782.Ss TURBOchannel
783.Xr bba 4
784.Ss USB
785.Xr uaudio 4
786.Sh BUGS
787.Xr mmap 2
788currently does not work and should be avoided.
789.Sh HISTORY
790Support for virtual channels and mixing first appeared in
791.Nx 8.0 .
792