Tizen Native API  4.0
WAV Player

The WAV Player API provides functions for playing the waveform audio file format(*.wav).

Required Header

#include <wav_player.h>

Overview

The WAV Player API allows you to simply play and stop a wav file. To play a certain wav file, call wave_player_start() with a path to the .wav file. When playing a wav file is finished, wav_player_playback_completed_cb() will be invoked.

Functions

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
 Plays a WAV file.
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)
 Plays a WAV file with stream information of sound-manager.
int wav_player_stop (int id)
 Stops playing the WAV file.

Typedefs

typedef void(* wav_player_playback_completed_cb )(int id, void *user_data)
 Called when a WAV file has finished playing.

Typedef Documentation

typedef void(* wav_player_playback_completed_cb)(int id, void *user_data)

Called when a WAV file has finished playing.

This callback is not invoked by calling wav_player_stop().

Since :
2.3
Parameters:
[in]idThe completed wav player ID
[in]user_dataThe user data passed from the callback registration function
See also:
wav_player_start()

Enumeration Type Documentation

Enumeration of error codes for WAV player.

Since :
2.3
Enumerator:
WAV_PLAYER_ERROR_NONE 

Successful

WAV_PLAYER_ERROR_INVALID_PARAMETER 

Invalid parameter

WAV_PLAYER_ERROR_INVALID_OPERATION 

Invalid operation

WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTED 

Format not supported

WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPE 

Not supported (Since 3.0)


Function Documentation

int wav_player_start ( const char *  path,
sound_type_e  type,
wav_player_playback_completed_cb  callback,
void *  user_data,
int *  id 
)

Plays a WAV file.

Deprecated:
Deprecated since 3.0. Use wav_player_start_new() instead.
Since :
2.3
Remarks:
Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.
You can refer to Sound Manager.
Parameters:
[in]pathThe file path to play
[in]typeThe sound type
[in]callbackThe callback function to invoke when a WAV file is finished playing
[in]user_dataThe user data to be passed to the callback function
[out]idThe WAV player ID ( can be set to NULL )
Returns:
0 on success, otherwise a negative error value
Return values:
WAV_PLAYER_ERROR_NONESuccessful
WAV_PLAYER_ERROR_INVALID_PARAMETERInvalid parameter
WAV_PLAYER_ERROR_INVALID_OPERATIONInvalid operation
WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTEDNot supported format
Postcondition:
It invokes wav_player_playback_completed_cb() when a WAV file has finished playing.
See also:
wav_player_stop()
wav_player_playback_completed_cb()
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 
)

Plays a WAV file with stream information of sound-manager.

Since :
3.0
Remarks:
Voice Recognition and VOIP stream types are not supported in this API.
Parameters:
[in]pathThe file path to play
[in]stream_infoThe sound stream information handle
[in]callbackThe callback function to be invoked when a WAV file is no longer being played
[in]user_dataThe user data to be passed to the callback function
[out]idThe WAV player ID (can be set to NULL)
Returns:
0 on success, otherwise a negative error value
Return values:
WAV_PLAYER_ERROR_NONESuccessful
WAV_PLAYER_ERROR_INVALID_PARAMETERInvalid parameter
WAV_PLAYER_ERROR_INVALID_OPERATIONInvalid operation
WAV_PLAYER_ERROR_FORMAT_NOT_SUPPORTEDNot supported format
WAV_PLAYER_ERROR_NOT_SUPPORTED_TYPENot supported stream type
Postcondition:
It invokes wav_player_playback_completed_cb() when a WAV file is no longer being played.
See also:
wav_player_stop()
wav_player_playback_completed_cb()
sound_manager_create_stream_information()
sound_manager_destroy_stream_information()
int wav_player_stop ( int  id)

Stops playing the WAV file.

Since :
2.3
Parameters:
[in]idThe WAV player ID to stop
Returns:
0 on success, otherwise a negative error value.
Return values:
WAV_PLAYER_ERROR_NONESuccessful
WAV_PLAYER_ERROR_INVALID_PARAMETERInvalid parameter
WAV_PLAYER_ERROR_INVALID_OPERATIONInvalid operation
See also:
wav_player_start()