1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup OHAudio
18  * @{
19  *
20  * @brief Provide the definition of the C interface for the audio module.
21  *
22  * @syscap SystemCapability.Multimedia.Audio.Core
23  *
24  * @since 12
25  * @version 1.0
26  */
27 
28 /**
29  * @file native_audio_common.h
30  *
31  * @brief Declare the audio common base data structure.
32  *
33  * Defines the types of public return values for audio interfaces.
34  *
35  * @library libohaudio.so
36  * @syscap SystemCapability.Multimedia.Audio.Core
37  * @kit AudioKit
38  * @since 12
39  * @version 1.0
40  */
41 
42 #ifndef NATIVE_AUDIO_COMMON_H
43 #define NATIVE_AUDIO_COMMON_H
44 
45 #include <stdint.h>
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /**
52  * @brief Define the result of the function execution.
53  *
54  * @since 12
55  */
56 typedef enum {
57     /**
58      * @error The call was successful.
59      */
60     AUDIOCOMMON_RESULT_SUCCESS = 0,
61 
62     /**
63      * @error This means that the input parameter is invalid.
64      */
65     AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM = 6800101,
66 
67     /**
68      * @error This means there is no memory left.
69      */
70     AUDIOCOMMON_RESULT_ERROR_NO_MEMORY = 6800102,
71 
72     /**
73      * @error Execution status exception.
74      */
75     AUDIOCOMMON_RESULT_ERROR_ILLEGAL_STATE = 6800103,
76 
77     /**
78      * @error This means the operation is unsupported.
79      */
80     AUDIOCOMMON_RESULT_ERROR_UNSUPPORTED = 6800104,
81 
82     /**
83      * @error This means the operation is timeout.
84      */
85     AUDIOCOMMON_RESULT_ERROR_TIMEOUT = 6800105,
86 
87     /**
88      * @error This means reached stream limit.
89      */
90     AUDIOCOMMON_RESULT_ERROR_STREAM_LIMIT = 6800201,
91 
92     /**
93      * @error An system error has occurred.
94      */
95     AUDIOCOMMON_RESULT_ERROR_SYSTEM = 6800301,
96 } OH_AudioCommon_Result;
97 
98 /**
99  * @brief Defines the audio scene.
100  *
101  * @since 12
102  */
103 typedef enum {
104     /**
105      * Default audio scene.
106      *
107      * @since 12
108      */
109     AUDIO_SCENE_DEFAULT = 0,
110 
111     /**
112      * Ringing scene.
113      *
114      * @since 12
115      */
116     AUDIO_SCENE_RINGING = 1,
117 
118     /**
119      * Phone call scene.
120      *
121      * @since 12
122      */
123     AUDIO_SCENE_PHONE_CALL = 2,
124 
125     /**
126      * Voice chat scene.
127      *
128      * @since 12
129      */
130     AUDIO_SCENE_VOICE_CHAT = 3,
131 } OH_AudioScene;
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 /** @} */
137 #endif // NATIVE_AUDIO_COMMON_H
138