Fix incorrect doxygen description
[platform/core/api/wav-player.git] / include / wav_player.h
1 /*
2 * Copyright (c) 2011 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
18
19
20 #ifndef __TIZEN_MEDIA_WAV_PLAYER_H__
21 #define __TIZEN_MEDIA_WAV_PLAYER_H__
22
23 #include <tizen.h>
24 #include <sound_manager.h>
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30
31 #define WAV_PLAYER_ERROR_CLASS          TIZEN_ERROR_MULTIMEDIA_CLASS | 0x50
32
33 /**
34  * @file wav_player.h
35  * @brief This file contains the WAV player API
36  */
37
38 /**
39  * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
40  * @{
41  */
42
43 /**
44  * @brief Enumeration of error codes for WAV player.
45  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
46  */
47 typedef enum {
48         WAV_PLAYER_ERROR_NONE                 = TIZEN_ERROR_NONE,                  /**< Successful */
49         WAV_PLAYER_ERROR_INVALID_PARAMETER    = TIZEN_ERROR_INVALID_PARAMETER,     /**< Invalid parameter */
50         WAV_PLAYER_ERROR_INVALID_OPERATION    = TIZEN_ERROR_INVALID_OPERATION,     /**< Invalid operation */
51         WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED = TIZEN_ERROR_WAV_PLAYER | 0x01,     /**< Format not supported */
52         WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPE   = TIZEN_ERROR_WAV_PLAYER | 0x02      /**< Not supported (Since 3.0) */
53 } wav_player_error_e;
54
55 /**
56  * @}
57  */
58
59
60 /**
61  * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
62  * @{
63  */
64
65 /**
66  * @brief Called when a WAV file has finished playing.
67  * @details This callback is not invoked by calling wav_player_stop().
68  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
69  * @param[in] id        The completed wav player ID
70  * @param[in] user_data The user data passed from the callback registration function
71  * @see wav_player_start()
72  */
73 typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
74
75
76 /**
77  * @deprecated Deprecated since 3.0. Use wav_player_start_new() instead.
78  * @brief Plays a WAV file.
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  *
81  * @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n
82  *      You can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE.
83  *
84  * @param[in] path      The file path to play
85  * @param[in] type      The sound type
86  * @param[in] callback  The callback function to invoke when a WAV file is finished playing
87  * @param[in] user_data The user data to be passed to the callback function
88  * @param[out] id       The WAV player ID ( can be set to NULL )
89  *
90  * @return @c 0 on success,
91  *         otherwise a negative error value
92  * @retval #WAV_PLAYER_ERROR_NONE Successful
93  * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
94  * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
95  * @retval #WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED Not supported format
96  *
97  * @post        It invokes wav_player_playback_completed_cb() when a WAV file has finished playing.
98  * @see wav_player_stop()
99  * @see wav_player_playback_completed_cb()
100  */
101 int wav_player_start(const char *path, sound_type_e type, wav_player_playback_completed_cb callback, void *user_data, int *id) TIZEN_DEPRECATED_API;
102
103 /**
104  * @brief Plays a WAV file with stream information of sound-manager.
105  * @since_tizen 3.0
106  *
107  * @remarks Voice Recognition and VOIP stream types are not supported in this API.
108  *
109  * @param[in] path      The file path to play
110  * @param[in] stream_info       The sound stream information handle
111  * @param[in] callback  The callback function to be invoked when a WAV file is no longer being played
112  * @param[in] user_data The user data to be passed to the callback function
113  * @param[out] id       The WAV player ID (can be set to @c NULL)
114  *
115  * @return @c 0 on success,
116  *         otherwise a negative error value
117  * @retval #WAV_PLAYER_ERROR_NONE Successful
118  * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
119  * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
120  * @retval #WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED Not supported format
121  * @retval #WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPE Not supported stream type
122  *
123  * @post        It invokes wav_player_playback_completed_cb() when a WAV file is no longer being played.
124  * @see wav_player_stop()
125  * @see wav_player_playback_completed_cb()
126  * @see sound_manager_create_stream_information()
127  * @see sound_manager_destroy_stream_information()
128  */
129 int wav_player_start_new(const char *path, sound_stream_info_h stream_info, wav_player_playback_completed_cb callback, void *user_data, int *id);
130
131 /**
132  * @brief Stops playing the WAV file.
133  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
134  * @param[in] id        The WAV player ID to stop
135  *
136  * @return 0 on success, otherwise a negative error value.
137  * @retval #WAV_PLAYER_ERROR_NONE Successful
138  * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
139  * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
140  *
141  * @see wav_player_start()
142  */
143 int wav_player_stop(int id);
144
145 /**
146  * @}
147  */
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif /* __TIZEN_MEDIA_WAV_PLAYER_H__ */