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.
45 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
49 WAV_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
50 WAV_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
51 WAV_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
52 WAV_PLAYER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 3.0) */
53 WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED = TIZEN_ERROR_WAV_PLAYER | 0x01 /**< Format not supported */
62 * @addtogroup CAPI_MEDIA_WAV_PLAYER_MODULE
67 * @brief Called when a WAV file has finished playing.
68 * @details This callback is not invoked by calling wav_player_stop().
69 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
70 * @param[in] id The completed wav player ID
71 * @param[in] user_data The user data passed from the callback registration function
72 * @see wav_player_start()
74 typedef void (*wav_player_playback_completed_cb)(int id, void *user_data);
78 * @deprecated Deprecated since 3.0. Use wav_player_start_with_stream_info() instead.
79 * @brief Plays a WAV file.
80 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
82 * @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n
83 * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
85 * @param[in] path The file path to play
86 * @param[in] type The sound type
87 * @param[in] callback The callback function to invoke when a WAV file is finished playing
88 * @param[in] user_data The user data to be passed to the callback function
89 * @param[out] id The WAV player ID ( can be set to NULL )
91 * @return @c 0 on success,
92 * otherwise a negative error value
93 * @retval #WAV_PLAYER_ERROR_NONE Successful
94 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
95 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
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()
101 int wav_player_start(const char *path, sound_type_e type, wav_player_playback_completed_cb callback, void *user_data, int *id);
104 * @brief Plays a WAV file with stream information of sound-manager.
106 * @param[in] path The file path to play
107 * @param[in] stream_info The sound stream information handle
108 * @param[in] callback The callback function to be invoked when a WAV file is no longer being played
109 * @param[in] user_data The user data to be passed to the callback function
110 * @param[out] id The WAV player ID (can be set to @c NULL)
112 * @return @c 0 on success,
113 * otherwise a negative error value
114 * @retval #WAV_PLAYER_ERROR_NONE Successful
115 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
116 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
117 * @retval #WAV_PLAYER_ERROR_NOT_SUPPORTED Not supported
119 * @post It invokes wav_player_playback_completed_cb() when a WAV file is no longer being played.
120 * @see wav_player_stop()
121 * @see wav_player_playback_completed_cb()
122 * @see sound_manager_create_stream_information()
123 * @see sound_manager_destroy_stream_information()
125 int wav_player_start_with_stream_info(const char *path, sound_stream_info_h stream_info, wav_player_playback_completed_cb callback, void *user_data, int *id);
128 * @brief Stops playing the WAV file.
129 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130 * @param[in] id The WAV player ID to stop
132 * @return 0 on success, otherwise a negative error value.
133 * @retval #WAV_PLAYER_ERROR_NONE Successful
134 * @retval #WAV_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
135 * @retval #WAV_PLAYER_ERROR_INVALID_OPERATION Invalid operation
137 * @see wav_player_start()
139 int wav_player_stop(int id);
149 #endif /* __TIZEN_MEDIA_WAV_PLAYER_H__ */