SoundPool API 31/74531/6
authorIevgen Vagin <i.vagin@samsung.com>
Tue, 14 Jun 2016 11:14:35 +0000 (14:14 +0300)
committerIevgen Vagin <i.vagin@samsung.com>
Wed, 15 Jun 2016 07:43:25 +0000 (10:43 +0300)
Change-Id: Ie254af065bf489eb47166d7169d55708240e3dd6
Signed-off-by: Ievgen Vagin <i.vagin@samsung.com>
AUTHORS
doc/sound_pool_doc.h
include/sound_pool.h
include/sound_pool_type.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 0bc26c3..22ce42b 100755 (executable)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-Oleksandr Danchenko <o.danchenko at samsung.com>
-Ievgen Vagin <i.vagin at samsung.com>
 Seungbae Shin <seungbae.shin at samsung.com>
-
+Ievgen Vagin <i.vagin at samsung.com>
+Oleksandr Danchenko <o.danchenko at samsung.com>
+AravindKumar Gara <aravind.gara at samsung.com>
index 3b35e5c..d063e3d 100644 (file)
  *
  */
 
+/**
+ * @defgroup CAPI_SOUND_POOL_MODULE Sound Pool
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ */
+
+/**
+ * @ingroup CAPI_MEDIA_FRAMEWORK
+ * @addtogroup CAPI_SOUND_POOL_MODULE
+ * @brief The @ref CAPI_SOUND_POOL_MODULE API provides functions for easy sound
+ *        management such as grouping sounds in pools, play, pause, resume,
+ *        stop operations of sound streams and controlling stream/pool states.
+ * @section CAPI_SOUND_POOL_MODULE_HEADER Required Header
+ *    \#include <sound_pool.h>
+ *
+ * @section CAPI_SOUND_POOL_MODULE_OVERVIEW Overview
+ * The @ref CAPI_SOUND_POOL_MODULE module provides a set of functions to
+ * manipulate sounds in application. It allows easy loading, grouping, playing,
+ * and controlling the sound streams playback; changing parameters of sound
+ * streams such as volume, number of repeats (loops), and priorities also. Sound
+ * pool is aimed to control short sounds which can be grouped by some criteria
+ * (game level, or character, application audio theme, etc).\n
+ * Module includes three main entities: sound pool, sound source and sound
+ * stream.\n
+ * Sound pool is a collection of sounds. It can be defined as isolated
+ * environment where sound streams can be managed. When pool is created, it has
+ * to be filled by the sound sources. Sources can be defined as audio data
+ * which can be loaded from files. When you load the source from file
+ * to pool, audio data is loaded from this file and cached in the memory.
+ * After this it is possible to play sound streams using this cached data.
+ * Multiple sound streams can be played simultaneously using different or the
+ * same sources. Stream can be defined as an instance of sound source. Stream
+ * exists from the moment when play command is called till the end of until
+ * playback is finished or stop command is called.\n
+ * The @ref CAPI_SOUND_POOL_MODULE module supports multiple sound pools
+ * management. Pools can be activated/deactivated. When deactivation is
+ * performed, all playing streams corresponding to the pool gets suspended state.
+ * When pool is activated, then all suspended streams are resumed. Also, it is
+ * possible to change volume of the pool which affects all the streams in the
+ * pool.
+ *
+ */
+
 #endif /* __TIZEN_SOUND_POOL_DOC_H__ */
index 94d4b8c..67e9d41 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __TIZEN_SOUND_POOL_H__
 #define __TIZEN_SOUND_POOL_H__
 
+#include "sound_pool_type.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -26,6 +28,669 @@ extern "C" {
  * @brief  This file contains Tizen Sound Pool API.
  */
 
