tizen 2.3.1 release
[framework/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 #ifndef __TIZEN_MEDIA_WAV_PLAYER_H__
18 #define __TIZEN_MEDIA_WAV_PLAYER_H__
19
20 #include <tizen.h>
21 #include <sound_manager.h>
22
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27
28 /**
29  * @file wav_player.h
30  * @brief This file contains the WAV player API.
31  */
32
33 /**
34  * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
35  * @{
36  */
37
38 /**
39  * @brief Enumeration of error codes for WAV player.
40  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
41  */
42 typedef enum
43 {
44     WAV_PLAYER_ERROR_NONE        = TIZEN_ERROR_NONE,                      /**< Successful */
45     WAV_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
46     WAV_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid operation */
47     WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED = TIZEN_ERROR_WAV_PLAYER | 0x01                         /**< Format not supported */
48 } wav_player_error_e;
49
50 /**
51  * @brief Called when a WAV file is no longer being played.
52  * @details This callback is not invoked by calling wav_player_stop().
53  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
54  * @param[in] id        The completed wav player ID
55  * @param[in] user_data The user data passed from the callback registration function
56  * @see wav_player_start()
57  */
58 typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
59
60 /**
61  * @brief Plays a WAV file.
62  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
63  * @param[in] path      The WAV file path to the file to be played
64  * @param[in] type      The sound type
65  * @param[in] callback  The callback function to be invoked when a WAV file is no longer being played
66  * @param[in] user_data The user data to be passed to the callback function
67  * @param[out] id       The WAV player ID (can be set to @c NULL)
68  *
69  * @return @c 0 on success, 
70  *         otherwise a negative error value
71  * @retval #WAV_PLAYER_ERROR_NONE Successful
72  * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
73  * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
74  *
75  * @post        It invokes wav_player_playback_completed_cb() when a WAV file is no longer being played.
76  * @see wav_player_stop()
77  * @see wav_player_playback_completed_cb()
78  */
79 int wav_player_start(const char *path, sound_type_e type, wav_player_playback_completed_cb callback, void *user_data, int *id);
80
81 /**
82  * @brief Stops playing the WAV file.
83  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
84  * @param[in] id  The WAV player ID to stop
85  *
86  * @return @c 0 on success, 
87  *         otherwise a negative error value
88  * @retval #WAV_PLAYER_ERROR_NONE Successful
89  * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter 
90  * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation  
91  *
92  * @see wav_player_start()
93  */
94 int wav_player_stop(int id);
95
96 /**
97  * @}
98  */
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /* __TIZEN_MEDIA_WAV_PLAYER_H__ */