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.
17 #ifndef __TIZEN_MEDIA_WAV_PLAYER_H__
18 #define __TIZEN_MEDIA_WAV_PLAYER_H__
21 #include <sound_manager.h>
30 * @brief This file contains the WAV player API.
34 * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
39 * @brief Enumeration of error codes for WAV player.
40 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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 */
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()
58 typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
61 * @brief Plays a WAV file.
62 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
63 * @param[in] path The file path to play
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)
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
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()
79 int wav_player_start(const char *path, sound_type_e type, wav_player_playback_completed_cb callback, void *user_data, int *id);
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
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
92 * @see wav_player_start()
94 int wav_player_stop(int id);
104 #endif /* __TIZEN_MEDIA_WAV_PLAYER_H__ */