+/**
+ * @addtogroup CAPI_SOUND_POOL_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called when sound pool state is changed.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool          The handle to the sound pool
+ * @param [in]  prev_state    Previous pool state
+ * @param [in]  cur_state     Current pool state
+ * @param [in]  user_data     The user data passed from the code where
+ *                            @ref sound_pool_set_state_change_callback() was
+ *                            called.
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Call @ref sound_pool_set_state_change_callback()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_set_state_change_callback()
+ * @see sound_pool_state_e
+ */
+typedef void (*sound_pool_state_change_cb) (sound_pool_h pool,
+               sound_pool_state_e prev_state, sound_pool_state_e cur_state,
+               void *user_data);
+
+/**
+ * @brief Called when sound pool stream state is changed.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  tag         Unique string that identifies source which was used
+ *                          for stream creation
+ * @param [in]  id          Unique stream identifier
+ * @param [in]  prev_state  Previous stream state
+ * @param [in]  cur_state   Current stream state
+ * @param [in]  data        The user data passed from the code where
+ *                          @ref sound_pool_stream_set_state_change_callback() was
+ *                          called.
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start source playback by calling @ref sound_pool_stream_play()
+ * @pre Call @ref sound_pool_stream_set_state_change_callback()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_stream_set_state_change_callback()
+ * @see sound_pool_stream_state_e
+ */
+typedef void (*sound_pool_stream_state_change_cb) (sound_pool_h pool,
+               const char *tag, unsigned id, sound_pool_stream_state_e prev_state,
+               sound_pool_stream_state_e cur_state, void *user_data);
+
+/**
+ * @brief Creates sound pool instance that can be used for sound sources
+ *        loading/unloading.
+ * @details Up to 32 sound pools can be created. Several pools can be active
+ *          at the same time. Streams can be in playing state only when pool is
+ *          active.
+ * @remarks When pool has been created, pool state is
+ *          SOUND_POOL_STATE_INACTIVE. To activate a pool use
+ *          @ref sound_pool_activate() function.
+ *
+ * @since_tizen 3.0
+ * @param [in]   max_streams    Maximum number of active streams
+ * @param [out]  pool           The handle to the pool that will be created
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
+ *         Invalid parameter (@a pool is NULL or @ max_streams is 0)
+ * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY
+ *         Not enough memory to create sound pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION
+ *         Maximal amount of sound pools is exceeded (usually, 32 pools allowed)
+ *
+ * @see sound_pool_destroy()
+ */
+int sound_pool_create(unsigned max_streams, sound_pool_h *pool);
+
+/**
+ * @brief Destroys sound pool and cleans allocated memory.
+ * @details Stops all streams and unloads all sources associated with pool.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the pool that will be destroyed
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
+ *         Invalid parameter (@a pool is NULL or corrupted)
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ *
+ * @see sound_pool_create()
+ */
+int sound_pool_destroy(sound_pool_h pool);
+
+/**
+ * @brief Loads sound source data from file to pool.
+ * @details After calling this routine the source can be accessed by its @a tag.
+ * @remarks Input data can be either raw or encoded.
+ *          Each of loaded sources must have unique @a tag
+ *          It is synchronous operation.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool         The handle to the sound pool
+ * @param [in]  file_name    The name of file that contains sound data
+ * @param [in]  tag          Unique string that will be used to identify source
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
+ *         Invalid parameter (@a pool is NULL or corrupted, @a file_name is
+ *         NULL, @a tag is NULL or @a tag/@a file_name length is too long)
+ * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY Not enough memory to allocate source
+ * @retval #SOUND_POOL_ERROR_NO_SUCH_FILE No file determined by @a file_name
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @post Unload source from pool by calling @ref sound_pool_unload_source()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_destroy()
+ * @see sound_pool_unload_source()
+ */
+int sound_pool_load_source_from_file(sound_pool_h pool, const char *file_name,
+               const char *tag);
+
+/**
+ * @brief Unloads source from @a pool.
+ * @details Cleans memory. It is synchronous operation.
+ * @remarks The usage of @a tag name that was associated with unloaded source
+ *          has no effect. It can be reused as well.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  tag     Unique string that identifies source
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
+ *         Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
+ *         in pool
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ */
+int sound_pool_unload_source(sound_pool_h pool, const char *tag);
+
+/**
+ * @brief Gets current @a state of @a pool.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the sound pool
+ * @param [out] state    Current state of @a pool
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
+ *         Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
+ *         in pool
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_state_e
+ */
+int sound_pool_get_state(sound_pool_h pool,
+               sound_pool_state_e *state);
+
+/**
+ * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_ACTIVE.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the sound pool
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
+ *         is already in @c SOUND_POOL_STATE_ACTIVE state
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_get_state()
+ * @see sound_pool_deactivate()
+ * @see sound_pool_state_e
+ */
+int sound_pool_activate(sound_pool_h pool);
+
+/**
+ * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_INACTIVE.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the sound pool
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
+ *         is already in @c SOUND_POOL_STATE_INACTIVE state
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre @a pool has to be in SOUND_POOL_STATE_ACTIVE state
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_get_state()
+ * @see sound_pool_activate()
+ * @see sound_pool_state_e
+ */
+int sound_pool_deactivate(sound_pool_h pool);
+
+/**
+ * @brief Sets callback for handling sound @a pool state change.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  callback    The callback that will be called after pool state
+ *                          will be changed.  @a callback will be called
+ *                          synchronously
+ * @param [in]  data        The user data to be passed to the @a callback
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a callback is NULL)
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @post Use @ref sound_pool_unset_state_change_callback() function to unset the
+ *       @a callback
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_pool_state_change_cb
+ */
+int sound_pool_set_state_change_callback(sound_pool_h pool,
+               sound_pool_state_change_cb callback, void *user_data);
+
+/**
+ * @brief Unsets callback for handling sound @a pool state change.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the pool
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Set state change callback by calling @ref sound_pool_set_state_change_callback()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_set_state_change_callback()
+ */
+int sound_pool_unset_state_change_callback(sound_pool_h pool);
+
+/**
+ * @brief Plays source by @a tag.
+ * @details Creates stream with @a id that can be used to change parameters and
+ *          get additional information.
+ *          Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING
+ * @remarks In case maximum active streams number after calling
+ *          @ref sound_pool_stream_play() was exceeded the stream
+ *          with lowest @a priority will be stopped.
+ *          Resultant stream volume will depend on global pool volume.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  tag         Unique string that identifies source
+ * @param [in]  loop        Number of times stream will be repeated
+ *                          (pass 0 if stream should be repeated continuously)
+ * @param [in]  volume      Stream volume in 0.0~1.0 range
+ * @param [in]  priority    Stream priority (0 = lowest priority)
+ * @param [in]  callback    The callback that will be called after stream state
+ *                          will be changed, or NULL if this callback call
+ *                          isn't needed. If @a callback is set, then it will
+ *                          be called asynchronously
+ * @param [in]  user_data   The user data to be passed to the @a callback
+ * @param [out] id          Unique stream identifier that can be used to
+ *                          change parameters and get additional information
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, @a tag is NULL, @a volume is out of
+ *         0.0~1.0 range, or @a id is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
+ *         in pool
+ * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY Not enough memory to allocate new
+ *         sound stream
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @post When playback is finished normally (i.e. @ref sound_pool_stop_stream()
+ *       will be not used for stream termination) state will be changed to
+ *       SOUND_POOL_STREAM_STATE_FINISHED and memory will be cleared from the
+ *       stream allocated resources automatically
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_set_volume
+ * @see sound_pool_get_volume
+ */
+int sound_pool_stream_play(sound_pool_h pool, const char *tag, unsigned loop,
+               float volume, unsigned priority,
+               sound_pool_stream_state_change_cb callback, void *user_data,
+               unsigned *id);
+
+/**
+ * @brief Pauses stream by @a id.
+ * @details Sets stream state to SOUND_POOL_STREAM_STATE_PAUSED.
+ * @remarks Stream state has to be SOUND_POOL_STATE_PLAYING
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
+ *         the state which is not allowed for pause operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_pause(sound_pool_h pool, unsigned id);
+
+/**
+ * @brief Resumes stream by @a id.
+ * @details Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING.
+ * @remarks Stream state has to be SOUND_POOL_STATE_PAUSED
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
+ *         the state which is not allowed for resume operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ * @pre Pause stream playback by calling @ref sound_pool_stream_pause()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_stream_pause()
+ */
+int sound_pool_stream_resume(sound_pool_h pool, unsigned id);
+
+/**
+ * @brief Stops stream by @a id.
+ * @details Sets stream state to SOUND_POOL_STREAM_STATE_STOPPED.
+ *          After stream was stopped it can not be resumed and @a id value
+ *          becomes invalid. Moreover, stream will never gets
+ *          @c SOUND_POOL_STREAM_STATE_FINISHED state as it will be terminated
+ *          after this function call.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
+ *         the state which is not allowed for stop operation
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_stop(sound_pool_h pool, unsigned id);
+
+/**
+ * @brief Sets pool global volume parameter.
+ * @details Volume of all streams related to @a pool will be scaled
+ *          in accordance to global pool volume parameter
+ *          (i.e. [stream real volume] = [global volume] * [stream volume],
+ *          where [stream volume] is the volume parameter of arbitrary stream).
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool      The handle to the sound pool
+ * @param [in]  volume    Pool global volume in 0.0~1.0 range
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ *
+ * @see sound_pool_create()
+ */
+int sound_pool_set_volume(sound_pool_h pool, float volume);
+
+/**
+ * @brief Gets pool global volume parameter.
+ *
+ * @since_tizen 3.0
+ * @param [in]   pool      The handle to the sound pool
+ * @param [out]  volume    Pool global volume in 0.0~1.0 range
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a volume is NULL)
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ *
+ * @see sound_pool_create()
+ */
+int sound_pool_get_volume(sound_pool_h pool, float *volume);
+
+/**
+ * @brief Gets current @a state of stream by @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool     The handle to the sound pool
+ * @param [in]  id       Unique stream identifier
+ * @param [out] state    Current state of stream
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a state is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_stream_state_e
+ */
+int sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
+               sound_pool_stream_state_e *state);
+
+/**
+ * @brief Sets stream @a loop parameter by stream @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @param [in]  loop    Number of times stream will be repeated
+ *                      (pass 0 if stream should be repeated continuously)
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_set_loop(sound_pool_h pool, unsigned id, unsigned loop);
+
+/**
+ * @brief Gets stream @a loop parameter by stream @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @param [out] loop    Number of times stream will be repeated before
+ *                      finishing (getting state SOUND_POOL_STREAM_STATE_FINISHED)
+ *                      and releasing of the memory and resources
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a loop is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start source playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_get_loop(sound_pool_h pool, unsigned id, unsigned *loop);
+
+/**
+ * @brief Sets stream volume parameters by stream @a id.
+ * @remarks Resultant stream volume will depend on global pool volume.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool      The handle to the sound pool
+ * @param [in]  id        Unique stream identifier
+ * @param [in]  volume    Stream volume in 0.0~1.0 range
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_set_volume
+ * @see sound_pool_get_volume
+ */
+int sound_pool_stream_set_volume(sound_pool_h pool, unsigned id,
+               float volume);
+
+/**
+ * @brief Gets stream volume parameters by stream @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool      The handle to the sound pool
+ * @param [in]  id        Unique stream identifier
+ * @param [out] volume    Stream volume in 0.0~1.0 range
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a volume is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
+               float *volume);
+
+/**
+ * @brief Sets stream priority parameter by stream @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  id          Unique stream identifier
+ * @param [in]  priority    Stream priority (0 = lowest priority)
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_set_priority(sound_pool_h pool, unsigned id,
+               unsigned priority);
+
+/**
+ * @brief Gets stream priority parameter by stream @a id.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  id          Unique stream identifier
+ * @param [in]  priority    Stream priority (0 = lowest priority)
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a priority is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ */
+int sound_pool_stream_get_priority(sound_pool_h pool, unsigned id,
+               unsigned *priority);
+
+/**
+ * @brief Sets callback for handling stream state change events.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool        The handle to the sound pool
+ * @param [in]  id          Unique stream identifier
+ * @param [in]  callback    The callback that will be called after stream state
+ *                          will be changed. @a callback will be called
+ *                          asynchronously
+ * @param [in]  data        The user data to be passed to the @a callback
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted, or @a callback is NULL)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create sound pool handler by calling @ref sound_pool_create()
+ * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start source playback by calling @ref sound_pool_stream_play()
+ * @post Use @ref sound_pool_stream_unset_state_change_callback() function to
+ *       unset the @a callback
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_stream_state_change_cb
+ */
+int sound_pool_stream_set_state_change_callback(sound_pool_h pool, unsigned id,
+               sound_pool_stream_state_change_cb callback, void *user_data);
+
+/**
+ * @brief Unsets callback for handling stream state change events.
+ *
+ * @since_tizen 3.0
+ * @param [in]  pool    The handle to the sound pool
+ * @param [in]  id      Unique stream identifier
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
+ *         (@a pool is NULL or corrupted)
+ * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
+ *         exist in pool
+ *
+ * @pre Create sound @a pool handler by calling @ref sound_pool_create()
+ * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
+ * @pre Start stream playback by calling @ref sound_pool_stream_play()
+ * @pre Set stream state change callback by calling @ref sound_pool_stream_set_state_change_callback()
+ *
+ * @see sound_pool_create()
+ * @see sound_pool_load_source_from_file()
+ * @see sound_pool_stream_play()
+ * @see sound_pool_stream_state_change_cb
+ */
+int sound_pool_stream_unset_state_change_callback(sound_pool_h pool,
+               unsigned id);
+
+/**
+ * @}
+ */
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/sound_pool_type.h b/include/sound_pool_type.h
new file mode 100644 (file)
index 0000000..d2cd0d2
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_SOUND_POOL_TYPE_H__
+#define __TIZEN_SOUND_POOL_TYPE_H__
+
+#include "tizen.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file  sound_pool_type.h
+ * @brief This file contains handles, enumerations and callbacks types
+ *        definitions required by Tizen SoundPool API.
+ */
+
+/**
+ * @addtogroup CAPI_SOUND_POOL_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for Tizen Sound Pool error.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum
+{
+       SOUND_POOL_ERROR_NONE
+                       = TIZEN_ERROR_NONE,                /**< Successful */
+       SOUND_POOL_ERROR_NOT_SUPPORTED
+                       = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported */
+       SOUND_POOL_ERROR_MSG_TOO_LONG
+                       = TIZEN_ERROR_MSG_TOO_LONG,        /**< Message too long */
+       SOUND_POOL_ERROR_NO_DATA
+                       = TIZEN_ERROR_NO_DATA,             /**< No data */
+       SOUND_POOL_ERROR_KEY_NOT_AVAILABLE
+                       = TIZEN_ERROR_KEY_NOT_AVAILABLE,   /**< Key not available */
+       SOUND_POOL_ERROR_OUT_OF_MEMORY
+                       = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Out of memory */
+       SOUND_POOL_ERROR_INVALID_PARAMETER
+                       = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
+       SOUND_POOL_ERROR_INVALID_OPERATION
+                       = TIZEN_ERROR_INVALID_OPERATION,   /**< Invalid operation */
+       SOUND_POOL_ERROR_PERMISSION_DENIED
+                       = TIZEN_ERROR_NOT_PERMITTED,       /**< Not permitted */
+       SOUND_POOL_ERROR_NO_SUCH_FILE
+                       = TIZEN_ERROR_NO_SUCH_FILE,        /**< File not found */
+
+} sound_pool_error_e;
+
+/**
+ * @brief Sound pool handle type.
+ *
+ * @since_tizen 3.0
+ */
+typedef void *sound_pool_h;
+
+/**
+ * @brief Enumeration of sound pool stream state.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       SOUND_POOL_STREAM_STATE_NONE,       /**< Stream state isn't determined */
+       SOUND_POOL_STREAM_STATE_PLAYING,    /**< Stream state is playing */
+       SOUND_POOL_STREAM_STATE_PAUSED,     /**< Stream state is paused */
+       SOUND_POOL_STREAM_STATE_STOPPED,    /**< Stream state is stopped */
+       SOUND_POOL_STREAM_STATE_FINISHED,   /**< Stream state is finished */
+       SOUND_POOL_STREAM_STATE_SUSPENDED   /**< Stream state is suspended */
+} sound_pool_stream_state_e;
+
+/**
+ * @brief Enumeration of sound pool state.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       SOUND_POOL_STATE_ACTIVE,    /**< Sound pool active state: streams can be played */
+       SOUND_POOL_STATE_INACTIVE   /**< Sound pool inactive state: streams can't be played */
+} sound_pool_state_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_SOUND_POOL_TYPE_H__ */