Release 4.0.0-preview1-00201
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / AudioManager / AudioManagerEnums.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18
19 namespace Tizen.Multimedia
20 {
21     /// <summary>
22     /// Specifies the flags for the audio device options.
23     /// <para>
24     /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
25     /// </para>
26     /// </summary>
27     [Flags]
28     internal enum AudioDeviceOptions
29     {
30         /// <summary>
31         /// Input devices.
32         /// </summary>
33         Input = 0x0001,
34         /// <summary>
35         /// Output devices.
36         /// </summary>
37         Output = 0x0002,
38         /// <summary>
39         /// Input and output devices (both directions are available).
40         /// </summary>
41         InputAndOutput = 0x0004,
42         /// <summary>
43         /// Built-in devices.
44         /// </summary>
45         Internal = 0x00010,
46         /// <summary>
47         /// External devices.
48         /// </summary>
49         External = 0x0020,
50         /// <summary>
51         /// Deactivated devices.
52         /// </summary>
53         Deactivated = 0x1000,
54         /// <summary>
55         /// Activated devices.
56         /// </summary>
57         Activated = 0x2000,
58
59         /// <summary>
60         /// All devices.
61         /// </summary>
62         All = 0xFFFF
63     }
64
65     /// <summary>
66     /// Specifies the audio device types.
67     /// </summary>
68     public enum AudioDeviceType
69     {
70         /// <summary>
71         /// Built-in speaker.
72         /// </summary>
73         BuiltinSpeaker,
74         /// <summary>
75         /// Built-in receiver.
76         /// </summary>
77         BuiltinReceiver,
78         /// <summary>
79         /// Built-in microphone.
80         /// </summary>
81         BuiltinMic,
82         /// <summary>
83         /// Audio jack that can be connected to wired accessories such as headphones and headsets.
84         /// </summary>
85         AudioJack,
86         /// <summary>
87         /// Bluetooth media (A2DP).
88         /// </summary>
89         BluetoothMedia,
90         /// <summary>
91         /// HDMI.
92         /// </summary>
93         Hdmi,
94         /// <summary>
95         /// Device for forwarding.
96         /// </summary>
97         Forwarding,
98         /// <summary>
99         /// USB audio.
100         /// </summary>
101         UsbAudio,
102         /// <summary>
103         /// Bluetooth voice (SCO).
104         /// </summary>
105         BluetoothVoice
106     }
107
108     /// <summary>
109     /// Specifies the audio device directions.
110     /// </summary>
111     public enum AudioDeviceIoDirection
112     {
113         /// <summary>
114         /// Input device.
115         /// </summary>
116         Input,
117         /// <summary>
118         /// Output device.
119         /// </summary>
120         Output,
121         /// <summary>
122         /// Input/output device (both directions are available).
123         /// </summary>
124         InputAndOutput
125     }
126
127     /// <summary>
128     /// Specifies the audio device states.
129     /// </summary>
130     public enum AudioDeviceState
131     {
132         /// <summary>
133         /// Deactivated state.
134         /// </summary>
135         Deactivated,
136         /// <summary>
137         /// Activated state.
138         /// </summary>
139         Activated
140     }
141
142     /// <summary>
143     /// Specifies the audio volume types.
144     /// </summary>
145     public enum AudioVolumeType
146     {
147         /// <summary>
148         /// System.
149         /// </summary>
150         System,
151         /// <summary>
152         /// Notification.
153         /// </summary>
154         Notification,
155         /// <summary>
156         /// Alarm.
157         /// </summary>
158         Alarm,
159         /// <summary>
160         /// Ringtone.
161         /// </summary>
162         Ringtone,
163         /// <summary>
164         /// Media.
165         /// </summary>
166         Media,
167         /// <summary>
168         /// Call.
169         /// </summary>
170         Call,
171         /// <summary>
172         /// VoIP.
173         /// </summary>
174         Voip,
175         /// <summary>
176         /// Voice.
177         /// </summary>
178         Voice,
179         /// <summary>
180         /// No volume exists.
181         /// </summary>
182         /// <seealso cref="AudioStreamPolicy.VolumeType"/>
183         None
184     }
185
186     /// <summary>
187     /// Specifies the audio stream types.
188     /// </summary>
189     public enum AudioStreamType
190     {
191         /// <summary>
192         /// Media.
193         /// </summary>
194         Media,
195         /// <summary>
196         /// System.
197         /// </summary>
198         System,
199         /// <summary>
200         /// Alarm.
201         /// </summary>
202         Alarm,
203         /// <summary>
204         /// Notification.
205         /// </summary>
206         Notification,
207         /// <summary>
208         /// Emergency.
209         /// </summary>
210         Emergency,
211         /// <summary>
212         /// Voice information.
213         /// </summary>
214         VoiceInformation,
215         /// <summary>
216         /// Voice recognition.
217         /// </summary>
218         VoiceRecognition,
219         /// <summary>
220         /// Ringtone for VoIP.
221         /// </summary>
222         RingtoneVoip,
223         /// <summary>
224         /// VoIP.
225         /// </summary>
226         Voip,
227         /// <summary>
228         /// Media only for external devices.
229         /// </summary>
230         MediaExternalOnly
231     }
232
233     /// <summary>
234     /// Specifies the change reasons of the audio stream focus state.
235     /// </summary>
236     public enum AudioStreamFocusChangedReason
237     {
238         /// <summary>
239         /// Media.
240         /// </summary>
241         Media,
242         /// <summary>
243         /// System.
244         /// </summary>
245         System,
246         /// <summary>
247         /// Alarm.
248         /// </summary>
249         Alarm,
250         /// <summary>
251         /// Notification.
252         /// </summary>
253         Notification,
254         /// <summary>
255         /// Emergency.
256         /// </summary>
257         Emergency,
258         /// <summary>
259         /// Voice information.
260         /// </summary>
261         VoiceInformation,
262         /// <summary>
263         /// Voice recognition.
264         /// </summary>
265         VoiceRecognition,
266         /// <summary>
267         /// Ringtone.
268         /// </summary>
269         RingtoneVoip,
270         /// <summary>
271         /// VoIP.
272         /// </summary>
273         Voip,
274         /// <summary>
275         /// Voice-call or video-call.
276         /// </summary>
277         Call,
278         /// <summary>
279         /// Media only for external devices.
280         /// </summary>
281         MediaExternalOnly
282     }
283
284     /// <summary>
285     /// Specifies the flags for the audio stream focus options.
286     /// <para>
287     /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
288     /// </para>
289     /// </summary>
290     [Flags]
291     public enum AudioStreamFocusOptions
292     {
293         /// <summary>
294         /// Playback focus.
295         /// </summary>
296         Playback = 0x0001,
297         /// <summary>
298         /// Recording focus.
299         /// </summary>
300         Recording = 0x0002
301     }
302
303     /// <summary>
304     /// Specifies the audio stream focus states.
305     /// </summary>
306     public enum AudioStreamFocusState
307     {
308         /// <summary>
309         /// Focus state for release.
310         /// </summary>
311         Released,
312         /// <summary>
313         /// Focus state for acquisition.
314         /// </summary>
315         Acquired
316     }
317
318     /// <summary>
319     /// Specifies the flags for the audio stream behaviors.
320     /// <para>
321     /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
322     /// </para>
323     /// </summary>
324     [Flags]
325     public enum AudioStreamBehaviors
326     {
327         /// <summary>
328         /// No Resume.
329         /// </summary>
330         NoResume = 0x0001,
331         /// <summary>
332         /// Fading.
333         /// </summary>
334         Fading = 0x0002
335     }
336
337
338     internal static class AudioManagerEnumExtensions
339     {
340         internal static bool IsValid(this AudioStreamFocusOptions value)
341         {
342             int mask = (int)(AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording);
343
344             return (mask & (int)value) != 0;
345         }
346
347         internal static bool IsValid(this AudioStreamBehaviors value)
348         {
349             int mask = (int)(AudioStreamBehaviors.NoResume | AudioStreamBehaviors.Fading);
350
351             return ((~mask) & (int)value) == 0;
352         }
353     }
354
355 }