rename the top-level Makefile.cfgparam to cfgparam.mk
[unleashed.git] / share / man / man7i / mixer.7i
blob6516e78d1e86df54847822e95a1342668b03ca05
1 '\" te
2 .\"  Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
5 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH MIXER 7I "May 21, 2009"
7 .SH NAME
8 mixer \- generic mixer device interface
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB#include\fR \fB<sys/soundcard.h>\fR
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 \&.
19 .SS "Mixer Pseudo-Device"
20 .sp
21 .LP
22 The \fB/dev/mixer\fR pseudo-device is provided for two purposes:
23 .RS +4
24 .TP
25 .ie t \(bu
26 .el o
27 The first purpose is for applications that wish to learn about the list of
28 audio devices on the system, so that they can select (or provide for users to
29 select) an appropriate audio device. The \fB/dev/mixer\fR pseudo-device
30 provides interfaces to enumerate all of the audio devices on the system.
31 .RE
32 .RS +4
33 .TP
34 .ie t \(bu
35 .el o
36 The second purpose is for mixer panel type applications which need to control
37 master settings for the audio hardware in the system, such as gain levels,
38 balance, port functionality, and other device features.
39 .RE
40 .sp
41 .LP
42 Ordinary audio applications should \fBnot\fR attempt to adjust their playback
43 or record volumes or other device settings using this device. Instead, they
44 should use the \fBSNDCTL_DSP_SETPLAYVOL\fR and \fBSNDCTL_DSP_SETRECVOL\fR
45 ioctls that are documented in \fBdsp\fR(7I).
46 .SS "Sndstat Device"
47 .sp
48 .LP
49 The \fB/dev/sndstat\fR device supports \fBread\fR(2), and can be read to
50 retrieve human-readable information about the audio devices on the system.
51 Software should not attempt to interpret the contents of this device.
52 .SH IOCTLS
53 .SS "Information IOCTLs"
54 .sp
55 .LP
56 The following ioctls are intended to aid applications in identifying the audio
57 devices available on the system. These ioctls can be issued against either the
58 pseudo-device \fB/dev/mixer\fR, or a against a file descriptor open to any
59 other audio device in the system.
60 .sp
61 .LP
62 Applications should issue \fBSNDCTL_SYSINFO\fR first to learn what audio
63 devices and mixers are available on the system, and then use
64 \fBSNDCTL_AUDIOINFO\fR or \fBSNDCTL_MIXERINFO\fR to obtain more information
65 about the audio devices or mixers, respectively.
66 .sp
67 .ne 2
68 .na
69 \fB\fBOSS_GETVERSION\fR\fR
70 .ad
71 .RS 20n
72 The argument is a pointer to an integer, which retrieves the version of the
73 \fBOSS API\fR used. The value is encoded with the major version (currently 4)
74 encoded in the most significant 16 bits, and a minor version encoded in the
75 lower 16 bits.
76 .RE
78 .sp
79 .ne 2
80 .na
81 \fB\fBSNDCTL_SYSINFO\fR\fR
82 .ad
83 .RS 20n
84 The argument is a pointer to an \fBoss_sysinfo\fR structure, which has the
85 following definition:
86 .sp
87 .in +2
88 .nf
89 typedef struct oss_sysinfo {
90    char product[32];   /* E.g. SunOS Audio */
91    char version[32];   /* E.g. 4.0a */
92    int versionnum;     /* See OSS_GETVERSION */
93    char options[128];  /* NOT SUPPORTED */
95    int numaudios;      /* # of audio/dsp devices */
96    int openedaudio[8]; /* Reserved, always 0 */
98  int numsynths;        /* NOT SUPPORTED, always 0 */
99  int nummidis;         /* NOT SUPPORTED, always 0 */
100  int numtimers;        /* NOT SUPPORTED, always 0 */
101  int nummixers;        /* # of mixer devices */
103  int openedmidi[8];    /* Mask of midi devices are
104                           busy */
105  int numcards;         /* Number of sound cards in
106                           the system */
107  int numaudioengines;  /* Number of audio engines in
108                           the system */
109  char license[16];     /* E.g. "GPL" or "CDDL" */
110  char revision_info[256];  /* Reserved */
111  int filler[172];          /* Reserved */
112 } oss_sysinfo;
114 .in -2
117 The important fields here are \fBnumaudios\fR, which is used to determine the
118 number of audio devices that can be queried with \fBSNDCTL_AUDIOINFO\fR,
119 \fBnummixers\fR which provides a count of mixers on the system, and
120 \fBnumcards\fR which counts to total number of aggregate devices. A \fBcard\fR
121 can consist of one or more audio devices and one or more mixers, although more
122 typically there is exactly one audio device and one mixer for each card.
126 .ne 2
128 \fB\fBSNDCTL_AUDIOINFO\fR\fR
130 .RS 20n
131 The argument is a pointer to an \fBoss_audioinfo\fR structure, which has the
132 following structure:
134 .in +2
136 typedef struct oss_audioinfo {
137    int dev;  /* Device to query */
138    char name[64];  /* Human readable name */
139    int busy;  /* reserved */
140    int pid;  /* reserved */
141    int caps;  /* PCM_CAP_INPUT, PCM_CAP_OUTPUT */
142    int iformats;  /* Supported input formats */
143    int oformats;  /* Supported output formats */
144    int magic;  /* reserved */
145    char cmd[64];  /* reserved */
146    int card_number;
147    int port_number;  /* reserved */
148    int mixer_dev;
149    int legacy_device; /* Obsolete field.
150                          Replaced by devnode */
151    int enabled;  /* reserved */
152    int flags;  /* reserved */
153    int min_rate;  /* Minimum sample rate */
154    int max_rate;  /* Maximum sample rate */
155    int min_channels;  /* Minimum number
156                          of channels */
157    int max_channels;  /* Maximum number
158                          of channels */
159    int binding;  /* reserved */
160    int rate_source;  /* reserved */
161    char handle[32];  /* reserved */
162    unsigned int nrates;  /* reserved */
163    unsigned int rates[20];  /* reserved */
164    char song_name[64];  /* reserved */
165    char label[16];  /* reserved */
166    int latency;  /* reserved */
167    char devnode[32];  /* Device special file
168                          name (absolute path) */
169    int next_play_engine;  /* reserved */
170    int next_rec_engine;  /* reserved */
171    int filler[184];  /* reserved */
172 } oss_audioinfo;
174 .in -2
177 In the above structure, all of the fields are reserved except the following:
178 d\fBev, name, card_number, mixer_dev, caps, min_rate, max_rate, min_channels,
179 max_channels,\fR and \fBdevnode\fR. The reserved fields are provided for
180 compatibility with other OSS implementations, and available for legacy
181 applications. New applications should not attempt to use these fields.
183 The \fBdev\fR field should be initialized by the application to the number of
184 the device to query. This is a number between zero (inclusive) and value of
185 \fBnumaudios\fR (exclusive) returned by \fBSNDCTL_SYSINFO\fR. Alternatively,
186 when issuing the ioctl against a real mixer or \fBdsp\fR device, the special
187 value \fB-1\fR can be used to indicate that the query is being made against the
188 device opened. If \fB-1\fR is used, the field is overwritten with the device
189 number for the current device on successful return.
191 No other fields are significant upon entry, but a successful return contains
192 details of the device.
194 The \fBname\fR field is a human readable name representing the device.
195 Applications should not try to interpret it.
197 The \fBcard_number\fR field indicates the number assigned to the aggregate
198 device. This can be used with the \fBSNDCTL_CARDINFO\fR ioctl.
200 The \fBmixer_dev\fR is the mixer device number for the mixing device associated
201 with the audio device. This can be used with the \fBSNDCTL_MIXERINFO\fR ioctl.
203 The caps field contains any of the bits \fBPCM_CAP_INPUT\fR,
204 \fBPCM_CAP_OUTPUT\fR, and \fBPCM_CAP_DUPLEX\fR. Indicating whether the device
205 support input, output, and whether input and output can be used simultaneously.
206 All other bits are reserved.
208 The \fBmin_rate\fR and \fBmax_rate\fR fields indicate the minimum and maximum
209 sample rates supported by the device. Most applications should try to use the
210 maximum supported rate for the best audio quality and lowest system resource
211 consumption.
213 The \fBmin_channels\fR and \fBmax_channels\fR provide an indication of the
214 number of channels (1 for mono, 2 for stereo, 6 for 5.1, etc.) supported by the
215 device.
217 The \fBdevnode\fR field contains the actual full path to the device node for
218 this device, such as \fB/dev/sound/audio810:0dsp\fR. Applications should open
219 this file to access the device.
223 .ne 2
225 \fB\fBSNDCTL_CARDINFO\fR\fR
227 .RS 20n
228 The argument is a pointer to a \fBstruct oss_card_info\fR, which has the
229 following definition:
231 .in +2
233 typedef struct oss_card_info {
234 int card;
235  char shortname[16];
236  char longname[128];
237  int flags;/* reserved */
238  char hw_info[400];
239  int intr_count;/* reserved */
240  int ack_count;/* reserved */
241  int filler[154];
242 } oss_card_info;
244 .in -2
247 This ioctl is used to query for information about the aggregate audio device.
249 The \fBcard\fR field should be initialized by the application to the number of
250 the card to query. This is a number between zero inclusive and value of
251 \fBnumcards\fR (exclusive) returned by \fBSNDCTL_SYSINFO\fR.) Alternatively,
252 when issuing the ioctl against a real mixer or \fBdsp\fR device, the special
253 value \fB-1\fR can be used to indicate that the query is being made against the
254 device opened. If \fB-1\fR is used, the field is overwritten with the number
255 for the current hardware device on successful return.
257 The \fBshortname\fR, \fBlongname\fR, and \fBhw_info\fR contain \fBASCIIZ\fR
258 strings describing the device in more detail. The \fBhw_info\fR member can
259 contain multiple lines of detail, each line ending in a NEWLINE.
261 The flag, intr_count, and ack_count fields are not used by this implementation.
265 .ne 2
267 \fB\fBSNDCTL_MIXERINFO\fR\fR
269 .RS 20n
270 The argument is a pointer to a \fBstruct oss_mixer_info\fR, which has the
271 following definition:
273 .in +2
275 typedef struct oss_mixerinfo {
276   int dev;
277   char id[16];/* Reserved */
278   char name[32];
279   int modify_counter;
280   int card_number;
281   int port_number;/* Reserved */
282   char handle[32];/* Reserved */
283   int magic;/* Reserved */
284   int enabled;/* Reserved */
285   int caps;/* Reserved */
286   int flags;/* Reserved */
287   int nrext;
288   int priority;
289   char devnode[32];/* Device special file name
290                      (absolute path) */
291   int legacy_device;/* Reserved */
292   int filler[245];/* Reserved */
293 } oss_mixerinfo;
295 .in -2
298 In the above structure, all of the fields are reserved except the following:
299 \fBdev, name, modify_counter, card_number, nrext, priority,\fR and
300 \fBdevnode\fR. The reserved fields are provided for compatibility with other
301 OSS implementations, and available for legacy applications.  New applications
302 should not attempt to use these fields.
304 The \fBdev\fR field should be initialized by the application to the number of
305 the device to query. This is a number between zero inclusive and value of
306 \fBnummixers\fR (exclusive) returned by \fBSNDCTL_SYSINFO\fR, or by
307 \fBSNDCTL_MIX_NRMIX\fR. Alternatively, when issuing the ioctl against a real
308 mixer or \fBdsp\fR device, the special value \fB-1\fR can be used to indicate
309 that the query is being made against the device opened. If \fB-1\fR is used,
310 the field is overwritten with the mixer number for the current open file on
311 successful return.
313 No other fields are significant upon entry, but on successful return contains
314 details of the device.
316 The \fBname\fR field is a human readable name representing the device.
317 Applications should not try to interpret it.
319 The \fBmodify_counter\fR is changed by the mixer framework each time the
320 settings for the various controls or extensions of the device are changed.
321 Applications can poll this value to learn if any other changes need to be
322 searched for.
324 The \fBcard_number\fR field is the number of the aggregate audio device this
325 mixer is located on. It can be used with the \fBSNDCTL_CARDINFO\fR ioctl.
327 The \fBnrext\fR field is the number of mixer extensions available on this
328 mixer. See the \fBSNDCTL_MIX_NREXT\fR description.
330 The priority is used by the framework to assign a preference that applications
331 can use in choosing a device. Higher values are preferable. Mixers with
332 priorities less than -1 should never be selected by default.
334 The \fBdevnode\fR field contains the actual full path to the device node for
335 the physical mixer, such as \fB/dev/sound/audio810:0mixer\fR. Applications
336 should open this file to access the mixer settings.
339 .SS "Mixer Extension IOCTLs"
342 The pseudo \fB/dev/mixer\fR device supports ioctls that can change     the
343 various settings for the audio hardware in the system.
346 Those ioctls should only be used by dedicated mixer applications  or desktop
347 volume controls, and not by typical ordinary audio applications such as media
348 players. Ordinary applications that wish to adjust their own volume settings
349 should use the \fBSNDCTL_DSP_SETPLAYVOL\fR or \fBSNDCTL_DSP_SETRECVOL\fR ioctls
350 for that purpose.  See \fBdsp\fR(7I) for more information.  Ordinary
351 applications should never attempt to change master port selection or hardware
352 settings such as monitor gain settings.
355 The ioctls in this section can only be used to access the mixer device that is
356 associated with the current file descriptor.
359 Applications should not assume that a single \fB/dev/mixer\fR node is able to
360 access any physical settings. Instead, they should use the ioctl
361 \fBSNDCTL_MIXERINFO\fR to determine the device path for the real mixer device,
362 and issue ioctls on a file descriptor opened against the corresponding
363 \fBdevnode\fR field.
366 When a \fBdev\fR member is specified in each of the following ioctls, the
367 application should specify \fB-1\fR, although for compatibility the mixer
368 allows the application to specify the mixer device number.
370 .ne 2
372 \fB\fBSNDCTL_MIX_NRMIX\fR\fR
374 .RS 23n
375 The argument is a pointer to an integer, which receives the number of mixer
376 devices in the system. Each can be queried by using its number with the
377 \fBSNDCTL_MIXERINFO\fR ioctl. The same information is available using the
378 \fBSNDCTL_SYSINFO\fR ioctl.
382 .ne 2
384 \fB\fBSNDCTL_MIX_NREXT\fR\fR
386 .RS 23n
387 The argument is a pointer to an integer. On entry, the integer should contain
388 the special value \fB-1\fR. On return the argument receives the number of mixer
389 extensions (or mixer controls) supported by the mixer device. More details
390 about each extension can be obtained by \fBSNDCTL_MIX_EXTINFO\fR ioctl.
394 .ne 2
396 \fB\fBSNDCTL_MIX_EXTINFO\fR\fR
398 .RS 23n
399 The argument is a pointer to an \fBoss_mixext\fR structure which is defined as
400 follows:
402 .in +2
404 typedef struct oss_mixext {
405    int dev;  /* Mixer device number */
406    int ctrl;  /* Extension number */
407    int type;  /* Entry type */
408    int maxvalue;
409    int minvalue;
410    int flags;
411    char id[16];  /* Mnemonic ID (internal use) */
412    int parent;   /* Entry# of parent
413                     (-1 if root) */
414    int dummy;   /* NOT SUPPORTED */
415    int timestamp;
416    char data[64];  /* Reserved */
417    unsigned char enum_present[32];  /* Mask
418                                        of allowed
419                                        enum
420                                        values */
421    int control_no;  /* Reserved */
422    unsigned int desc;  /* NOT SUPPORTED */
423    char extname[32];
424    int update_counter;
425    int filler[7];  /* Reserved */
426 } oss_mixext;
428 .in -2
431 On entry, the \fBdev\fR field should be initialized to the value \fB-1\fR, and
432 the \fBctrl\fR field should be initialized with the number of the extension
433 being accessed. Between 0, inclusive, and the value returned by
434 \fBSNDCTL_MIX_NREXT\fR, exclusive.
436 Mixer extensions are organized as a logical tree, starting with a root node.
437 The root node always has a \fBctrl\fR value of zero. The structure of the tree
438 can be determined by looking at the parent field, which contains the extension
439 number of the parent extension, or \fB-1\fR if the extension is the root
440 extension.
442 The type indicates the type of extension used. This implementation supports the
443 following values:
445 .in +2
447 MIXT_DEVROOT      Root node for extension tree
448 MIXT_GROUP        Logical grouping of controls
449 MXIT_ONOFF        Boolean value, 0 = off, 1 = on.
450 MIXT_ENUM         Enumerated value, 0 to maxvalue.
451 MIXT_MONOSLIDER   Monophonic slider, 0 to 255.
452 MIXT_STEREOSLIDER Stereophonic slider, 0 to 255
453                   (encoded as
454                   lower two bytes in value.)
455 MIXT_MARKER       Place holder, can ignore.
457 .in -2
460 The flags field is a bit array. This implementation makes use of the following
461 possible bits:
463 .in +2
465 MIXF_READABLE    Extension's value is readable.
466 MIXF_WRITEABLE   Extension's value is modifiable.
467 MIXF_POLL        Extension can self-update.
468 MIXF_PCMVOL      Extension is for master
469                  PCM playback volume.
470 MIXF_MAINVOL     Extension is for a typical
471                  analog volume
472 MIXF_RECVOL      Extension is for master
473                  record gain.
474 MIXF_MONVOL      Extension is for a monitor
475                  source's gain.
477 .in -2
480 The \fBid\fR field contains an \fBASCIIZ\fR identifier for the extension.
482 The timestamp field is set when the extension tree is first initialized.
483 Applications must use the same timestamp value when attempting to change the
484 values. A change in the timestamp indicates a change a in the structure of the
485 extension tree.
487 The \fBenum_present\fR field is a bit mask of possible enumeration values. If a
488 bit is present in the \fBenum_present\fR mask, then the corresponding
489 enumeration value is legal. The mask is in little endian order.
491 The \fBdesc\fR field provides information about scoping, which can be useful as
492 layout hints to applications. The following hints are available:
494 .in +2
496 MIXEXT_SCOPE_MASK    Mask of possible scope
497                      values.
498 MIXEXT_SCOPE_INPUT   Extension is an input
499                      control.
500 MIXEXT_SCOPE_OUTPUT  Extension is an
501                      output control.
502 MIXEXT_SCOPE_MONITOR Extension relates to
503                      input monitoring.
504 MIXEXT_SCOPE_OTHER   No scoping hint provided.
506 .in -2
509 The \fBextname\fR is the full name of the extension.
511 The \fBupdate_counter\fR is incremented each time the control's value is
512 changed.
516 .ne 2
518 \fB\fBSNDCTL_MIX_ENUMINFO\fR\fR
520 .RS 23n
521 The argument is a pointer to an \fBoss_mixer_enuminfo\fR structure, which is
522 defined as follows:
524 .in +2
526 typedef struct oss_mixer_enuminfo {
527    int dev;
528    int ctrl;
529    int nvalues;
530    int version;
531    short strindex[255];
532    char strings[3000];
533 } oss_mixer_enuminfo;
535 .in -2
538 On entry, the \fBdev\fR field should be initialized to the value \fB-1\fR, and
539 the \fBctrl\fR field should be initialized with the number of the extension
540 being accessed. Between 0, inclusive, and the value returned by
541 \fBSNDCTL_MIX_NREXT\fR, exclusive.
543 On return the \fBnvalues\fR field contains the number of values, and
544 \fBstrindex\fR contains an array of indices into the strings member, each index
545 pointing to an \fBASCIIZ\fR describing the enumeration value.
549 .ne 2
551 \fB\fBSNDCTL_MIX_READ\fR\fR
555 \fB\fBSNDCTL_MIX_WRITE\fR\fR
557 .RS 23n
558 The argument is a pointer to an \fBoss_mixer_value\fR structure, defined as
559 follows:
561 .in +2
563 typedef struct oss_mixer_value {
564    int dev;
565    int ctrl;
566    int value;
567    int flags;  /* Reserved for future use.
568                   Initialize to 0 */
569    int timestamp;  /* Must be set to
570                       oss_mixext.timestamp */
571    int filler[8];  /* Reserved for future use.
572                       Initialize to 0 */
573 } oss_mixer_value;
575 .in -2
578 On entry, the \fBdev\fR field should be initialized to the value \fB-1\fR, and
579 the \fBctrl\fR field should be initialized with the number of the extension
580 being accessed. Between 0, inclusive, and the value returned by
581 \fBSNDCTL_MIX_NREXT\fR, exclusive. Additionally, the timestamp member must be
582 initialized to the same value as was supplied in the \fBoss_mixext\fR structure
583 used with \fBSNDCTL_MIX_EXTINFO\fR.
585 For \fBSNDCTL_MIX_WRITE\fR, the application should supply the new value for the
586 extension. For \fBSNDCTL_MIX_READ\fR, the mixer returns the extensions current
587 value in value.
590 .SS "Compatibility IOCTLs"
593 The following ioctls are for compatibility use only:
595 .in +2
597 SOUND_MIXER_READ_VOLUME
598 SOUND_MIXER_READ_PCM
599 SOUND_MIXER_READ_OGAIN
600 SOUND_MIXER_READ_RECGAIN
601 SOUND_MIXER_READ_RECLEV
602 SOUND_MIXER_READ_IGAIN
603 SOUND_MIXER_READ_RECSRC
604 SOUND_MIXER_READ_RECMASK
605 SOUND_MIXER_READ_DEVMASK
606 SOUND_MIXER_READ_STEREODEVS
607 SOUND_MIXER_WRITE_VOLUME
608 SOUND_MIXER_WRITE_PCM
609 SOUND_MIXER_WRITE_OGAIN
610 SOUND_MIXER_WRITE_RECGAIN
611 SOUND_MIXER_WRITE_RECLEV
612 SOUND_MIXER_WRITE_IGAIN
613 SOUND_MIXER_WRITE_RECSRC
614 SOUND_MIXER_WRITE_RECMASK
615 SOUND_MIXER_INFO
616 SNDCTL_AUDIOINFO_EX
617 SNDCTL_ENGINEINFO
619 .in -2
624 These ioctls can affect the software volume levels associated with the calling
625 process. They have no effect on the physical hardware levels or settings. They
626 should not be used in new applications.
627 .SH ERRORS
630 An \fBioctl()\fR fails if:
632 .ne 2
634 \fB\fBEINVAL\fR\fR
636 .RS 10n
637 The parameter changes requested in the ioctl are invalid or are not supported
638 by the device.
642 .ne 2
644 \fB\fBENXIO\fR\fR
646 .RS 10n
647 The device or extension referenced does not exist.
650 .SH FILES
652 .ne 2
654 \fB\fB/dev/mixer\fR\fR
656 .RS 16n
657 Symbolic link to the pseudo mixer device for the system
661 .ne 2
663 \fB\fB/dev/sndstat\fR\fR
665 .RS 16n
666 Sound status device
669 .SH ATTRIBUTES
672 See \fBattributes\fR(5) for a description of the following attributes:
677 box;
678 c | c
679 l | l .
680 ATTRIBUTE TYPE  ATTRIBUTE VALUE
682 Architecture    SPARC, x86
684 Stability Level See below.
689 The information and mixer extension IOCTLs are Uncommitted. The Compatibility
690 IOCTLs are Obsolete Uncommitted. The extension names are Uncommitted.
691 .SH SEE ALSO
694 \fBclose\fR(2), \fBioctl\fR(2), \fBopen\fR(2), , \fBread\fR(2),
695 \fBattributes\fR(5), \fBdsp\fR(7I)
696 .SH BUGS
699 The names of mixer extensions are not guaranteed to be predictable.