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