Add internal API to set ACM master mode
[platform/core/api/sound-manager.git] / include / sound_manager_internal.h
1 /*
2 * Copyright (c) 2015 - 2018 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 #ifndef __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
18 #define __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__
19
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24
25 /**
26  * @file sound_manager_internal.h
27  * @brief This file contains the Sound Manager Internal API.
28  */
29
30 /**
31  * @addtogroup CAPI_MEDIA_SOUND_MANAGER_MODULE
32  * @{
33  */
34
35 #define SOUND_TYPE_NUM                SOUND_TYPE_VOICE + 1
36
37 /**
38  * @internal
39  * @brief Virtual sound stream handle.
40  * @since_tizen 3.0
41  */
42 typedef struct virtual_sound_stream_s* virtual_sound_stream_h;
43
44 /**
45  * @internal
46  * @brief Enumeration for Native API.
47  * @since_tizen 3.0
48  */
49 typedef enum {
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 */
56 } native_api_e;
57
58 /**
59  * @internal
60  * @brief Enumeration for sound stream type for internal.
61  * @since_tizen 3.0
62  */
63 typedef enum {
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_VOICE_RECOGNITION_SERVICE,  /**< Sound stream type for voice recognition by service (Since 4.0) */
73         SOUND_STREAM_TYPE_MEDIA_COMPRESSED,           /**< Sound stream type for compressed media (Since 4.0) */
74         SOUND_STREAM_TYPE_MEDIA_NETWORK_SOURCE,       /**< Sound stream type for network source media (Since 5.5) */
75 } sound_stream_type_internal_e;
76
77 /**
78  * @internal
79  * @brief Enumeration for sound filters.
80  * @since_tizen 4.0
81  */
82 typedef enum {
83         SOUND_FILTER_LOW_PASS = 0,
84         SOUND_FILTER_HIGH_PASS,
85         SOUND_FILTER_DELAY,
86         SOUND_FILTER_SOUNDALIVE,
87 } sound_filter_e;
88
89 /**
90  * @internal
91  * @brief Enumeration for filter preset.
92  * @since_tizen 4.0
93  */
94 typedef enum {
95         SOUND_FILTER_PRESET_LOW_PASS_NONE = 0,       /**< Filter preset for SOUND_FILTER_LOW_PASS none */
96         SOUND_FILTER_PRESET_LOW_PASS_UNDER_240HZ,    /**< Filter preset for SOUND_FILTER_LOW_PASS under 240hz */
97         SOUND_FILTER_PRESET_LOW_PASS_UNDER_480HZ,    /**< Filter preset for SOUND_FILTER_LOW_PASS under 480hz */
98         SOUND_FILTER_PRESET_HIGH_PASS_NONE,          /**< Filter preset for SOUND_FILTER_HIGH_PASS none */
99         SOUND_FILTER_PRESET_HIGH_PASS_OVER_240HZ,    /**< Filter preset for SOUND_FILTER_HIGH_PASS over 240hz */
100         SOUND_FILTER_PRESET_HIGH_PASS_OVER_480HZ,    /**< Filter preset for SOUND_FILTER_HIGH_PASS over 480hz */
101         SOUND_FILTER_PRESET_DELAY_NONE,              /**< Filter preset for SOUND_FILTER_DELAY none */
102         SOUND_FILTER_PRESET_DELAY_1SEC,              /**< Filter preset for SOUND_FILTER_DELAY 1 second */
103         SOUND_FILTER_PRESET_DELAY_2SEC,              /**< Filter preset for SOUND_FILTER_DELAY 2 seconds */
104         SOUND_FILTER_PRESET_SOUNDALIVE_NORMAL,       /**< Filter preset for SOUND_FILTER_SOUNDALIVE normal */
105         SOUND_FILTER_PRESET_SOUNDALIVE_TUBE,         /**< Filter preset for SOUND_FILTER_SOUNDALIVE tube */
106         SOUND_FILTER_PRESET_SOUNDALIVE_VIRT71,       /**< Filter preset for SOUND_FILTER_SOUNDALIVE virtual7.1 */
107         SOUND_FILTER_PRESET_SOUNDALIVE_STUDIO,       /**< Filter preset for SOUND_FILTER_SOUNDALIVE studio */
108         SOUND_FILTER_PRESET_SOUNDALIVE_CLUB,         /**< Filter preset for SOUND_FILTER_SOUNDALIVE club */
109         SOUND_FILTER_PRESET_SOUNDALIVE_CONCERT_HALL, /**< Filter preset for SOUND_FILTER_SOUNDALIVE concert hall */
110 } sound_filter_preset_e;
111
112 /**
113  * @internal
114  * @brief Gets the maximum master volume level.
115  * @since_tizen 3.0
116  * @param[out]  max_level       The maximum volume level
117  * @return @c 0 on success,
118  *         otherwise a negative error value
119  * @retval #SOUND_MANAGER_ERROR_NONE Success
120  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
121  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
122  * @see sound_manager_set_master_volume()
123  * @see sound_manager_get_master_volume()
124  */
125 int sound_manager_get_max_master_volume(int *max_level);
126
127 /**
128  * @internal
129  * @brief Sets the master volume level.
130  * @since_tizen 3.0
131  * @param[in]   level   The volume level to be set
132  * @return @c 0 on success,
133  *         otherwise a negative error value
134  * @retval #SOUND_MANAGER_ERROR_NONE Success
135  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
136  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
137  * @see sound_manager_get_max_master_volume()
138  * @see sound_manager_get_master_volume()
139  */
140 int sound_manager_set_master_volume(int level);
141
142 /**
143  * @internal
144  * @brief Gets the master volume level.
145  * @since_tizen 3.0
146  * @param[out]  level   The current master volume level
147  * @return @c 0 on success,
148  *         otherwise a negative error value
149  * @retval #SOUND_MANAGER_ERROR_NONE Success
150  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
151  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
152  * @see sound_manager_get_max_master_volume()
153  * @see sound_manager_set_master_volume()
154  */
155 int sound_manager_get_master_volume(int *level);
156
157 /**
158  * @internal
159  * @brief Sets the mute specified for a particular sound type.
160  * @since_tizen 5.5
161  * @privlevel public
162  * @privilege %http://tizen.org/privilege/volume.set
163  * @param[in]           type The sound type
164  * @param[in]           mute    The mute state to be set: (@c true = mute, @c false = unmute)
165  * @return @c 0 on success,
166  *         otherwise a negative error value
167  * @retval #SOUND_MANAGER_ERROR_NONE Success
168  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
169  * @retval #SOUND_MANAGER_ERROR_PERMISSION_DENIED Permission denied
170  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
171  * @see sound_manager_get_mute()
172  */
173 int sound_manager_set_mute(sound_type_e type, bool mute);
174
175 /**
176  * @internal
177  * @brief Gets the mute specified for a particular sound type.
178  * @since_tizen 5.5
179  * @param[in]           type The sound type
180  * @param[out]  muted   The current mute state: (@c true = muted, @c false = unmuted)
181  * @return @c 0 on success,
182  *         otherwise a negative error value
183  * @retval #SOUND_MANAGER_ERROR_NONE Success
184  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
185  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
186  * @see sound_manager_set_mute()
187  */
188 int sound_manager_get_mute(sound_type_e type, bool *muted);
189
190 /**
191  * @internal
192  * @brief Creates a handle for stream information.
193  * @since_tizen 3.0
194  *
195  * @remarks     Do not call this API within sound_stream_focus_state_changed_cb() and sound_stream_focus_state_watch_cb(),\n
196  *      otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
197  *      To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
198  *      related to playback or recording.(e.g. player, wav-player, audio-io, etc.)
199  *
200  * @param[in]   stream_type     The type of stream for internal usage
201  * @param[in]   callback        The focus state change callback function
202  * @param[in]   user_data       The user data to be passed to the callback function
203  * @param[out]  stream_info     The handle of stream information
204  * @return @c 0 on success,
205  *         otherwise a negative error value
206  * @retval #SOUND_MANAGER_ERROR_NONE Success
207  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
208  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
209  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
210  * @see sound_manager_destroy_stream_information()
211  * @see sound_manager_add_device_for_stream_routing()
212  * @see sound_manager_remove_device_for_stream_routing()
213  * @see sound_manager_remove_all_devices_for_stream_routing()
214  * @see sound_manager_apply_stream_routing()
215  * @see sound_manager_acquire_focus()
216  * @see sound_manager_destroy_focus()
217  * @see sound_manager_get_focus_state()
218  */
219 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);
220
221 /**
222  * @internal
223  * @brief Sets the stream routing option.
224  * @since_tizen 3.0
225  *
226  * @remarks     If the stream has not been made yet, this setting will be applied when the stream starts to play.
227  *
228  * @param[in]   stream_info     The handle of stream information
229  * @param[in]   name    The name of option
230  * @param[in]   value   The value of option
231  * @return @c 0 on success,
232  *         otherwise a negative error value
233  * @retval #SOUND_MANAGER_ERROR_NONE Success
234  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
235  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
236  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
237  * @pre Call sound_manager_create_stream_information() before calling this function.
238  * @see sound_manager_create_stream_information()
239  * @see sound_manager_create_stream_information_internal()
240  * @see sound_manager_destroy_stream_information()
241  */
242 int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, const char *name, int value);
243
244 /**
245  * @internal
246  * @brief Queries if this stream information handle is available for the API.
247  * @since_tizen 3.0
248  * @param[in]   stream_info     The handle of stream information
249  * @param[in]   api_name        The native API name
250  * @param[out]  is_available    If @c true the api_name is available, @c false the api_name is not available for this strema_info
251  * @return @c 0 on success,
252  *         otherwise a negative error value
253  * @retval #SOUND_MANAGER_ERROR_NONE Success
254  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
255  * @see sound_manager_create_stream_information()
256  * @see sound_manager_destroy_stream_information()
257  */
258 int sound_manager_is_available_stream_information(sound_stream_info_h stream_info, native_api_e api_name, bool *is_available);
259
260 /**
261  * @internal
262  * @brief Gets stream type from the stream information handle.
263  * @since_tizen 3.0
264  * @param[in]   stream_info     The handle of stream information
265  * @param[out]  type    The stream type
266  * @return @c 0 on success,
267  *         otherwise a negative error value
268  * @retval #SOUND_MANAGER_ERROR_NONE Success
269  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
270  * @see sound_manager_create_stream_information()
271  * @see sound_manager_destroy_stream_information()
272  */
273 int sound_manager_get_type_from_stream_information(sound_stream_info_h stream_info, char **type);
274
275 /**
276  * @internal
277  * @brief Gets the index of the stream information handle.
278  * @since_tizen 3.0
279  * @param[in]   stream_info     The handle of stream information
280  * @param[out]  index   The unique index
281  *
282  * @return @c 0 on success,
283  *         otherwise a negative error value
284  * @retval #SOUND_MANAGER_ERROR_NONE Success
285  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
286  * @see sound_manager_create_stream_information()
287  * @see sound_manager_destroy_stream_information()
288  */
289 int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_info, int *index);
290
291 /**
292  * @internal
293  * @brief Adds the device id to the stream information for the stream routing.
294  * @since_tizen 4.0
295  *
296  * @remarks     Use sound_manager_get_device_list(), sound_manager_get_next_device() and sound_manager_get_device_id()\n
297  *      to get the device id.\n
298  *      #SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the @a stream_info.\n
299  *      The available types of the @a stream_info for this function are #SOUND_STREAM_TYPE_VOIP and #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY.
300  *
301  * @param[in]   stream_info     The handle of stream information
302  * @param[in]   device_id       The device id
303  * @return @c 0 on success,
304  *         otherwise a negative error value
305  * @retval #SOUND_MANAGER_ERROR_NONE Success
306  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
307  * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
308  * @pre Call sound_manager_create_stream_information() before calling this function.
309  * @post You can apply this setting by calling sound_manager_apply_stream_routing().
310  * @see sound_manager_create_stream_information()
311  * @see sound_manager_destroy_stream_information()
312  * @see sound_manager_remove_device_id_for_stream_routing()
313  * @see sound_manager_remove_all_devices_for_stream_routing()
314  * @see sound_manager_apply_stream_routing()
315  */
316 int sound_manager_add_device_id_for_stream_routing(sound_stream_info_h stream_info, int device_id);
317
318 /**
319  * @internal
320  * @brief Removes the device id to the stream information for the stream routing.
321  * @since_tizen 4.0
322  *
323  * @remarks     Use sound_manager_get_device_list(), sound_manager_get_next_device() and sound_manager_get_device_id()\n
324  *      to get the device id.\n
325  *
326  * @param[in]   stream_info     The handle of stream information
327  * @param[in]   device          The device id
328  * @return @c 0 on success,
329  *         otherwise a negative error value
330  * @retval #SOUND_MANAGER_ERROR_NONE Success
331  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
332  * @pre Call sound_manager_create_stream_information() and sound_manager_add_device_for_stream_routing() before calling this function.
333  * @post You can apply this setting by calling sound_manager_apply_stream_routing().
334  * @see sound_manager_create_stream_information()
335  * @see sound_manager_destroy_stream_information()
336  * @see sound_manager_add_device_id_for_stream_routing()
337  * @see sound_manager_remove_all_devices_for_stream_routing()
338  * @see sound_manager_apply_stream_routing()
339  */
340 int sound_manager_remove_device_id_for_stream_routing(sound_stream_info_h stream_info, int device_id);
341
342 /**
343  * @internal
344  * @brief Gets the state of the device by id.
345  * @since_tizen 4.0
346  * @param[in]   device_id       The device id
347  * @param[out]  state   The state of the device
348  * @return @c 0 on success,
349  *         otherwise a negative error value
350  * @retval #SOUND_MANAGER_ERROR_NONE Success
351  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
352  * @see sound_manager_get_device_list()
353  * @see sound_manager_get_next_device()
354  * @see sound_manager_get_prev_device()
355  * @see sound_manager_get_device_id()
356  * @see sound_manager_free_device_list()
357  */
358 int sound_manager_get_device_state_by_id(int device_id, sound_device_state_e *state);
359
360 /**
361  * @internal
362  * @brief Checks if the device is running.
363  * @since_tizen 5.0
364  * @param[in]   device_id       The device id
365  * @param[out]  is_running      Whether the device is running or not: (@c true = running, @c false = not running)
366  * @return @c 0 on success,
367  *         otherwise a negative error value
368  * @retval #SOUND_MANAGER_ERROR_NONE Success
369  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
370  * @see sound_manager_get_device_list()
371  * @see sound_manager_get_next_device()
372  * @see sound_manager_get_prev_device()
373  * @see sound_manager_get_device_id()
374  * @see sound_manager_free_device_list()
375  */
376 int sound_manager_is_device_running_by_id(int device_id, bool *is_running);
377
378 /**
379  * @internal
380  * @brief Gets the device's supported sample formats.
381  * @since_tizen 5.0
382  *
383  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
384  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
385  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
386  *      The @a formats should be released using free().
387  *
388  * @param[in]   device_id       The device id
389  * @param[out]  formats The supported sample format list
390  * @param[out]  num_of_elems    The number of elements in the sample format list
391  * @return @c 0 on success,
392  *         otherwise a negative error value
393  * @retval #SOUND_MANAGER_ERROR_NONE Success
394  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
395  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
396  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
397  * @see sound_manager_set_sample_format_by_id()
398  * @see sound_manager_get_sample_format_by_id()
399  */
400 int sound_manager_get_supported_sample_formats_by_id(int device_id, sound_sample_format_e **formats, unsigned int *num_of_elems);
401
402 /**
403  * @internal
404  * @brief Sets the device's sample format.
405  * @since_tizen 5.0
406  *
407  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device.\n
408  *      @a format should be one of the values received from sound_manager_get_supported_sample_formats_by_id(),\n
409  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
410  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.
411  *
412  * @param[in]   device_id       The device id
413  * @param[in]   format  The sample format
414  * @return @c 0 on success,
415  *         otherwise a negative error value
416  * @retval #SOUND_MANAGER_ERROR_NONE Success
417  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
418  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
419  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
420  * @see sound_manager_get_supported_sample_formats_by_id()
421  * @see sound_manager_get_sample_format_by_id()
422  */
423 int sound_manager_set_sample_format_by_id(int device_id, sound_sample_format_e format);
424
425 /**
426  * @internal
427  * @brief Gets the device's sample format.
428  * @since_tizen 5.0
429  *
430  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
431  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
432  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.
433  *
434  * @param[in]   device_id       The device id
435  * @param[out]  format  The sample format
436  * @return @c 0 on success,
437  *         otherwise a negative error value
438  * @retval #SOUND_MANAGER_ERROR_NONE Success
439  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
440  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
441  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
442  * @see sound_manager_get_supported_sample_formats_by_id()
443  * @see sound_manager_set_sample_format_by_id()
444  */
445 int sound_manager_get_sample_format_by_id(int device_id, sound_sample_format_e *format);
446
447 /**
448  * @internal
449  * @brief Gets the device's supported sample rates.
450  * @since_tizen 5.0
451  *
452  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
453  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
454  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
455  *      The @a rates should be released using free().
456  *
457  * @param[in]   device_id       The device id
458  * @param[out]  rates   The supported sample rate list
459  * @param[out]  num_of_elems    The number of elements in the sample rate list
460  * @return @c 0 on success,
461  *         otherwise a negative error value
462  * @retval #SOUND_MANAGER_ERROR_NONE Success
463  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
464  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
465  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
466  * @see sound_manager_set_sample_rate_by_id()
467  * @see sound_manager_get_sample_rate_by_id()
468  */
469 int sound_manager_get_supported_sample_rates_by_id(int device_id, sound_sample_rate_e **rates, unsigned int *num_of_elems);
470
471 /**
472  * @internal
473  * @brief Sets the device's sample rate.
474  * @since_tizen 5.0
475  *
476  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device.\n
477  *      @a rate should be one of the values received from sound_manager_get_supported_sample_rates(),\n
478  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
479  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.
480  *
481  * @param[in]   device_id       The device id
482  * @param[in]   rate    The sample rate
483  * @return @c 0 on success,
484  *         otherwise a negative error value
485  * @retval #SOUND_MANAGER_ERROR_NONE Success
486  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
487  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
488  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
489  * @see sound_manager_get_supported_sample_rates_by_id()
490  * @see sound_manager_get_sample_rate_by_id()
491  */
492 int sound_manager_set_sample_rate_by_id(int device_id, sound_sample_rate_e rate);
493
494 /**
495  * @internal
496  * @brief Gets the device's sample rate.
497  * @since_tizen 5.0
498  *
499  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
500  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
501  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.
502  *
503  * @param[in]   device_id       The device id
504  * @param[out]  rate    The sample rate
505  * @return @c 0 on success,
506  *         otherwise a negative error value
507  * @retval #SOUND_MANAGER_ERROR_NONE Success
508  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
509  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
510  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
511  * @see sound_manager_get_supported_sample_rates_by_id()
512  * @see sound_manager_set_sample_rate_by_id()
513  */
514 int sound_manager_get_sample_rate_by_id(int device_id, sound_sample_rate_e *rate);
515
516 /**
517  * @internal
518  * @brief Sets the device's 'avoid resampling' property.
519  * @since_tizen 5.0
520  *
521  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
522  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
523  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
524  *      The 'avoid resampling' property is not enabled as default. With this enabled, the device will\n
525  *      use the first stream's original sample format and rate without resampling if supported.
526  *
527  * @param[in]   device_id       The device id
528  * @param[in]   enable  The 'avoid resampling' property value to set: (@c true = enable, @c false = disable)
529  * @return @c 0 on success,
530  *         otherwise a negative error value
531  * @retval #SOUND_MANAGER_ERROR_NONE Success
532  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
533  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
534  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
535  * @see sound_manager_get_avoid_resampling_by_id()
536  */
537 int sound_manager_set_avoid_resampling_by_id(int device_id, bool enable);
538
539 /**
540  * @internal
541  * @brief Gets the device's 'avoid resampling' property.
542  * @since_tizen 5.0
543  *
544  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
545  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
546  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
547  *      The default value of 'avoid resampling' is false.
548  *
549  * @param[in]   device_id       The device id
550  * @param[in]   enabled The value of 'avoid resampling' property: (@c true = enabled, @c false = disabled)
551  * @return @c 0 on success,
552  *         otherwise a negative error value
553  * @retval #SOUND_MANAGER_ERROR_NONE Success
554  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
555  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
556  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
557  * @see sound_manager_set_avoid_resampling_by_id()
558  */
559 int sound_manager_get_avoid_resampling_by_id(int device_id, bool *enabled);
560
561 /**
562  * @internal
563  * @brief Sets the restriction of stream type only for media.
564  * @since_tizen 5.0
565  *
566  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
567  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
568  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
569  *      This property is not enabled as default. With this enabled, no other stream types\n
570  *      except #SOUND_STREAM_TYPE_MEDIA is not allowed to @a device.
571  *
572  * @param[in]   device_id       The device id
573  * @param[in]   enable  The 'media stream only' property value to set: (@c true = enable, @c false = disable)
574  * @return @c 0 on success,
575  *         otherwise a negative error value
576  * @retval #SOUND_MANAGER_ERROR_NONE Success
577  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
578  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
579  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
580  * @see sound_manager_get_media_stream_only_by_id()
581  */
582 int sound_manager_set_media_stream_only_by_id(int device_id, bool enable);
583
584 /**
585  * @internal
586  * @brief Gets the restriction of stream type only for media.
587  * @since_tizen 5.0
588  *
589  * @remarks     @a device_id should be #SOUND_DEVICE_USB_AUDIO type and an output device,\n
590  *      otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
591  *      Use sound_manager_get_device_io_direction() to check if it is an output device or not.\n
592  *      The property is not enabled as default.
593  *
594  * @param[in]   device_id       The device id
595  * @param[out]  enabled The value of 'media stream only' property: (@c true = enabled, @c false = disabled)
596  * @return @c 0 on success,
597  *         otherwise a negative error value
598  * @retval #SOUND_MANAGER_ERROR_NONE Success
599  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
600  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
601  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
602  * @see sound_manager_set_media_stream_only_by_id()
603  */
604 int sound_manager_get_media_stream_only_by_id(int device_id, bool *enabled);
605
606 /**
607  * @internal
608  * @brief Creates a virtual stream handle.
609  * @since_tizen 3.0
610  * @param[in]   stream_info     The handle of stream information
611  * @param[out]  virtual_stream  The handle of virtual stream
612  * @return @c 0 on success,
613  *         otherwise a negative error value
614  * @retval #SOUND_MANAGER_ERROR_NONE Success
615  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
616  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
617  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
618  * @see sound_manager_create_stream_information()
619  * @see sound_manager_destroy_stream_information()
620  * @see sound_manager_destroy_virtual_stream()
621  * @see sound_manager_start_virtual_stream()
622  * @see sound_manager_stop_virtual_stream()
623  */
624 int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream);
625
626 /**
627  * @internal
628  * @brief Destroys the virtual stream handle.
629  * @since_tizen 3.0
630  * @param[in]   virtual_stream  The handle of virtual stream
631  * @return @c 0 on success,
632  *         otherwise a negative error value
633  * @retval #SOUND_MANAGER_ERROR_NONE Success
634  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
635  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
636  * @see sound_manager_create_virtual_stream()
637  * @see sound_manager_start_virtual_stream()
638  * @see sound_manager_stop_virtual_stream()
639  */
640 int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream);
641
642 /**
643  * @internal
644  * @brief Starts the virtual stream.
645  * @since_tizen 3.0
646  * @param[in]   virtual_stream  The handle of virtual stream
647  * @return @c 0 on success,
648  *         otherwise a negative error value
649  * @retval #SOUND_MANAGER_ERROR_NONE Success
650  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
651  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
652  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
653  * @see sound_manager_create_virtual_stream()
654  * @see sound_manager_destroy_virtual_stream()
655  * @see sound_manager_stop_virtual_stream()
656  */
657 int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream);
658
659 /**
660  * @internal
661  * @brief Stops the virtual stream.
662  * @since_tizen 3.0
663  * @param[in]   virtual_stream  The handle of virtual stream
664  * @return @c 0 on success,
665  *         otherwise a negative error value
666  * @retval #SOUND_MANAGER_ERROR_NONE Success
667  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
668  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
669  * @see sound_manager_create_virtual_stream()
670  * @see sound_manager_destroy_virtual_stream()
671  * @see sound_manager_start_virtual_stream()
672  */
673 int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream);
674
675 /**
676  * @internal
677  * @brief Sets the virtual stream volume.
678  * @since_tizen 5.5
679  * @param[in]   virtual_stream  The handle of virtual stream
680  * @param[in]   ratio The volume ratio to be set (Min.:0.0 ~ Max.:1.0, default:1.0)
681  * @return @c 0 on success,
682  *         otherwise a negative error value
683  * @retval #SOUND_MANAGER_ERROR_NONE Success
684  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
685  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
686  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
687  * @see sound_manager_create_virtual_stream()
688  * @see sound_manager_destroy_virtual_stream()
689  * @see sound_manager_start_virtual_stream()
690  */
691 int sound_manager_set_virtual_stream_volume(virtual_sound_stream_h virtual_stream, double ratio);
692
693 /**
694  * @internal
695  * @brief Set sound filter and apply to audio streams given selected stream type.
696  * @since_tizen 4.0
697  * @param[in]   stream_type             stream type to apply
698  * @param[in]   filter                  sound filter to apply
699  * @return @c 0 on success,
700  *         otherwise a negative error value
701  * @retval #SOUND_MANAGER_ERROR_NONE Success
702  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
703  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
704  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
705  * @see sound_manager_unset_filter()
706  */
707 int sound_manager_set_filter(sound_stream_type_e stream_type, sound_filter_e filter);
708
709 /**
710  * @internal
711  * @brief Unset sound filter and remove from audio streams given selected stream type.
712  * @since_tizen 4.0
713  * @param[in]   stream_type             stream type to remove
714  * @return @c 0 on success,
715  *         otherwise a negative error value
716  * @retval #SOUND_MANAGER_ERROR_NONE Success
717  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
718  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
719  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
720  * @see sound_manager_set_filter()
721  */
722 int sound_manager_unset_filter(sound_stream_type_e stream_type);
723
724 /**
725  * @internal
726  * @brief Apply preset configuration to the filter according to selected stream type.
727  * @since_tizen 4.0
728  * @param[in]   stream_type             given stream type
729  * @param[in]   filter                  given sound filter
730  * @param[in]   preset                  filter preset to apply
731  * @return @c 0 on success,
732  *         otherwise a negative error value
733  * @retval #SOUND_MANAGER_ERROR_NONE Success
734  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
735  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
736  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
737  * @see sound_manager_set_filter()
738  */
739 int sound_manager_set_filter_preset(sound_stream_type_e stream_type, sound_filter_e filter, sound_filter_preset_e preset);
740
741 /**
742  * @internal
743  * @brief Gets the vendor id of the device.
744  * @since_tizen 4.0
745  *
746  * @remarks     It works only with USB audio device. Otherwise, #SOUND_MANAGER_ERROR_NOT_SUPPORTED will be returned.\n
747  *
748  * @param[in]   device  The device item
749  * @param[out]  vendor_id       The vendor id of the device
750  * @return @c 0 on success,
751  *         otherwise a negative error value
752  * @retval #SOUND_MANAGER_ERROR_NONE Success
753  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
754  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
755  * @see sound_manager_get_device_list()
756  * @see sound_manager_get_next_device()
757  * @see sound_manager_get_prev_device()
758  * @see sound_manager_get_device_type()
759  * @see sound_manager_get_device_io_direction()
760  * @see sound_manager_get_device_name()
761  * @see sound_manager_get_device_state()
762  * @see sound_manager_get_device_id()
763  * @see sound_manager_get_device_product_id()
764  * @see sound_manager_free_device_list()
765  */
766 int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id);
767
768 /**
769  * @internal
770  * @brief Gets the product id of the device.
771  * @since_tizen 4.0
772  *
773  * @remarks     It works only with USB audio device. Otherwise, #SOUND_MANAGER_ERROR_NOT_SUPPORTED will be returned.\n
774  *
775  * @param[in]   device  The device item
776  * @param[out]  product_id      The product id of the device
777  * @return @c 0 on success,
778  *         otherwise a negative error value
779  * @retval #SOUND_MANAGER_ERROR_NONE Success
780  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
781  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
782  * @see sound_manager_get_device_list()
783  * @see sound_manager_get_next_device()
784  * @see sound_manager_get_prev_device()
785  * @see sound_manager_get_device_type()
786  * @see sound_manager_get_device_io_direction()
787  * @see sound_manager_get_device_name()
788  * @see sound_manager_get_device_state()
789  * @see sound_manager_get_device_id()
790  * @see sound_manager_get_device_vendor_id()
791  * @see sound_manager_free_device_list()
792  */
793 int sound_manager_get_device_product_id(sound_device_h device, int *product_id);
794
795 /**
796  * @brief Checks if the stream information is using the device.
797  * @since_tizen 5.5
798  *
799  * @param[in]   stream_info     The handle of stream information
800  * @param[in]   device_id       The device id
801  * @param[out]  is_on   Whether the stream info is using the device or not: (@c true = use, @c false = not use)
802  * @return @c 0 on success,
803  *         otherwise a negative error value
804  * @retval #SOUND_MANAGER_ERROR_NONE Success
805  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
806  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
807  * @see sound_manager_create_stream_information()
808  * @see sound_manager_destroy_stream_information()
809  * @see sound_manager_get_device_list()
810  * @see sound_manager_get_next_device()
811  * @see sound_manager_get_prev_device()
812  * @see sound_manager_get_device_id()
813  * @see sound_manager_get_device_name()
814  * @see sound_manager_free_device_list()
815  */
816 int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int device_id, bool *is_on);
817
818 /**
819  * @internal
820  * @brief Sets ACM master mode.
821  * @since_tizen 5.5
822  *
823  * @remarks     The master mode is not enabled as default.
824  *
825  * @param[in]   enable  The master mode to be set: (@c true = master, @c false = slave)
826  * @return @c 0 on success,
827  *         otherwise a negative error value
828  * @retval #SOUND_MANAGER_ERROR_NONE Success
829  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
830  */
831 int sound_manager_set_acm_master_mode(bool enable);
832
833 /**
834  * @}
835  */
836
837 #ifdef __cplusplus
838 }
839 #endif
840
841 #endif /* __TIZEN_MEDIA_SOUND_MANAGER_INTERNAL_H__ */