2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
18 #define __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
26 * @file sound_manager_internal.h
27 * @brief This file contains the Sound Manager Internal API.
31 * @addtogroup CAPI_MEDIA_SOUND_MANAGER_MODULE
35 #define SOUND_TYPE_NUM SOUND_TYPE_VOICE + 1
39 * @brief Virtual sound stream handle.
42 typedef struct virtual_sound_stream_s* virtual_sound_stream_h;
46 * @brief Enumeration for Native API.
50 NATIVE_API_SOUND_MANAGER, /**< Sound-manager Native API */
51 NATIVE_API_PLAYER, /**< Player Native API */
52 NATIVE_API_WAV_PLAYER, /**< Wav-player Native API */
53 NATIVE_API_TONE_PLAYER, /**< Tone-player Native API */
54 NATIVE_API_AUDIO_IO, /**< Audio-io Native API */
55 NATIVE_API_RECORDER, /**< Recorder Native API */
60 * @brief Enumeration for sound stream type for internal.
64 SOUND_STREAM_TYPE_RINGTONE_CALL = 100, /**< Sound stream type for ringtone for call */
65 SOUND_STREAM_TYPE_RINGBACKTONE_CALL, /**< Sound stream type for ringback tone for call */
66 SOUND_STREAM_TYPE_VOICE_CALL, /**< Sound stream type for voice-call */
67 SOUND_STREAM_TYPE_VIDEO_CALL, /**< Sound stream type for video-call */
68 SOUND_STREAM_TYPE_RADIO, /**< Sound stream type for radio */
69 SOUND_STREAM_TYPE_LOOPBACK, /**< Sound stream type for loopback */
70 SOUND_STREAM_TYPE_LOOPBACK_MIRRORING, /**< Sound stream type for loopback-mirroring */
71 SOUND_STREAM_TYPE_SOLO, /**< Sound stream type for solo */
72 } sound_stream_type_internal_e;
76 * @brief Gets the maximum master volume level.
78 * @param[out] max_level The maximum volume level
79 * @return @c 0 on success,
80 * otherwise a negative error value
81 * @retval #SOUND_MANAGER_ERROR_NONE Success
82 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
83 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
84 * @see sound_manager_set_master_volume()
85 * @see sound_manager_get_master_volume()
87 int sound_manager_get_max_master_volume(int *max_level);
91 * @brief Sets the master volume level.
93 * @param[in] level The volume level to be set
94 * @return @c 0 on success,
95 * otherwise a negative error value
96 * @retval #SOUND_MANAGER_ERROR_NONE Success
97 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
98 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
99 * @see sound_manager_get_max_master_volume()
100 * @see sound_manager_get_master_volume()
102 int sound_manager_set_master_volume(int level);
106 * @brief Gets the master volume level.
108 * @param[out] level The current master volume level
109 * @return @c 0 on success,
110 * otherwise a negative error value
111 * @retval #SOUND_MANAGER_ERROR_NONE Success
112 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
113 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
114 * @see sound_manager_get_max_master_volume()
115 * @see sound_manager_set_master_volume()
117 int sound_manager_get_master_volume(int *level);
121 * @brief Creates a handle for stream information.
124 * @remarks Do not call this API within sound_stream_focus_state_changed_cb() and sound_stream_focus_state_watch_cb(),\n
125 * otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
126 * To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
127 * related to playback or recording.(e.g. player, wav-player, audio-io, etc.)
129 * @param[in] stream_type The type of stream for internal usage
130 * @param[in] callback The focus state change callback function
131 * @param[in] user_data The user data to be passed to the callback function
132 * @param[out] stream_info The handle of stream information
133 * @return @c 0 on success,
134 * otherwise a negative error value
135 * @retval #SOUND_MANAGER_ERROR_NONE Success
136 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
137 * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
138 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
139 * @see sound_manager_destroy_stream_information()
140 * @see sound_manager_add_device_for_stream_routing()
141 * @see sound_manager_remove_device_for_stream_routing()
142 * @see sound_manager_apply_stream_routing()
143 * @see sound_manager_acquire_focus()
144 * @see sound_manager_destroy_focus()
145 * @see sound_manager_get_focus_state()
147 int sound_manager_create_stream_information_internal(sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info);
151 * @brief Sets the stream routing option.
154 * @remarks If the stream has not been made yet, this setting will be applied when the stream starts to play.
156 * @param[in] stream_info The handle of stream information
157 * @param[in] name The name of option
158 * @param[in] value The value of option
159 * @return @c 0 on success,
160 * otherwise a negative error value
161 * @retval #SOUND_MANAGER_ERROR_NONE Success
162 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
163 * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
164 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
165 * @pre Call sound_manager_create_stream_information() before calling this function.
166 * @see sound_manager_create_stream_information()
167 * @see sound_manager_create_stream_information_internal()
168 * @see sound_manager_destroy_stream_information()
170 int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, const char *name, int value);
174 * @brief Queries if this stream information handle is available for the API.
176 * @param[in] stream_info The handle of stream information
177 * @param[in] api_name The native API name
178 * @param[out] is_available If @c true the api_name is available, @c false the api_name is not available for this strema_info
179 * @return @c 0 on success,
180 * otherwise a negative error value
181 * @retval #SOUND_MANAGER_ERROR_NONE Success
182 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
183 * @see sound_manager_create_stream_information()
184 * @see sound_manager_destroy_stream_information()
186 int sound_manager_is_available_stream_information(sound_stream_info_h stream_info, native_api_e api_name, bool *is_available);
190 * @brief Gets stream type from the stream information handle.
192 * @param[in] stream_info The handle of stream information
193 * @param[out] type The stream type
194 * @return @c 0 on success,
195 * otherwise a negative error value
196 * @retval #SOUND_MANAGER_ERROR_NONE Success
197 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
198 * @see sound_manager_create_stream_information()
199 * @see sound_manager_destroy_stream_information()
201 int sound_manager_get_type_from_stream_information(sound_stream_info_h stream_info, char **type);
205 * @brief Gets the index of the stream information handle.
207 * @param[in] stream_info The handle of stream information
208 * @param[out] index The unique index
210 * @return @c 0 on success,
211 * otherwise a negative error value
212 * @retval #SOUND_MANAGER_ERROR_NONE Success
213 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
214 * @see sound_manager_create_stream_information()
215 * @see sound_manager_destroy_stream_information()
217 int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_info, int *index);
221 * @brief Creates a virtual stream handle.
223 * @param[in] stream_info The handle of stream information
224 * @param[out] virtual_stream The handle of virtual stream
225 * @return @c 0 on success,
226 * otherwise a negative error value
227 * @retval #SOUND_MANAGER_ERROR_NONE Success
228 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
230 * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
231 * @see sound_manager_create_stream_information()
232 * @see sound_manager_destroy_stream_information()
233 * @see sound_manager_destroy_virtual_stream()
234 * @see sound_manager_start_virtual_stream()
235 * @see sound_manager_stop_virtual_stream()
237 int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream);
241 * @brief Destroys the virtual stream handle.
243 * @param[in] virtual_stream The handle of virtual stream
244 * @return @c 0 on success,
245 * otherwise a negative error value
246 * @retval #SOUND_MANAGER_ERROR_NONE Success
247 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
248 * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
249 * @see sound_manager_create_virtual_stream()
250 * @see sound_manager_start_virtual_stream()
251 * @see sound_manager_stop_virtual_stream()
253 int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream);
257 * @brief Starts the virtual stream.
259 * @param[in] virtual_stream The handle of virtual stream
260 * @return @c 0 on success,
261 * otherwise a negative error value
262 * @retval #SOUND_MANAGER_ERROR_NONE Success
263 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
264 * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
265 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
266 * @see sound_manager_create_virtual_stream()
267 * @see sound_manager_destroy_virtual_stream()
268 * @see sound_manager_stop_virtual_stream()
270 int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream);
274 * @brief Stops the virtual stream.
276 * @param[in] virtual_stream The handle of virtual stream
277 * @return @c 0 on success,
278 * otherwise a negative error value
279 * @retval #SOUND_MANAGER_ERROR_NONE Success
280 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
281 * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
282 * @see sound_manager_create_virtual_stream()
283 * @see sound_manager_destroy_virtual_stream()
284 * @see sound_manager_start_virtual_stream()
286 int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream);
291 * @brief Reserve to release all the remained acquired focuses.
294 * @remarks This function should be called within sound_stream_focus_state_changed_cb(),\n
295 * otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
297 * @param[in] stream_info The handle of stream information
298 * @return @c 0 on success,
299 * otherwise a negative error value
300 * @retval #SOUND_MANAGER_ERROR_NONE Success
301 * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
302 * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
303 * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
304 * @pre Call sound_manager_create_stream_information() and sound_manager_acquire_focus() before calling this function.
305 * @see sound_manager_create_stream_information()
306 * @see sound_manager_destroy_stream_information()
307 * @see sound_manager_acquire_focus()
308 * @see sound_manager_release_focus()
310 int sound_manager_reserve_release_all_focus(sound_stream_info_h stream_info, const char* extra_info);
320 #endif /* __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__ */