Merge commit '7e3488dc6cdcb0c04e1ce167a1a3bfef83b5f2e0'
[unleashed.git] / include / sys / mixer.h
blob9abcd6121dce29155bb1f421a41bebaa163d5db7
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_MIXER_H
27 #define _SYS_MIXER_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <sys/audio.h>
35 #define AM_MIXER_MODE 0
36 #define AM_COMPAT_MODE 1
38 #define AM_DEFAULT_SAMPLERATE 8000
39 #define AM_DEFAULT_CHANNELS AUDIO_CHANNELS_MONO
40 #define AM_DEFAULT_PRECISION AUDIO_PRECISION_8
41 #define AM_DEFAULT_ENCODING AUDIO_ENCODING_ULAW
42 #define AM_DEFAULT_GAIN AUDIO_MID_GAIN
45 * Mixer ioctls.
47 #define MIOC ('M'<<8)
48 #define AUDIO_MIXER_MULTIPLE_OPEN (MIOC|10)
49 #define AUDIO_MIXER_SINGLE_OPEN (MIOC|11)
50 #define AUDIO_MIXER_GET_SAMPLE_RATES (MIOC|12)
51 #define AUDIO_MIXERCTL_GETINFO (MIOC|13)
52 #define AUDIO_MIXERCTL_SETINFO (MIOC|14)
53 #define AUDIO_MIXERCTL_GET_CHINFO (MIOC|15)
54 #define AUDIO_MIXERCTL_SET_CHINFO (MIOC|16)
55 #define AUDIO_MIXERCTL_GET_MODE (MIOC|17)
56 #define AUDIO_MIXERCTL_SET_MODE (MIOC|18)
58 #define AUDIO_MIXER_CTL_STRUCT_SIZE(num_ch) (sizeof (am_control_t) + \
59 ((num_ch - 1) * sizeof (int8_t)))
61 #define AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num_srs) \
62 (sizeof (am_sample_rates_t) + \
63 ((num_srs - 1) * sizeof (uint_t)))
66 * Mixer software features
68 #define AM_MIXER 0x00000001 /* audio mixer */
71 * am_control_t - structure that holds information on the audio device
73 struct am_control {
75 * Because a particular channel may be virtual, it isn't possible
76 * to use the normal ioctl()s to set the some of the hardware's state.
77 * Only the dev_info structure's play/record gain, balance, port, and
78 * pause members, as well as the monitor_gain and output_muted members
79 * may be modified.
81 audio_info_t dev_info;
84 * The mixer(7I) manual page shows an example of using the ch_open[]
85 * array. Each element that is set to 0 represents a channel which
86 * isn't allocated, and non-zero elements represent a channel that is
87 * alloacted. This size of this array may change, depending on the
88 * number of channels the audiosup module allocates per device.
90 int8_t ch_open[1];
92 typedef struct am_control am_control_t;
95 * am_sample_rates_t - structure for a list of supported sample rates
97 struct am_sample_rates {
99 * Set this to AUIDO_PLAY or AUDIO_RECORD, but not both, to get
100 * the play or record sample rates, respectively.
102 uint_t type;
105 * Some devices support a complete range of sample rates between the
106 * two provided in the samp_rates[] array. If this is so then this
107 * flag is set to MIXER_SR_LIMITS when AUDIO_MIXER_GET_SAMPLE_RATES
108 * returns this structure.
110 uint_t flags;
113 * Set this number to the number of sample rates to request. The
114 * mixer(7I) manual page shows an example of using this structure.
115 * When AUDIO_MIXER_GET_SAMPLE_RATES returns the number of samples
116 * available is set. This may be more or less than the number requested.
117 * If more that only the requested number of samples is arctually
118 * returned in the samp_rates array.
120 uint_t num_samp_rates;
123 * Variable size array for the supported sample rates. See the example
124 * in the mixer(7I) manual page for how to use this array.
126 uint_t samp_rates[1];
128 typedef struct am_sample_rates am_sample_rates_t;
130 /* am_sample_rates.flags defines */
131 #define MIXER_SR_LIMITS 0x00000001u /* sample rates set limits */
133 #ifdef __cplusplus
135 #endif
137 #endif /* _SYS_MIXER_H */