1.\" $NetBSD: audio.4,v 1.103 2020/03/28 05:47:41 wiz 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 March 28, 2020 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. 69It can be opened at any time and can be used to manipulate the 70audio device while it is in use. 71.Sh SAMPLING DEVICES 72When 73.Pa /dev/audio 74is opened, it automatically sets the track to manipulate 75monaural 8-bit mu-law 8000Hz. 76When 77.Pa /dev/sound 78is opened, it maintains the audio format and pause/unpause 79state of the most recently opened track. 80In all other respects 81.Pa /dev/audio 82and 83.Pa /dev/sound 84are identical. 85.Pp 86On a full-duplex device, reads and writes may operate concurrently 87without interference. 88If a full-duplex capable audio device is opened for both reading and writing 89it will start in play mode but not start in record mode. 90.Pp 91On a half-duplex device, if there are any recording descriptors already, 92opening with write mode will fail. 93Similarly, if there are any playback descriptors already, 94opening with read mode will fail. 95If both playback and recording are requested on a half-duplex device, 96it will be treated as playback mode. 97.Pp 98On either type of device, opening with write mode will start in playback mode, 99opening with read mode will start in recording mode. 100.Pp 101If the playback mode is paused then silence is 102played instead of the provided samples, and if recording is paused then 103the process blocks in 104.Xr read 2 105until recording is unpaused. 106.Pp 107If a writing process does not call 108.Xr write 2 109frequently enough to provide samples at the pace the hardware 110consumes them silence is inserted. 111If a reading process does not call 112.Xr read 2 113frequently enough, it will simply miss samples. 114.Pp 115The audio driver supports track multiplexing. 116All sampling devices can be opened at any time without interference. 117For playback, all tracks opened simultaneously are mixed, 118even if their specified format is different. 119For recording, recorded data is distributed to all opened tracks, 120even if their specified format is different. 121To achieve this, the audio driver has a small efficient encoding converter, 122a channel mixer, and a frequency converter. 123The frequency conversion adapts the simplest way 124(interpolation method for upward, and simple thinning method for downward) 125due to restriction in kernel resources and processing time. 126It will work well in most case but don't expect excessive quality. 127.Pp 128The audio device is normally accessed with 129.Xr read 2 130or 131.Xr write 2 132calls, but it can also be mapped into user memory with 133.Xr mmap 2 . 134Once the device has been mapped it can no longer be accessed 135by read or write; all access is by reading and writing to 136the mapped memory. 137The mmap'ped buffer appears as a block of memory of size 138.Va buffersize 139(as available via 140.Dv AUDIO_GETINFO 141or 142.Dv AUDIO_GETBUFINFO ) . 143The audio driver will continuously move data from this buffer 144from/to the mixing buffer, wrapping around at the end of the buffer. 145To find out where the hardware is currently accessing data in the buffer the 146.Dv AUDIO_GETIOFFS 147and 148.Dv AUDIO_GETOOFFS 149calls can be used. 150Note that 151.Xr mmap 2 152no longer maps hardware buffers directly. 153Now it is achieved by emulation so don't expect any improvements excessively 154rather than normal 155.Xr write 2 . 156For historical reasons, only encodings that are not set 157.Dv AUDIO_ENCODINGFLAG_EMULATED 158are able to 159.Xr mmap 2 . 160.Pp 161The audio device, like most devices, can be used in 162.Xr select 2 , 163can be set in non-blocking mode and can be set (with a 164.Dv FIOASYNC 165ioctl) to send a 166.Dv SIGIO 167when I/O is possible. 168The mixer device can be set to generate a 169.Dv SIGIO 170whenever a mixer value is changed. 171.Pp 172The following 173.Xr ioctl 2 174commands are supported on the sample devices: 175.Bl -tag -width indent 176.It Dv AUDIO_FLUSH 177This command stops all playback and recording, clears all queued 178buffers, resets error counters on this track, 179and restarts recording and playback as 180appropriate for the current sampling mode. 181.It Dv AUDIO_PERROR (int) 182.It Dv AUDIO_RERROR (int) 183This command fetches the count of dropped output (input) 184bytes into its integer argument. 185There is no information regarding when in the sample stream 186they were dropped. 187.It Dv AUDIO_WSEEK (u_long) 188This command fetches the count of bytes that are queued ahead of the 189first sample in the most recent sample block written into its integer argument. 190.It Dv AUDIO_DRAIN 191This command suspends the calling process until all queued playback 192samples have been played. 193.It Dv AUDIO_GETDEV (audio_device_t) 194This command fetches the current hardware device information into the 195.Vt audio_device_t 196argument. 197.Bd -literal 198typedef struct audio_device { 199 char name[MAX_AUDIO_DEV_LEN]; 200 char version[MAX_AUDIO_DEV_LEN]; 201 char config[MAX_AUDIO_DEV_LEN]; 202} audio_device_t; 203.Ed 204.It Dv AUDIO_GETENC (audio_encoding_t) 205This command is used iteratively to fetch sample encoding names and 206format ids into the input/output audio_encoding_t argument. 207The encoding returned by the command is user accessible encoding and 208is not hardware supported encoding. 209.Bd -literal 210typedef struct audio_encoding { 211 int index; /* input: nth encoding */ 212 char name[MAX_AUDIO_DEV_LEN]; /* name of encoding */ 213 int encoding; /* value for encoding parameter */ 214 int precision; /* value for precision parameter */ 215 int flags; 216#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */ 217} audio_encoding_t; 218.Ed 219.Pp 220To query 221all the supported encodings, start with an index field of 0 and 222continue with successive encodings (1, 2, ...) until the command returns 223an error. 224.It Dv AUDIO_GETFD (int) 225This command is obsolete. 226.It Dv AUDIO_SETFD (int) 227This command is obsolete. 228.It Dv AUDIO_GETPROPS (int) 229This command gets a bit set of hardware properties. 230If the hardware 231has a certain property the corresponding bit is set, otherwise it is not. 232The properties can have the following values: 233.Pp 234.Bl -tag -width AUDIO_PROP_INDEPENDENT -compact 235.It Dv AUDIO_PROP_FULLDUPLEX 236the device admits full duplex operation. 237.It Dv AUDIO_PROP_MMAP 238the device can be used with 239.Xr mmap 2 . 240.It Dv AUDIO_PROP_INDEPENDENT 241the device can set the playing and recording encoding parameters 242independently. 243.It Dv AUDIO_PROP_PLAYBACK 244the device is capable of audio playback. 245.It Dv AUDIO_PROP_CAPTURE 246the device is capable of audio capture. 247.El 248.It Dv AUDIO_GETIOFFS (audio_offset_t) 249.It Dv AUDIO_GETOOFFS (audio_offset_t) 250This command fetches the current offset in the input(output) buffer where 251the track mixer will be putting(getting) data. 252It mostly useful when the device 253buffer is available in user space via the 254.Xr mmap 2 255call. 256The information is returned in the 257.Vt audio_offset_t 258structure. 259.Bd -literal 260typedef struct audio_offset { 261 u_int samples; /* Total number of bytes transferred */ 262 u_int deltablks; /* Blocks transferred since last checked */ 263 u_int offset; /* Physical transfer offset in buffer */ 264} audio_offset_t; 265.Ed 266.It Dv AUDIO_GETINFO (audio_info_t) 267.It Dv AUDIO_GETBUFINFO (audio_info_t) 268.It Dv AUDIO_SETINFO (audio_info_t) 269Get or set audio information as encoded in the audio_info structure. 270For historical reasons, the audio_info structure has three different 271layer's parameters: track, track mixer and hardware rich mixer. 272.Bd -literal 273typedef struct audio_info { 274 struct audio_prinfo play; /* info for play (output) side */ 275 struct audio_prinfo record; /* info for record (input) side */ 276 u_int monitor_gain; /* input to output mix [HWmixer] */ 277 /* BSD extensions */ 278 u_int blocksize; /* read/write block size [track] */ 279 u_int hiwat; /* output high water mark [track] */ 280 u_int lowat; /* output low water mark [track] */ 281 u_int _ispare1; 282 u_int mode; /* current operation mode [track] */ 283#define AUMODE_PLAY 0x01 284#define AUMODE_RECORD 0x02 285#define AUMODE_PLAY_ALL 0x04 /* Not used anymore */ 286} audio_info_t; 287.Ed 288.Pp 289When setting the current state with 290.Dv AUDIO_SETINFO , 291the audio_info structure should first be initialized with 292.Li AUDIO_INITINFO(&info) 293and then the particular values to be changed should be set. 294This allows the audio driver to only set those things that you wish 295to change and eliminates the need to query the device with 296.Dv AUDIO_GETINFO 297or 298.Dv AUDIO_GETBUFINFO 299first. 300.Pp 301The 302.Va mode 303field indicates current operation mode, either one of 304.Dv AUMODE_PLAY 305or 306.Dv AUMODE_RECORD . 307These two flags can not be changed once this descriptor is opened. 308For playback mode, the obsolete 309.Dv AUMODE_PLAY_ALL 310flag can be set but has no effect. 311.Pp 312.Va hiwat 313and 314.Va lowat 315are used to control write behavior. 316Writes to the audio devices will queue up blocks until the high-water 317mark is reached, at which point any more write calls will block 318until the queue is drained to the low-water mark. 319.Va hiwat 320and 321.Va lowat 322set those high- and low-water marks (in audio blocks). 323The default for 324.Va hiwat 325is the maximum value and for 326.Va lowat 32775% of 328.Va hiwat . 329.Pp 330.Va blocksize 331sets the current audio blocksize. 332The generic audio driver layer and the hardware driver have the 333opportunity to adjust this block size to get it within 334implementation-required limits. 335Normally the 336.Va blocksize 337is calculated to correspond to the value of the 338.Em hw.audioX.blk_ms 339sysctl and is recalculated when the encoding parameters change. 340If the descriptor is opened for read only, 341.Va blocksize 342indicates the blocksize for the recording track. 343Otherwise, 344.Va blocksize 345indicates the blocksize for the playback track. 346.Bd -literal 347struct audio_prinfo { 348 u_int sample_rate; /* sample rate in samples/s [track] */ 349 u_int channels; /* number of channels, usually 1 or 2 [track] */ 350 u_int precision; /* number of bits/sample [track] */ 351 u_int encoding; /* data encoding (AUDIO_ENCODING_* below) [track] */ 352 u_int gain; /* volume level [HWmixer] */ 353 u_int port; /* selected I/O port [HWmixer] */ 354 u_long seek; /* BSD extension [track] */ 355 u_int avail_ports; /* available I/O ports [HWmixer] */ 356 u_int buffer_size; /* total size audio buffer [track] */ 357 u_int _ispare[1]; 358 u_int samples; /* number of samples [track] */ 359 u_int eof; /* End Of File (zero-size writes) counter [track] */ 360 u_char pause; /* non-zero if paused, zero to resume [track] */ 361 u_char error; /* non-zero if underflow/overflow occurred [track] */ 362 u_char waiting; /* non-zero if another process hangs in open [track] */ 363 u_char balance; /* stereo channel balance [HWmixer] */ 364 u_char cspare[2]; 365 u_char open; /* non-zero if currently open [trackmixer] */ 366 u_char active; /* non-zero if I/O is currently active [trackmixer] */ 367}; 368.Ed 369.Pp 370Note: many hardware audio drivers require identical playback and 371recording sample rates, sample encodings, and channel counts. 372The playing information is always set last and will prevail on such hardware. 373If the hardware can handle different settings the 374.Dv AUDIO_PROP_INDEPENDENT 375property is set. 376.Pp 377The encoding parameter can have the following values: 378.Pp 379.Bl -tag -width AUDIO_ENCODING_SLINEAR_BE -compact 380.It Dv AUDIO_ENCODING_ULAW 381mu-law encoding, 8 bits/sample 382.It Dv AUDIO_ENCODING_ALAW 383A-law encoding, 8 bits/sample 384.It Dv AUDIO_ENCODING_SLINEAR 385two's complement signed linear encoding with the platform byte order 386.It Dv AUDIO_ENCODING_ULINEAR 387unsigned linear encoding 388with the platform byte order 389.It Dv AUDIO_ENCODING_ADPCM 390ADPCM encoding, 8 bits/sample 391.It Dv AUDIO_ENCODING_SLINEAR_LE 392two's complement signed linear encoding with little endian byte order 393.It Dv AUDIO_ENCODING_SLINEAR_BE 394two's complement signed linear encoding with big endian byte order 395.It Dv AUDIO_ENCODING_ULINEAR_LE 396unsigned linear encoding with little endian byte order 397.It Dv AUDIO_ENCODING_ULINEAR_BE 398unsigned linear encoding with big endian byte order 399.It Dv AUDIO_ENCODING_AC3 400Dolby Digital AC3 401.El 402.Pp 403The 404.Nm 405driver accepts the following formats. 406.Va encoding 407and 408.Va precision 409are one of the values obtained by 410.Dv AUDIO_GETENC , 411regardless of formats supported by underlying driver. 412.Va frequency 413ranges from 1000Hz to 192000Hz, 414regardless of frequency (ranges) supported by underlying driver. 415.Va channels 416depends your underlying driver. 417If the underlying driver only supports monaural (1channel) 418or stereo (2channels), you can specify 1 or 2 regardless of 419number of channels supported by underlying driver. 420If the underlying driver supports three or more channels, you can specify 421the number of channels supported by the underlying driver or less. 422.Pp 423The 424.Va gain , 425.Va port 426and 427.Va balance 428settings provide simple shortcuts to the richer mixer 429interface described below and are not obtained by 430.Dv AUDIO_GETBUFINFO . 431The gain should be in the range 432.Bq Dv AUDIO_MIN_GAIN , Dv AUDIO_MAX_GAIN 433and the balance in the range 434.Bq Dv AUDIO_LEFT_BALANCE , Dv AUDIO_RIGHT_BALANCE 435with the normal setting at 436.Dv AUDIO_MID_BALANCE . 437.Pp 438The input port should be a combination of: 439.Pp 440.Bl -tag -width AUDIO_MICROPHONE -compact 441.It Dv AUDIO_MICROPHONE 442to select microphone input. 443.It Dv AUDIO_LINE_IN 444to select line input. 445.It Dv AUDIO_CD 446to select CD input. 447.El 448.Pp 449The output port should be a combination of: 450.Pp 451.Bl -tag -width AUDIO_HEADPHONE -compact 452.It Dv AUDIO_SPEAKER 453to select speaker output. 454.It Dv AUDIO_HEADPHONE 455to select headphone output. 456.It Dv AUDIO_LINE_OUT 457to select line output. 458.El 459.Pp 460The available ports can be found in 461.Va avail_ports 462.Dv ( AUDIO_GETBUFINFO 463only). 464.Pp 465.Va buffer_size 466is the total size of the audio buffer. 467The buffer size divided by the 468.Va blocksize 469gives the maximum value for 470.Va hiwat . 471Currently the 472.Va buffer_size 473can only be read and not set. 474.Pp 475The 476.Va seek 477and 478.Va samples 479fields are only used by 480.Dv AUDIO_GETINFO 481and 482.Dv AUDIO_GETBUFINFO . 483.Va seek 484represents the count of 485bytes pending; 486.Va samples 487represents the total number of bytes recorded or played, less those 488that were dropped due to inadequate consumption/production rates. 489.Pp 490.Va pause 491returns the current pause/unpause state for recording or playback. 492For 493.Dv AUDIO_SETINFO , 494if the pause value is specified it will either pause 495or unpause the particular direction. 496.It Dv AUDIO_QUERYFORMAT (audio_format_query_t) 497This command enumerates formats supported by the hardware. 498Similarly to 499.Dv AUDIO_GETENC , 500to query all the supported formats, 501start with an index field of 0 and continue with successive formats 502(1, 2, ...) until the command returns an error. 503.Bd -literal 504typedef struct audio_format_query { 505 u_int index; 506 struct audio_format fmt; 507} audio_format_query_t; 508.Ed 509.It Dv AUDIO_GETFORMAT (audio_info_t) 510This command fetches the current hardware format. 511Only the following members in audio_info_t are used. 512Members which are not listed here or belong in invalid direction are 513filled by \-1. 514.Bl -bullet 515.It 516mode 517.It 518play.encoding 519.It 520play.precision 521.It 522play.channels 523.It 524play.sample_rate 525.It 526record.encoding 527.It 528record.precision 529.It 530record.channels 531.It 532record.sample_rate 533.El 534.Pp 535.Va mode 536indicates which direction is valid. 537.It Dv AUDIO_SETFORMAT (audio_info_t) 538This command sets the hardware format. 539It will fail if there are any opened descriptors. 540So obviously, it must be issued on 541.Pa /dev/audioctl . 542Similarly to 543.Dv AUDIO_GETFORMAT , 544only above members in audio_info_t are used. 545Members which is not listed or belong in invalid direction are ignored. 546The parameters can be chosen from the choices obtained by 547.Dv AUDIO_QUERYFORMAT . 548.It Dv AUDIO_GETCHAN (int) 549This command is obsolete. 550.It Dv AUDIO_SETCHAN (int) 551This command is obsolete. 552.El 553.Sh MIXER DEVICE 554The mixer device, 555.Pa /dev/mixer , 556may be manipulated with 557.Xr ioctl 2 558but does not support 559.Xr read 2 560or 561.Xr write 2 . 562It supports the following 563.Xr ioctl 2 564commands: 565.Bl -tag -width indent 566.It Dv AUDIO_GETDEV (audio_device_t) 567This command is the same as described above for the sampling devices. 568.It Dv AUDIO_MIXER_READ (mixer_ctrl_t) 569.It Dv AUDIO_MIXER_WRITE (mixer_ctrl_t) 570These commands read the current mixer state or set new mixer state for 571the specified device 572.Va dev . 573.Va type 574identifies which type of value is supplied in the 575.Vt mixer_ctrl_t 576argument. 577.Bd -literal 578#define AUDIO_MIXER_CLASS 0 579#define AUDIO_MIXER_ENUM 1 580#define AUDIO_MIXER_SET 2 581#define AUDIO_MIXER_VALUE 3 582typedef struct mixer_ctrl { 583 int dev; /* input: nth device */ 584 int type; 585 union { 586 int ord; /* enum */ 587 int mask; /* set */ 588 mixer_level_t value; /* value */ 589 } un; 590} mixer_ctrl_t; 591 592#define AUDIO_MIN_GAIN 0 593#define AUDIO_MAX_GAIN 255 594typedef struct mixer_level { 595 int num_channels; 596 u_char level[8]; /* [num_channels] */ 597} mixer_level_t; 598#define AUDIO_MIXER_LEVEL_MONO 0 599#define AUDIO_MIXER_LEVEL_LEFT 0 600#define AUDIO_MIXER_LEVEL_RIGHT 1 601.Ed 602.Pp 603For a mixer value, the 604.Va value 605field specifies both the number of channels and the values for each 606channel. 607If the channel count does not match the current channel count, the 608attempt to change the setting may fail (depending on the hardware 609device driver implementation). 610For an enumeration value, the 611.Va ord 612field should be set to one of the possible values as returned by a prior 613.Dv AUDIO_MIXER_DEVINFO 614command. 615The type 616.Dv AUDIO_MIXER_CLASS 617is only used for classifying particular mixer device 618types and is not used for 619.Dv AUDIO_MIXER_READ 620or 621.Dv AUDIO_MIXER_WRITE . 622.It Dv AUDIO_MIXER_DEVINFO (mixer_devinfo_t) 623This command is used iteratively to fetch audio mixer device information 624into the input/output 625.Vt mixer_devinfo_t 626argument. 627To query all the supported devices, start with an index field of 6280 and continue with successive devices (1, 2, ...) until the 629command returns an error. 630.Bd -literal 631typedef struct mixer_devinfo { 632 int index; /* input: nth mixer device */ 633 audio_mixer_name_t label; 634 int type; 635 int mixer_class; 636 int next, prev; 637#define AUDIO_MIXER_LAST -1 638 union { 639 struct audio_mixer_enum { 640 int num_mem; 641 struct { 642 audio_mixer_name_t label; 643 int ord; 644 } member[32]; 645 } e; 646 struct audio_mixer_set { 647 int num_mem; 648 struct { 649 audio_mixer_name_t label; 650 int mask; 651 } member[32]; 652 } s; 653 struct audio_mixer_value { 654 audio_mixer_name_t units; 655 int num_channels; 656 int delta; 657 } v; 658 } un; 659} mixer_devinfo_t; 660.Ed 661.Pp 662The 663.Va label 664field identifies the name of this particular mixer control. 665The 666.Va index 667field may be used as the 668.Va dev 669field in 670.Dv AUDIO_MIXER_READ 671and 672.Dv AUDIO_MIXER_WRITE 673commands. 674The 675.Va type 676field identifies the type of this mixer control. 677Enumeration types are typically used for on/off style controls (e.g. a 678mute control) or for input/output device selection (e.g. select 679recording input source from CD, line in, or microphone). 680Set types are similar to enumeration types but any combination 681of the mask bits can be used. 682.Pp 683The 684.Va mixer_class 685field identifies what class of control this is. 686The 687.Pq arbitrary 688value set by the hardware driver may be determined by examining the 689.Va mixer_class 690field of the class itself, 691a mixer of type 692.Dv AUDIO_MIXER_CLASS . 693For example, a mixer controlling the input gain on the line in circuit 694would have a 695.Va mixer_class 696that matches an input class device with the name 697.Dq inputs 698.Dv ( AudioCinputs ) , 699and would have a 700.Va label 701of 702.Dq line 703.Dv ( AudioNline ) . 704Mixer controls which control audio circuitry for a particular audio 705source (e.g. line-in, CD in, DAC output) are collected under the input class, 706while those which control all audio sources (e.g. master volume, 707equalization controls) are under the output class. 708Hardware devices capable of recording typically also have a record class, 709for controls that only affect recording, 710and also a monitor class. 711.Pp 712The 713.Va next 714and 715.Va prev 716may be used by the hardware device driver to provide hints for the next 717and previous devices in a related set (for example, the line in level 718control would have the line in mute as its 719.Dq next 720value). 721If there is no relevant next or previous value, 722.Dv AUDIO_MIXER_LAST 723is specified. 724.Pp 725For 726.Dv AUDIO_MIXER_ENUM 727mixer control types, 728the enumeration values and their corresponding names are filled in. 729For example, a mute control would return appropriate values paired with 730.Dv AudioNon 731and 732.Dv AudioNoff . 733For 734.Dv AUDIO_MIXER_VALUE 735and 736.Dv AUDIO_MIXER_SET 737mixer control types, the channel count is 738returned; the units name specifies what the level controls (typical 739values are 740.Dv AudioNvolume , 741.Dv AudioNtreble , 742.Dv AudioNbass ) . 743.\" For AUDIO_MIXER_SET mixer control types, what is what? 744.El 745.Pp 746By convention, all the mixer devices can be distinguished from other 747mixer controls because they use a name from one of the 748.Dv AudioC* 749string values. 750.Sh FILES 751.Bl -tag -width /dev/audioctl -compact 752.It Pa /dev/audio 753.It Pa /dev/audioctl 754.It Pa /dev/sound 755.It Pa /dev/mixer 756.El 757.Sh SEE ALSO 758.Xr audiocfg 1 , 759.Xr audioctl 1 , 760.Xr audioplay 1 , 761.Xr audiorecord 1 , 762.Xr mixerctl 1 , 763.Xr ioctl 2 , 764.Xr ossaudio 3 , 765.Xr acorn32/vidcaudio 4 , 766.\" .Xr amiga/aucc 4 , 767.\" .Xr amiga/melody 4 , 768.Xr arcofi 4 , 769.Xr aria 4 , 770.Xr auacer 4 , 771.Xr audiocs 4 , 772.Xr auich 4 , 773.Xr auixp 4 , 774.\" .Xr ausoc 4 , 775.Xr autri 4 , 776.Xr auvia 4 , 777.Xr bba 4 , 778.Xr btsco 4 , 779.Xr clcs 4 , 780.Xr clct 4 , 781.Xr cmpci 4 , 782.Xr dreamcast/aica 4 , 783.Xr eap 4 , 784.Xr emuxki 4 , 785.Xr esa 4 , 786.Xr esm 4 , 787.Xr eso 4 , 788.Xr ess 4 , 789.\" .Xr evbarm/aaci 4 , 790.\" .Xr evbarm/digfilt 4 , 791.\" .Xr evbarm/pxaacu 4 , 792.\" .Xr evbarm/udassio 4 , 793.Xr fms 4 , 794.Xr gcscaudio 4 , 795.Xr gus 4 , 796.Xr guspnp 4 , 797.Xr hdafg 4 , 798.Xr hdaudio 4 , 799.Xr hppa/harmony 4 , 800.Xr macppc/awacs 4 , 801.Xr macppc/snapper 4 , 802.Xr midi 4 , 803.Xr neo 4 , 804.Xr pad 4 , 805.Xr pas 4 , 806.\" .Xr paud 4 , 807.Xr radio 4 , 808.\" .Xr repluse 4 , 809.Xr sb 4 , 810.Xr sgimips/haltwo 4 , 811.Xr sgimips/mavb 4 , 812.Xr sparc/audioamd 4 , 813.Xr sparc/dbri 4 , 814.Xr sv 4 , 815.\" .Xr toccata 4 , 816.Xr uaudio 4 , 817.\" .Xr vaudio 4 , 818.\" .Xr vcaudio 4 , 819.\" .Xr vraiu 4 , 820.\" .Xr vsaudio 4 , 821.Xr wss 4 , 822.Xr x68k/vs 4 , 823.Xr yds 4 , 824.Xr ym 4 825.\" .Xr zaudio 4 826.Sh HISTORY 827Support for virtual channels and mixing first appeared in 828.Nx 8.0 . 829.Sh BUGS 830If the device is used in 831.Xr mmap 2 832it is currently always mapped for writing (playing) due to VM system weirdness. 833