1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17  // This file has been semi-automatically generated using hidl2aidl from its counterpart in
18  // hardware/interfaces/audio/common/5.0/types.hal
19 
20 package android.media.audio.common;
21 
22 /**
23  * A channel mask per se only defines the presence or absence of a channel, not
24  * the order.
25  *
26  * The channel order convention is that channels are interleaved in order from
27  * least significant channel mask bit to most significant channel mask bit,
28  * with unused bits skipped. For example for stereo, LEFT would be first,
29  * followed by RIGHT.
30  * Any exceptions to this convention are noted at the appropriate API.
31  *
32  * AudioChannelMask is an opaque type and its internal layout should not be
33  * assumed as it may change in the future.  Instead, always use functions
34  * to examine it.
35  *
36  * These are the current representations:
37  *
38  *   REPRESENTATION_POSITION
39  *     is a channel mask representation for position assignment.  Each low-order
40  *     bit corresponds to the spatial position of a transducer (output), or
41  *     interpretation of channel (input).  The user of a channel mask needs to
42  *     know the context of whether it is for output or input.  The constants
43  *     OUT_* or IN_* apply to the bits portion.  It is not permitted for no bits
44  *     to be set.
45  *
46  *   REPRESENTATION_INDEX
47  *     is a channel mask representation for index assignment.  Each low-order
48  *     bit corresponds to a selected channel.  There is no platform
49  *     interpretation of the various bits.  There is no concept of output or
50  *     input.  It is not permitted for no bits to be set.
51  *
52  * All other representations are reserved for future use.
53  *
54  * Warning: current representation distinguishes between input and output, but
55  * this will not the be case in future revisions of the platform. Wherever there
56  * is an ambiguity between input and output that is currently resolved by
57  * checking the channel mask, the implementer should look for ways to fix it
58  * with additional information outside of the mask.
59  *
60  * {@hide}
61  */
62 @Backing(type="int")
63 enum AudioChannelMask {
64     /**
65      * must be 0 for compatibility
66      */
67     REPRESENTATION_POSITION = 0,
68     /**
69      * 1 is reserved for future use
70      */
71     REPRESENTATION_INDEX = 2,
72     /**
73      * 3 is reserved for future use
74      *
75      *
76      * These can be a complete value of AudioChannelMask
77      */
78     NONE = 0x0,
79     INVALID = 0xC0000000,
80     /**
81      * These can be the bits portion of an AudioChannelMask
82      * with representation REPRESENTATION_POSITION.
83      *
84      *
85      * output channels
86      */
87     OUT_FRONT_LEFT = 0x1,
88     OUT_FRONT_RIGHT = 0x2,
89     OUT_FRONT_CENTER = 0x4,
90     OUT_LOW_FREQUENCY = 0x8,
91     OUT_BACK_LEFT = 0x10,
92     OUT_BACK_RIGHT = 0x20,
93     OUT_FRONT_LEFT_OF_CENTER = 0x40,
94     OUT_FRONT_RIGHT_OF_CENTER = 0x80,
95     OUT_BACK_CENTER = 0x100,
96     OUT_SIDE_LEFT = 0x200,
97     OUT_SIDE_RIGHT = 0x400,
98     OUT_TOP_CENTER = 0x800,
99     OUT_TOP_FRONT_LEFT = 0x1000,
100     OUT_TOP_FRONT_CENTER = 0x2000,
101     OUT_TOP_FRONT_RIGHT = 0x4000,
102     OUT_TOP_BACK_LEFT = 0x8000,
103     OUT_TOP_BACK_CENTER = 0x10000,
104     OUT_TOP_BACK_RIGHT = 0x20000,
105     OUT_TOP_SIDE_LEFT = 0x40000,
106     OUT_TOP_SIDE_RIGHT = 0x80000,
107     /**
108      * Haptic channel characteristics are specific to a device and
109      * only used to play device specific resources (eg: ringtones).
110      * The HAL can freely map A and B to haptic controllers, the
111      * framework shall not interpret those values and forward them
112      * from the device audio assets.
113      */
114     OUT_HAPTIC_A = 0x20000000,
115     OUT_HAPTIC_B = 0x10000000,
116 // TODO(ytai): Aliases not currently supported in AIDL - can inline the values.
117 //    OUT_MONO = OUT_FRONT_LEFT,
118 //    OUT_STEREO = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT),
119 //    OUT_2POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY),
120 //    OUT_2POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
121 //    OUT_2POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY),
122 //    OUT_3POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
123 //    OUT_3POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY),
124 //    OUT_QUAD = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT),
125 //    OUT_QUAD_BACK = OUT_QUAD,
126 //    /**
127 //     * like OUT_QUAD_BACK with *_SIDE_* instead of *_BACK_*
128 //     */
129 //    OUT_QUAD_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
130 //    OUT_SURROUND = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER),
131 //    OUT_PENTA = (OUT_QUAD | OUT_FRONT_CENTER),
132 //    OUT_5POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT),
133 //    OUT_5POINT1_BACK = OUT_5POINT1,
134 //    /**
135 //     * like OUT_5POINT1_BACK with *_SIDE_* instead of *_BACK_*
136 //     */
137 //    OUT_5POINT1_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
138 //    OUT_5POINT1POINT2 = (OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
139 //    OUT_5POINT1POINT4 = (OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT),
140 //    OUT_6POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER),
141 //    /**
142 //     * matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND
143 //     */
144 //    OUT_7POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
145 //    OUT_7POINT1POINT2 = (OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
146 //    OUT_7POINT1POINT4 = (OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT),
147 //    OUT_MONO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_HAPTIC_A),
148 //    OUT_STEREO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A),
149 //    OUT_HAPTIC_AB = (OUT_HAPTIC_A | OUT_HAPTIC_B),
150 //    OUT_MONO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_HAPTIC_A | OUT_HAPTIC_B),
151 //    OUT_STEREO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A | OUT_HAPTIC_B),
152     /**
153      * These are bits only, not complete values
154      *
155      *
156      * input channels
157      */
158     IN_LEFT = 0x4,
159     IN_RIGHT = 0x8,
160     IN_FRONT = 0x10,
161     IN_BACK = 0x20,
162     IN_LEFT_PROCESSED = 0x40,
163     IN_RIGHT_PROCESSED = 0x80,
164     IN_FRONT_PROCESSED = 0x100,
165     IN_BACK_PROCESSED = 0x200,
166     IN_PRESSURE = 0x400,
167     IN_X_AXIS = 0x800,
168     IN_Y_AXIS = 0x1000,
169     IN_Z_AXIS = 0x2000,
170     IN_BACK_LEFT = 0x10000,
171     IN_BACK_RIGHT = 0x20000,
172     IN_CENTER = 0x40000,
173     IN_LOW_FREQUENCY = 0x100000,
174     IN_TOP_LEFT = 0x200000,
175     IN_TOP_RIGHT = 0x400000,
176     IN_VOICE_UPLINK = 0x4000,
177     IN_VOICE_DNLINK = 0x8000,
178 // TODO(ytai): Aliases not currently supported in AIDL - can inline the values.
179 //    IN_MONO = IN_FRONT,
180 //    IN_STEREO = (IN_LEFT | IN_RIGHT),
181 //    IN_FRONT_BACK = (IN_FRONT | IN_BACK),
182 //    IN_6 = (IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED),
183 //    IN_2POINT0POINT2 = (IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT),
184 //    IN_2POINT1POINT2 = (IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY),
185 //    IN_3POINT0POINT2 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT),
186 //    IN_3POINT1POINT2 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY),
187 //    IN_5POINT1 = (IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY),
188 //    IN_VOICE_UPLINK_MONO = (IN_VOICE_UPLINK | IN_MONO),
189 //    IN_VOICE_DNLINK_MONO = (IN_VOICE_DNLINK | IN_MONO),
190 //    IN_VOICE_CALL_MONO = (IN_VOICE_UPLINK_MONO | IN_VOICE_DNLINK_MONO),
191 //    COUNT_MAX = 30,
192 //    INDEX_HDR = REPRESENTATION_INDEX << COUNT_MAX,
193 //    INDEX_MASK_1 = INDEX_HDR | ((1 << 1) - 1),
194 //    INDEX_MASK_2 = INDEX_HDR | ((1 << 2) - 1),
195 //    INDEX_MASK_3 = INDEX_HDR | ((1 << 3) - 1),
196 //    INDEX_MASK_4 = INDEX_HDR | ((1 << 4) - 1),
197 //    INDEX_MASK_5 = INDEX_HDR | ((1 << 5) - 1),
198 //    INDEX_MASK_6 = INDEX_HDR | ((1 << 6) - 1),
199 //    INDEX_MASK_7 = INDEX_HDR | ((1 << 7) - 1),
200 //    INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 1),
201 //    INDEX_MASK_9 = INDEX_HDR | ((1 << 9) - 1),
202 //    INDEX_MASK_10 = INDEX_HDR | ((1 << 10) - 1),
203 //    INDEX_MASK_11 = INDEX_HDR | ((1 << 11) - 1),
204 //    INDEX_MASK_12 = INDEX_HDR | ((1 << 12) - 1),
205 //    INDEX_MASK_13 = INDEX_HDR | ((1 << 13) - 1),
206 //    INDEX_MASK_14 = INDEX_HDR | ((1 << 14) - 1),
207 //    INDEX_MASK_15 = INDEX_HDR | ((1 << 15) - 1),
208 //    INDEX_MASK_16 = INDEX_HDR | ((1 << 16) - 1),
209 //    INDEX_MASK_17 = INDEX_HDR | ((1 << 17) - 1),
210 //    INDEX_MASK_18 = INDEX_HDR | ((1 << 18) - 1),
211 //    INDEX_MASK_19 = INDEX_HDR | ((1 << 19) - 1),
212 //    INDEX_MASK_20 = INDEX_HDR | ((1 << 20) - 1),
213 //    INDEX_MASK_21 = INDEX_HDR | ((1 << 21) - 1),
214 //    INDEX_MASK_22 = INDEX_HDR | ((1 << 22) - 1),
215 //    INDEX_MASK_23 = INDEX_HDR | ((1 << 23) - 1),
216 //    INDEX_MASK_24 = INDEX_HDR | ((1 << 24) - 1),
217 }
218