2 * Copyright (c) 2011 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.
20 #ifndef __TIZEN_MEDIA_WAV_PLAYER_H__
21 #define __TIZEN_MEDIA_WAV_PLAYER_H__
24 #include <sound_manager.h>
31 #define WAV_PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x50
35 * @brief This file contains the WAV player API
39 * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
44 * @brief Enumeration of error codes for WAV player.
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) */
61 * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
66 * @brief Called when a WAV file has finished playing.
67 * @details This callback is not invoked by calling wav_player_stop().
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_new()
73 typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
76 * @brief Plays a WAV file with stream information of sound-manager.
79 * @remarks Voice Recognition and VOIP stream types are not supported by this function.
81 * @param[in] path The file path to play
82 * @param[in] stream_info The sound stream information handle
83 * @param[in] callback The callback function to be invoked when the WAV file is no longer being played
84 * @param[in] user_data The user data to be passed to the callback function
85 * @param[out] id The WAV player ID (can be set to @c NULL)
87 * @return @c 0 on success,
88 * otherwise a negative error value
89 * @retval #WAV_PLAYER_ERROR_NONE Successful
90 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
91 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
92 * @retval #WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED Not supported format
93 * @retval #WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPE Not supported stream type
95 * @post It invokes wav_player_playback_completed_cb() when the WAV file is no longer being played.
96 * @see wav_player_stop()
97 * @see wav_player_playback_completed_cb()
98 * @see sound_manager_create_stream_information()
99 * @see sound_manager_destroy_stream_information()
101 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);
104 * @brief Plays a WAV file multiple times.
107 * @remarks Voice Recognition and VOIP stream types are not supported by this function.
109 * @param[in] path The file path to play
110 * @param[in] stream_info The sound stream information handle
111 * @param[in] loop_count The number of times the file should be played (@c 0 indicates infinite loops)
112 * @param[in] callback The callback function to be invoked when the WAV file is no longer being played
113 * @param[in] user_data The user data to be passed to the callback function
114 * @param[out] id The WAV player ID (can be set to @c NULL)
116 * @return @c 0 on success,
117 * otherwise a negative error value
118 * @retval #WAV_PLAYER_ERROR_NONE Successful
119 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
120 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
121 * @retval #WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED Not supported format
122 * @retval #WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPE Not supported stream type
124 * @post It invokes wav_player_playback_completed_cb() when the WAV file is no longer being played.
125 * @see wav_player_stop()
126 * @see wav_player_playback_completed_cb()
127 * @see sound_manager_create_stream_information()
128 * @see sound_manager_destroy_stream_information()
130 int wav_player_start_loop(const char *path, sound_stream_info_h stream_info, unsigned int loop_count, wav_player_playback_completed_cb callback, void *user_data, int *id);
133 * @brief Stops playing the WAV file.
136 * @remarks If the playback of @a id has been already finished at the server side and\n
137 * wav_player_playback_completed_cb() is not invoked yet, #WAV_PLAYER_ERROR_INVALID_OPERATION will be returned.
139 * @param[in] id The WAV player ID to stop
141 * @return 0 on success, otherwise a negative error value.
142 * @retval #WAV_PLAYER_ERROR_NONE Successful
143 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
144 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
146 * @see wav_player_start_new()
148 int wav_player_stop(int id);
158 #endif /* __TIZEN_MEDIA_WAV_PLAYER_H__ */