#ifndef __TIZEN_SOUND_POOL_H__
#define __TIZEN_SOUND_POOL_H__
-#include "sound_pool_type.h"
+#include <sound_pool_type.h>
#ifdef __cplusplus
extern "C" {
*/
/**
- * @brief Called when sound pool state is changed.
+ * @brief Called when the sound pool state is changed.
*
* @since_tizen 4.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
- * sound_pool_set_state_change_callback() was
- * called.
+ * @remarks @a pool is the object for which the callback was set.
+ * @param[in] pool The sound pool handle
+ * @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
+ * sound_pool_set_state_changed_cb() was
+ * called.
*
- * @pre Create sound pool handler by calling sound_pool_create()
- * @pre Call sound_pool_set_state_change_callback()
+ * @pre Create sound pool handle by calling sound_pool_create()
+ * @pre Call sound_pool_set_state_changed_cb()
*
* @see sound_pool_create()
- * @see sound_pool_set_state_change_callback()
+ * @see sound_pool_set_state_changed_cb()
* @see sound_pool_state_e
*/
-typedef void (*sound_pool_state_change_cb) (sound_pool_h pool,
+typedef void (*sound_pool_state_changed_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.
+ * @brief Called when the sound pool stream state is changed.
*
* @since_tizen 4.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] user_data The user data passed from the code where
- * sound_pool_stream_set_state_change_callback()
- * was called.
- *
- * @pre Create sound pool handler by calling sound_pool_create()
+ * @remarks @a pool is the object for which the callback was set.
+ * @param[in] pool The sound pool handle
+ * @param[in] id Unique stream identifier
+ * @param[in] prev_state Previous stream state
+ * @param[in] cur_state Current stream state
+ * @param[in] user_data The user data passed to the callback
+ *
+ * @pre Create sound pool handle by calling sound_pool_create()
* @pre Load source to pool by calling sound_pool_load_source_from_file()
* @pre Start source playback by calling sound_pool_stream_play()
- * @pre Call 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,
+typedef void (*sound_pool_stream_state_changed_cb) (sound_pool_h pool,
+ 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
+ * @brief Creates a 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.
+ * @since_tizen 4.0
* @remarks When pool has been created, pool state is
- * SOUND_POOL_STATE_INACTIVE. To activate a pool use
+ * #SOUND_POOL_STATE_INACTIVE. To activate the pool use
* sound_pool_activate() function.
+ * When no longer needed, @a pool should be destroyed with sound_pool_destroy().
*
- * @since_tizen 4.0
- * @param [out] pool The handle to the pool that will be created
+ * @param[out] pool The created sound pool handle
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
* Invalid parameter (@a pool is NULL)
* @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)
+ * Maximal amount of sound pools is exceeded (maximum 32 pools allowed)
*
* @see sound_pool_destroy()
*/
-sound_pool_error_e sound_pool_create(sound_pool_h *pool);
+int sound_pool_create(sound_pool_h *pool);
/**
- * @brief Destroys sound pool and cleans allocated memory.
+ * @brief Destroys a sound pool and cleans allocated memory.
* @details Stops all streams and unloads all sources associated with pool.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the pool that will be destroyed
+ * @remarks @a pool should be destroyed with sound_pool_destroy().
+ * @param[in] pool The sound pool handle will be destroyed
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
* Invalid parameter (@a pool is NULL or corrupted)
* @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
*
- * @pre Create sound pool handler by calling sound_pool_create()
+ * @pre Create sound pool handle by calling sound_pool_create()
*
* @see sound_pool_create()
*/
-sound_pool_error_e sound_pool_destroy(sound_pool_h pool);
+int sound_pool_destroy(sound_pool_h pool);
/**
- * @brief Loads sound source data from file to pool.
+ * @brief Loads sound source data from a file to the pool.
* @details After calling this routine the source can be accessed by its @a tag.
+ * @since_tizen 4.0
* @remarks Input data can be either raw or encoded.
* Each of loaded sources must have unique @a tag
* It is synchronous operation.
*
- * @since_tizen 4.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
+ * @param[in] pool The sound pool handle
+ * @param[in] file_name The name of the 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_NONE Successful
* @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_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 sound_pool_create()
- * @post Unload source from pool by calling sound_pool_unload_source()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
+ * @post Unload source from the pool by calling sound_pool_unload_source()
*
* @see sound_pool_create()
* @see sound_pool_destroy()
* @see sound_pool_unload_source()
*/
-sound_pool_error_e sound_pool_load_source_from_file(sound_pool_h pool,
+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.
+ * @brief Unloads source from the @a pool.
+ * @details Cleans memory. This operation is synchronous.
+ * @since_tizen 4.0
* @remarks The usage of @a tag name that was associated with unloaded source
* has no effect. It can be reused as well.
*
- * @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] tag Unique string that identifies source
+ * @param[in] pool The sound pool handle
+ * @param[in] tag Unique string that identifies the source
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * in the pool
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
- * @pre Load source to pool by calling sound_pool_load_source_from_file()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
+ * @pre Load source to the pool by calling sound_pool_load_source_from_file()
*
* @see sound_pool_create()
* @see sound_pool_load_source_from_file()
*/
-sound_pool_error_e sound_pool_unload_source(sound_pool_h pool, const char *tag);
+int sound_pool_unload_source(sound_pool_h pool, const char *tag);
/**
- * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_ACTIVE.
+ * @brief Changes the current @a state of a @a pool to #SOUND_POOL_STATE_ACTIVE.
+ * @since_tizen 4.0
* @remarks When activation is performed, all suspended streams with highest
* priority in the pool will resume their playback. Paused streams will
* remain their state.
*
- * @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
+ * @param[in] pool The sound pool handle
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * is already in #SOUND_POOL_STATE_ACTIVE state
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
*
* @see sound_pool_create()
* @see sound_pool_get_state()
* @see sound_pool_deactivate()
* @see sound_pool_state_e
*/
-sound_pool_error_e sound_pool_activate(sound_pool_h pool);
+int sound_pool_activate(sound_pool_h pool);
/**
- * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_INACTIVE.
+ * @brief Changes the current @a state of a @a pool to #SOUND_POOL_STATE_INACTIVE.
+ * @since_tizen 4.0
* @remarks When deactivation is performed, all playing streams in the pool will
- * be suspended (change state to SOUND_POOL_STREAM_STATE_SUSPENDED).
- * Paused streams will remain their state.
+ * be suspended (change state to #SOUND_POOL_STREAM_STATE_SUSPENDED).
+ * Paused streams will remain in their state.
*
- * @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
+ * @param[in] pool The sound pool handle
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * is already in @c #SOUND_POOL_STATE_INACTIVE state
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
- * @pre @a pool has to be in SOUND_POOL_STATE_ACTIVE state
+ * @pre Create a sound @a pool handle by calling 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
*/
-sound_pool_error_e sound_pool_deactivate(sound_pool_h pool);
+int sound_pool_deactivate(sound_pool_h pool);
/**
- * @brief Sets pool global volume parameter.
- * @details Volume of all streams related to @a pool will be scaled
+ * @brief Sets the pool's global volume parameter.
+ * @details Volume of all streams related to the @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 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] volume Pool global volume in 0.0~1.0 range
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @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 sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
*
* @see sound_pool_create()
*/
-sound_pool_error_e sound_pool_set_volume(sound_pool_h pool, float volume);
+int sound_pool_set_volume(sound_pool_h pool, float volume);
/**
- * @brief Gets pool global volume parameter.
+ * @brief Gets the pool's global volume parameter.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [out] volume Pool global volume in 0.0~1.0 range
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
* (@a pool is NULL or corrupted, or @a volume is NULL)
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
*
* @see sound_pool_create()
*/
-sound_pool_error_e sound_pool_get_volume(sound_pool_h pool, float *volume);
+int sound_pool_get_volume(sound_pool_h pool, float *volume);
/**
- * @brief Gets current @a state of @a pool.
+ * @brief Gets the current @a state of @a pool.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [out] state Current state of @a pool
+ * @param[in] pool The sound pool handle
+ * @param[out] state Current state of @a pool
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
* Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
*
* @see sound_pool_create()
* @see sound_pool_state_e
*/
-sound_pool_error_e sound_pool_get_state(sound_pool_h pool,
+int sound_pool_get_state(sound_pool_h pool,
sound_pool_state_e *state);
/**
- * @brief Sets callback for handling sound @a pool state change.
+ * @brief Sets the callback for handling sound @a pool state change.
*
* @since_tizen 4.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] user_data The user data to be passed to the @a callback
+ * @param[in] pool The sound pool handle
+ * @param[in] callback The callback that will be called after pool state
+ * will be changed. @a callback will be called
+ * synchronously
+ * @param[in] user_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_NONE Successful
* @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 sound_pool_create()
- * @post Use sound_pool_unset_state_change_callback() function to unset the
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
+ * @post Use sound_pool_unset_state_changed_cb() function to unset the
* @a callback
*
* @see sound_pool_create()
* @see sound_pool_pool_state_change_cb
*/
-sound_pool_error_e sound_pool_set_state_change_callback(sound_pool_h pool,
- sound_pool_state_change_cb callback, void *user_data);
+int sound_pool_set_state_changed_cb(sound_pool_h pool,
+ sound_pool_state_changed_cb callback, void *user_data);
/**
- * @brief Unsets callback for handling sound @a pool state change.
+ * @brief Unsets the callback for handling sound @a pool state change.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the pool
+ * @param[in] pool The sound pool handle
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
* (@a pool is NULL or corrupted)
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Set state change callback by calling
- * sound_pool_set_state_change_callback()
+ * sound_pool_set_state_changed_cb()
*
* @see sound_pool_create()
- * @see sound_pool_set_state_change_callback()
+ * @see sound_pool_set_state_changed_cb()
*/
-sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
+int sound_pool_unset_state_changed_cb(sound_pool_h pool);
/**
- * @brief Plays source by @a tag.
+ * @brief Plays a 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
+ * Sets stream state to #SOUND_POOL_STREAM_STATE_PLAYING.
+ * If a callback is set with sound_pool_stream_play(), and another
+ * callback is set with sound_pool_stream_set_state_changed_cb(),
+ * the second callback will overwrite the first one.
+ * @since_tizen 4.0
* @remarks Resultant stream volume will depend on global pool volume.
*
- * @since_tizen 4.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). Check
- * sound_pool_stream_set_priority() documentation
- * for details on prioritization rules.
- * @param [in] priority_policy Stream priority policy.
- * (#SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE Mute)
- * (#SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED Suspended)
- * @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
+ * @param[in] pool The sound pool handle
+ * @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). Check
+ * sound_pool_stream_set_priority() documentation
+ * for details on prioritization rules.
+ * @param[in] priority_policy Stream priority policy.\n
+ * (#SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE - Mute)\n
+ * (#SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED - Suspended)\n
+ * If priority_policy is set to Mute, the stream will be
+ * playing with mute even in the presence of high priority
+ * stream and it will not be Suspended.
+ * @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_NONE Successful
* @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
+ * in the 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 sound_pool_create()
+ * @pre Create sound pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @post When playback is finished normally (i.e. sound_pool_stream_stop()
* will be not used for stream termination) state will be changed to
- * SOUND_POOL_STREAM_STATE_FINISHED and memory will be cleared from the
+ * #SOUND_POOL_STREAM_STATE_FINISHED and memory will be cleared from the
* stream allocated resources automatically
*
* @see sound_pool_create()
* @see sound_pool_set_volume()
* @see sound_pool_get_volume()
*/
-sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag,
+int sound_pool_stream_play(sound_pool_h pool, const char *tag,
unsigned loop, float volume, unsigned priority,
sound_pool_stream_priority_policy_e priority_policy,
- sound_pool_stream_state_change_cb callback, void *user_data,
+ sound_pool_stream_state_changed_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
- *
+ * @brief Pauses a stream by @a id.
+ * @details Sets stream state to #SOUND_POOL_STREAM_STATE_PAUSED.
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
+ * @remarks Stream state has to be #SOUND_POOL_STATE_PLAYING
+ *
+ * @param[in] pool The sound pool handle
+ * @param[in] id Unique stream identifier
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * exist in the 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 sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_load_source_from_file()
* @see sound_pool_stream_play()
*/
-sound_pool_error_e sound_pool_stream_pause(sound_pool_h pool, unsigned id);
+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
- *
+ * @brief Resumes a stream by @a id.
+ * @details Sets stream state to #SOUND_POOL_STREAM_STATE_PLAYING.
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
+ * @remarks Stream state has to be #SOUND_POOL_STATE_PAUSED
+ *
+ * @param[in] pool The sound pool handle
+ * @param[in] id Unique stream identifier
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * exist in the 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 sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
* @pre Pause stream playback by calling sound_pool_stream_pause()
* @see sound_pool_stream_play()
* @see sound_pool_stream_pause()
*/
-sound_pool_error_e sound_pool_stream_resume(sound_pool_h pool, unsigned id);
+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.
+ * @brief Stops a 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
+ * #SOUND_POOL_STREAM_STATE_FINISHED state as it will be terminated
* after this function call.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
+ * @param[in] pool The sound pool handle
+ * @param[in] id Unique stream identifier
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * exist in the 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 sound_pool_create()
+ * @pre Create sound pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_load_source_from_file()
* @see sound_pool_stream_play()
*/
-sound_pool_error_e sound_pool_stream_stop(sound_pool_h pool, unsigned id);
+int sound_pool_stream_stop(sound_pool_h pool, unsigned id);
/**
- * @brief Sets stream @a loop parameter by stream @a id.
- *
+ * @brief Sets the stream's volume parameters by stream @a id.
* @since_tizen 4.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 sound_pool_create()
- * @pre Load source to @a pool by calling sound_pool_load_source_from_file()
- * @pre Start stream playback by calling sound_pool_stream_play()
- *
- * @see sound_pool_create()
- * @see sound_pool_load_source_from_file()
- * @see sound_pool_stream_play()
- */
-sound_pool_error_e 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 4.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
- *
- * @pre Create sound @a pool handler by calling sound_pool_create()
- * @pre Load source to @a pool by calling sound_pool_load_source_from_file()
- * @pre Start source playback by calling sound_pool_stream_play()
- *
- * @see sound_pool_create()
- * @see sound_pool_load_source_from_file()
- * @see sound_pool_stream_play()
- */
-sound_pool_error_e 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 4.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
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @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
+ * exist in the pool
* @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_set_volume
* @see sound_pool_get_volume
*/
-sound_pool_error_e sound_pool_stream_set_volume(sound_pool_h pool, unsigned id,
+int sound_pool_stream_set_volume(sound_pool_h pool, unsigned id,
float volume);
/**
- * @brief Gets stream volume parameters by stream @a id.
+ * @brief Gets the stream's volume parameters by stream @a id.
*
* @since_tizen 4.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
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @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
+ * exist in the pool
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_load_source_from_file()
* @see sound_pool_stream_play()
*/
-sound_pool_error_e sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
+int sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
float *volume);
/**
- * @brief Sets stream priority parameter by stream @a id.
- * @remarks Only streams with highest priority in the active Sound Pool can be
- * played. If at least one stream with highest priority gets
- * #SOUND_POOL_STREAM_STATE_PLAYING state, then all has been playing
- * streams with lower priorities will be transfered to the
- * #SOUND_POOL_STREAM_STATE_SUSPENDED state. If there is no more
- * playing streams in some priority group (group of streams with the
- * same priority), then all suspended previously streams in the group
- * with one level lower priority will be resumed. For example, if we
- * have N suspended streams in 'LOW' group, M suspended streams in
- * 'MEDIUM' group and K playing streams in 'HIGH' group then the
- * following rules are valid: When all K streams in HIGH priority group
- * will be finished, paused, or stopped and Sound Pool is in active
- * state, only then M streams from MEDIUM priority group will be
- * resumed. When all M+K streams from HIGH and MEDIUM priority groups
- * will be finished, paused or stopped and Sound Pool is in active
- * state, only then N streams from LOW priority group will be resumed.
- * Transfering at least one stream from higher priority group will lead
+ * @brief Sets the stream's priority parameter by stream @a id.
+ * @since_tizen 4.0
+ * @details The below rules are applicable for streams with priority policy
+ * #SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED.
+ * Only streams with highest priority in the active Sound Pool can be
+ * played. If at least one stream with highest priority enters
+ * #SOUND_POOL_STREAM_STATE_PLAYING state, then all streams currently
+ * being played with lower priorities will be transferred to the
+ * #SOUND_POOL_STREAM_STATE_SUSPENDED state. If there are no more
+ * playing streams in a given priority group (group of streams with the
+ * same priority), then all previously suspended streams in the group
+ * with one level lower priority will be resumed.
+ *
+ * For example, if we have N suspended streams in 'LOW' group, M
+ * suspended streams in 'MEDIUM' group and K playing streams in 'HIGH'
+ * group. Then the following rules are valid: When all K streams in HIGH
+ * priority group will be finished, paused, or stopped and Sound Pool is
+ * in active state, only then M streams from MEDIUM priority group will
+ * be resumed. When all M+K streams from HIGH and MEDIUM priority groups
+ * are finished, paused or stopped and Sound Pool is in active state,
+ * only then N streams from LOW priority group will be resumed.
+ * Transferring at least one stream from higher priority group will lead
* to suspending of all the streams from lower priorities group(s).
- * Priorities don't make any effect in inactive Sound Pools. But after
+ *
+ * Priorities don't take any effect in inactive Sound Pools. But after
* pool activation, all mentioned rules will be applied.
*
- * @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
- * @param [in] priority Stream priority (0 = lowest priority)
+ * If stream priority policy is set to mute
+ * #SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE, all above rules are not valid
+ * for the stream and it will be played with mute even in the presence
+ * of high priority steams.
+ * streams.
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @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
+ * exist in the pool
* @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_load_source_from_file()
* @see sound_pool_stream_play()
*/
-sound_pool_error_e sound_pool_stream_set_priority(sound_pool_h pool, unsigned id,
+int sound_pool_stream_set_priority(sound_pool_h pool, unsigned id,
unsigned priority);
/**
- * @brief Gets stream priority parameter by stream @a id.
+ * @brief Gets the stream's priority parameter by stream @a id.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
- * @param [out] priority Stream priority (0 = lowest priority). Check
- * sound_pool_stream_set_priority() documentation
- * for details on prioritization rules.
+ * @param[in] pool The sound pool handle
+ * @param[in] id Unique stream identifier
+ * @param[out] priority Stream priority (0 = lowest priority). Check
+ * sound_pool_stream_set_priority() documentation
+ * for details on prioritization rules.
* @return @c 0 on success, otherwise a negative error value
+ * @retval #SOUND_POOL_ERROR_NONE Successful
* @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
+ * exist in the pool
*
- * @pre Create sound @a pool handler by calling sound_pool_create()
+ * @pre Create a sound @a pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_load_source_from_file()
* @see sound_pool_stream_play()
*/
-sound_pool_error_e sound_pool_stream_get_priority(sound_pool_h pool, unsigned id,
+int sound_pool_stream_get_priority(sound_pool_h pool, unsigned id,
unsigned *priority);
/**
- * @brief Gets current @a state of stream by @a id.
+ * @brief Gets the current @a state of stream by @a id.
*
* @since_tizen 4.0
- * @param [in] pool The handle to the sound pool
- * @param [in] id Unique stream identifier
- * @param [out] state Current state of stream
+ * @param[in] pool The sound pool handle
+ * @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_NONE Successful
* @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
+ * exist in the pool
*
- * @pre Create sound pool handler by calling sound_pool_create()
+ * @pre Create sound pool handle by calling sound_pool_create()
* @pre Load source to @a pool by calling sound_pool_load_source_from_file()
* @pre Start stream playback by calling sound_pool_stream_play()
*
* @see sound_pool_stream_play()
* @see sound_pool_stream_state_e
*/
-sound_pool_error_e sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
+int sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
sound_pool_stream_state_e *state);
-
-/**
- * @brief Sets callback for handling stream state change events.
- *
- * @since_tizen 4.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] user_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 sound_pool_create()
- * @pre Load source to pool by calling sound_pool_load_source_from_file()
- * @pre Start source playback by calling sound_pool_stream_play()
- * @post Use 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
- */
-sound_pool_error_e 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 4.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 sound_pool_create()
- * @pre Load source to @a pool by calling sound_pool_load_source_from_file()
- * @pre Start stream playback by calling sound_pool_stream_play()
- * @pre Set stream state change callback by calling 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
- */
-sound_pool_error_e sound_pool_stream_unset_state_change_callback(sound_pool_h pool,
- unsigned id);
-
/**
* @}
*/
static char *scripts[MAX_POOL_CNT] = { NULL };
#define MAX_STREAM_CNT 1000
-/* Messages to be used for callbacks output (for pool state changing) */
-static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = { { NULL } };
-/* Messages to be used for callbacks output (for stream state changing) */
-static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = { { NULL } };
static const char *__stringify_sound_pool_error(sound_pool_error_e error);
static int __proxy_sound_pool_execute_script(const char *pars);
case SOUND_POOL_ERROR_NONE:
return "SOUND_POOL_ERROR_NONE";
break;
- case SOUND_POOL_ERROR_NOT_SUPPORTED:
- return "SOUND_POOL_ERROR_NOT_SUPPORTED";
- break;
- case SOUND_POOL_ERROR_MSG_TOO_LONG:
- return "SOUND_POOL_ERROR_MSG_TOO_LONG";
- break;
- case SOUND_POOL_ERROR_NO_DATA:
- return "SOUND_POOL_ERROR_NO_DATA";
- break;
case SOUND_POOL_ERROR_KEY_NOT_AVAILABLE:
return "SOUND_POOL_ERROR_KEY_NOT_AVAILABLE";
break;
case SOUND_POOL_ERROR_INVALID_OPERATION:
return "SOUND_POOL_ERROR_INVALID_OPERATION";
break;
- case SOUND_POOL_ERROR_PERMISSION_DENIED:
- return "SOUND_POOL_ERROR_PERMISSION_DENIED";
+ case SOUND_POOL_ERROR_NOT_PERMITTED:
+ return "SOUND_POOL_ERROR_NOT_PERMITTED";
break;
case SOUND_POOL_ERROR_NO_SUCH_FILE:
return "SOUND_POOL_ERROR_NO_SUCH_FILE";
__proxy_sound_pool_execute_script(scr);
}
-static void __s_cb_msg(sound_pool_h pool, const char *tag, unsigned id,
+static void __s_cb_msg(sound_pool_h pool, unsigned id,
sound_pool_stream_state_e prev_state,
sound_pool_stream_state_e cur_state, void *data)
{
msg ? msg : "No message");
}
-static void __s_cb_scr(sound_pool_h pool, const char *tag, unsigned id,
- sound_pool_stream_state_e prev_state,
- sound_pool_stream_state_e cur_state, void *data)
-{
- const char *scr = (const char *)data;
- _logger_log_info("Sound pool state was changing from %s to %s; "
- "Executing: %s...", __stringify_stream_state(prev_state),
- __stringify_stream_state(cur_state),
- scr ? scr : "No script");
- __proxy_sound_pool_execute_script(scr);
-}
-
/* CMD_EXIT */
static int __exit()
{
printf("\t- sets callback which will show the message when sound pool "
"state is changed.\n");
- printf(CMD_SET_POOL_CB_SCRIPT "\n");
- printf("\t- sets callback which will execute the script when sound pool "
- "state is changed.\n");
-
printf(CMD_UNSET_POOL_CB "\n");
printf("\t- unsets the callback for the sound pool.\n");
printf("\t- shows volume of the stream in the pool with specified "
"identifiers.\n");
- printf(CMD_SET_STREAM_LOOP "\n");
- printf("\t- use this command to set loop parameter of the stream.\n");
-
- printf(CMD_GET_STREAM_LOOP "\n");
- printf("\t- shows loop count of the stream in the pool with specified "
- "identifiers.\n");
-
printf(CMD_SET_STREAM_PRIORITY "\n");
printf("\t- use this command to set priority parameter of the stream. "
"0 is the lowest priority.\n");
printf("\t- shows state of the stream in the pool with specified "
"identifiers.\n");
- printf(CMD_SET_STREAM_CB_MSG "\n");
- printf("\t- sets callback which will show the message when sound stream "
- "state is changed.\n");
-
- printf(CMD_SET_STREAM_CB_SCRIPT "\n");
- printf("\t- sets callback which will execute the script (from file) when "
- "sound stream state is changed.\n");
-
- printf(CMD_UNSET_STREAM_CB "\n");
- printf("\t- unsets the callback for the sound stream.\n");
-
printf(CMD_EXECUTE_SCRIPT "\n");
printf("\t- executes the script from the file in filesystem. Script has to\n"
"\t be compiled with commands supported by testsuite, one command\n"
}
/* CMD_SET_POOL_CB_MSG */
-static int __proxy_sound_pool_set_state_change_callback_message(const char *pars)
+static int __proxy_sound_pool_set_state_changed_cb_message(const char *pars)
{
size_t idx = 0;
free(messages[idx]);
messages[idx] = strndup(msg, MAX_MSG_LEN);
- int ret = sound_pool_set_state_change_callback(pools[idx], __sp_cb_msg,
+ int ret = sound_pool_set_state_changed_cb(pools[idx], __sp_cb_msg,
messages[idx]);
if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_set_state_change_callback(pool, cb, "
+ _logger_log_info("sound_pool_set_state_changed_cb(pool, cb, "
"\"%s\") returned %s value", msg, __stringify_sound_pool_error(ret));
else
- _logger_log_err("sound_pool_set_state_change_callback(pool, cb, "
+ _logger_log_err("sound_pool_set_state_changed_cb(pool, cb, "
"\"%s\") returned %s value", msg, __stringify_sound_pool_error(ret));
return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
}
/* CMD_SET_POOL_CB_SCRIPT */
-static int __proxy_sound_pool_set_state_change_callback_script(const char *pars)
+static int __proxy_sound_pool_set_state_changed_cb_script(const char *pars)
{
size_t idx = 0;
free(scripts[idx]);
scripts[idx] = strndup(scr, MAX_MSG_LEN);
- int ret = sound_pool_set_state_change_callback(pools[idx], __sp_cb_scr,
+ int ret = sound_pool_set_state_changed_cb(pools[idx], __sp_cb_scr,
scripts[idx]);
if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_set_state_change_callback(pool, cb, "
+ _logger_log_info("sound_pool_set_state_changed_cb(pool, cb, "
"\"%s\") returned %s value", scr, __stringify_sound_pool_error(ret));
else
- _logger_log_err("sound_pool_set_state_change_callback(pool, cb, "
+ _logger_log_err("sound_pool_set_state_changed_cb(pool, cb, "
"\"%s\") returned %s value", scr, __stringify_sound_pool_error(ret));
return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
}
/* CMD_UNSET_POOL_CB */
-static int __proxy_sound_pool_unset_state_change_callback(const char *pars)
+static int __proxy_sound_pool_unset_state_changed_cb(const char *pars)
{
size_t idx = 0;
if ((pars == NULL) || (sscanf(pars, " %zu", &idx) < 1)) {
if (pools[idx] == NULL)
_logger_log_warn("Pool to unset callback for is NULL");
- int ret = sound_pool_unset_state_change_callback(pools[idx]);
+ int ret = sound_pool_unset_state_changed_cb(pools[idx]);
if (messages[idx] != NULL)
free(messages[idx]);
scripts[idx] = NULL;
if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_unset_state_change_callback(pool) "
+ _logger_log_info("sound_pool_unset_state_changed_cb(pool) "
"returned %s value", __stringify_sound_pool_error(ret));
else
- _logger_log_err("sound_pool_unset_state_change_callback(pool) "
+ _logger_log_err("sound_pool_unset_state_changed_cb(pool) "
"returned %s value", __stringify_sound_pool_error(ret));
return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
}
-/* CMD_SET_STREAM_LOOP */
-static int __proxy_sound_pool_stream_set_loop(const char *pars)
-{
- size_t idx = 0;
- size_t stream_idx = 0;
- int loop_val = 1;
-
- if ((pars == NULL)
- || (sscanf(pars, " %zu %zu %i", &idx, &stream_idx, &loop_val) < 3)) {
- _printf(CMD_COLOR_RED, "You have to specify all following parameters: "
- "pool identifier, stream identifier, and loop number! Format: "
- CMD_SET_STREAM_LOOP " <pool id> <stream id> <loop num>\n");
- return FAIL;
- }
-
- if (idx > (MAX_POOL_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
- MAX_POOL_CNT - 1);
- return FAIL;
- }
-
- if (pools[idx] == NULL)
- _logger_log_warn("Pool with specified identifier is NULL");
-
- if (loop_val < 0)
- _logger_log_warn("Loop number should to be greater than 0, but it's"
- "value is %i", loop_val);
-
- _logger_log_info(CMD_SET_STREAM_LOOP " command was called");
-
- int ret = sound_pool_stream_set_loop(pools[idx], stream_idx, loop_val);
-
- if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_stream_set_loop(pool, %zu, %i) "
- "returned %s value", stream_idx, loop_val,
- __stringify_sound_pool_error(ret));
- else
- _logger_log_err("sound_pool_stream_set_loop(pool, %zu, %i) "
- "returned %s value", stream_idx, loop_val,
- __stringify_sound_pool_error(ret));
-
- return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_GET_STREAM_LOOP */
-static int __proxy_sound_pool_stream_get_loop(const char *pars)
-{
- size_t idx = 0;
- size_t stream_idx = 0;
- if ((pars == NULL) || (sscanf(pars, " %zu %zu", &idx, &stream_idx) < 2)) {
- _printf(CMD_COLOR_RED, "You have to specify both pool and stream "
- "identifiers after command name! Format: "
- CMD_GET_STREAM_LOOP " <pool id> <stream id>\n");
- return FAIL;
- }
-
- if (idx > (MAX_POOL_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
- MAX_POOL_CNT - 1);
- return FAIL;
- }
-
- _logger_log_info(CMD_GET_STREAM_LOOP " command was called");
- _logger_log_info("Getting the stream state by %zu identifier in %zu "
- "pool...", stream_idx, idx);
-
- if (pools[idx] == NULL)
- _logger_log_warn("Pool where stream should be located is NULL");
-
- unsigned loop = 0;
- int ret = sound_pool_stream_get_loop(pools[idx], stream_idx, &loop);
-
- if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_stream_get_loop(pool, %zu, loop) "
- "returned %s value, loop value is %i", stream_idx,
- __stringify_sound_pool_error(ret), loop);
- else
- _logger_log_err("sound_pool_stream_get_loop(pool, %zu, loop) "
- "returned %s value, loop value is %i", stream_idx,
- __stringify_sound_pool_error(ret), loop);
-
- return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
/* CMD_SET_STREAM_PRIORITY */
static int __proxy_sound_pool_stream_set_priority(const char *pars)
{
return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
}
-/* CMD_SET_STREAM_CB_MSG */
-static int __proxy_sound_pool_set_stream_state_change_callback_message(const char *pars)
-{
- size_t idx = 0;
- size_t stream_idx = 0;
-
- char msg[MAX_MSG_LEN] = { '\0' };
-
- if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
- &idx, &stream_idx, msg) < 3) {
- _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
- "pool and stream, plus message to be shown each time when "
- "state of the stream is changed! Message should be a single "
- "word. Format: "
- CMD_SET_STREAM_CB_MSG " <pool id> <stream id> <message>\n");
- return FAIL;
- }
-
- if (idx > (MAX_POOL_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
- MAX_POOL_CNT - 1);
- return FAIL;
- }
-
- if (stream_idx > (MAX_STREAM_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
- MAX_STREAM_CNT - 1);
- return FAIL;
- }
-
- _logger_log_info(CMD_SET_STREAM_CB_MSG " command was called");
- _logger_log_info("Set state changing callback (%s message) for stream %zu "
- "in pool with %zu identifier...", msg, stream_idx, idx);
-
- if (pools[idx] == NULL)
- _logger_log_warn("Pool with stream to set callback for is NULL");
-
- if (stream_messages[idx][stream_idx])
- free(stream_messages[idx][stream_idx]);
- stream_messages[idx][stream_idx] = strndup(msg, MAX_MSG_LEN);
-
- int ret = sound_pool_stream_set_state_change_callback(pools[idx], stream_idx,
- __s_cb_msg, stream_messages[idx][stream_idx]);
-
- if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_set_stream_state_change_callback(pool, "
- "%zu, cb, \"%s\") returned %s value", stream_idx, msg,
- __stringify_sound_pool_error(ret));
- else
- _logger_log_err("sound_pool_set_stream_state_change_callback(pool, "
- "%zu, cb, \"%s\") returned %s value", stream_idx, msg,
- __stringify_sound_pool_error(ret));
-
- return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_SET_STREAM_CB_SCRIPT */
-static int __proxy_sound_pool_set_stream_state_change_callback_script(const char *pars)
-{
- size_t idx = 0;
- size_t stream_idx = 0;
-
- char scr[MAX_MSG_LEN] = { '\0' };
-
- if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
- &idx, &stream_idx, scr) < 3) {
- _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
- "pool and stream, plus file with script to be executed each "
- "time when state of the stream is changed! Message should be a "
- "single word. Format: " CMD_SET_STREAM_CB_SCRIPT
- " <pool id> <stream id> <script file>\n");
- return FAIL;
- }
-
- if (idx > (MAX_POOL_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
- MAX_POOL_CNT - 1);
- return FAIL;
- }
-
- if (stream_idx > (MAX_STREAM_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
- MAX_STREAM_CNT - 1);
- return FAIL;
- }
-
- _logger_log_info(CMD_SET_STREAM_CB_SCRIPT " command was called");
- _logger_log_info("Set state changing callback (%s script) for stream %zu "
- "in pool with %zu identifier...", scr, stream_idx, idx);
-
- if (pools[idx] == NULL)
- _logger_log_warn("Pool with stream to set callback for is NULL");
-
- if (stream_scripts[idx][stream_idx])
- free(stream_scripts[idx][stream_idx]);
- stream_scripts[idx][stream_idx] = strndup(scr, MAX_MSG_LEN);
-
- int ret = sound_pool_stream_set_state_change_callback(pools[idx], stream_idx,
- __s_cb_scr, stream_scripts[idx][stream_idx]);
-
- if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_set_stream_state_change_callback(pool, "
- "%zu, cb, \"%s\") returned %s value", stream_idx, scr,
- __stringify_sound_pool_error(ret));
- else
- _logger_log_err("sound_pool_set_stream_state_change_callback(pool, "
- "%zu, cb, \"%s\") returned %s value", stream_idx, scr,
- __stringify_sound_pool_error(ret));
-
- return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
-/* CMD_UNSET_STREAM_CB */
-static int __proxy_sound_pool_unset_stream_state_change_callback(const char *pars)
-{
- size_t idx = 0;
- size_t stream_idx = 0;
- if ((pars == NULL) || (sscanf(pars, " %zu %zu", &idx, &stream_idx) < 2)) {
- _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
- " pool and stream! Format: " CMD_UNSET_STREAM_CB
- " <pool id> <stream id>\n");
- return FAIL;
- }
-
- if (idx > (MAX_POOL_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Pool identifier value can't be greater than %d\n",
- MAX_POOL_CNT - 1);
- return FAIL;
- }
-
- _logger_log_info(CMD_UNSET_STREAM_CB " command was called");
- _logger_log_info("Unset state changing callback for the stream %zu in pool "
- "with %zu identifier...", stream_idx, idx);
-
- if (pools[idx] == NULL)
- _logger_log_warn("Pool to unset callback for is NULL");
-
- int ret = sound_pool_stream_unset_state_change_callback(pools[idx], stream_idx);
-
- if (stream_idx > (MAX_STREAM_CNT - 1)) {
- _printf(CMD_COLOR_RED, "Stream identifier value can't be greater than %d\n",
- MAX_STREAM_CNT - 1);
- return FAIL;
- }
-
- if (stream_messages[idx][stream_idx] != NULL)
- free(stream_messages[idx][stream_idx]);
- stream_messages[idx][stream_idx] = NULL;
-
- if (stream_scripts[idx][stream_idx] != NULL)
- free(stream_scripts[idx][stream_idx]);
- stream_scripts[idx][stream_idx] = NULL;
-
- if (ret == SOUND_POOL_ERROR_NONE)
- _logger_log_info("sound_pool_unset_stream_state_change_callback(pool, "
- "%zu) returned %s value", stream_idx,
- __stringify_sound_pool_error(ret));
- else
- _logger_log_info("sound_pool_unset_stream_state_change_callback(pool, "
- "%zu) returned %s value", stream_idx,
- __stringify_sound_pool_error(ret));
-
- return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);
-}
-
/* CMD_SLEEP */
static int __proxy_sleep(const char *pars)
{
/* CMD_PLAY_STREAM */ 5, /* CMD_STOP_STREAM */ 2,
/* CMD_PAUSE_STREAM */ 2, /* CMD_RESUME_STREAM */ 2,
/* CMD_SET_STREAM_VOLUME */ 3, /* CMD_GET_STREAM_VOLUME */ 2,
- /* CMD_SET_STREAM_LOOP */ 3, /* CMD_GET_STREAM_LOOP */ 2,
/* CMD_SET_STREAM_PRIORITY */ 3, /* CMD_GET_STREAM_PRIORITY */ 2,
/* CMD_GET_STREAM_STATE */ 2, /* CMD_SET_STREAM_CB_MSG */ 3,
/* CMD_SET_STREAM_CB_SCRIPT */ 3, /* CMD_UNSET_STREAM_CB */ 2,
/* CMD_GET_POOL_STATE */ __proxy_sound_pool_get_state,
/* CMD_SET_POOL_VOLUME */ __proxy_sound_pool_set_volume,
/* CMD_GET_POOL_VOLUME */ __proxy_sound_pool_get_volume,
- /* CMD_SET_POOL_CB_MSG */ __proxy_sound_pool_set_state_change_callback_message,
- /* CMD_SET_POOL_CB_SCRIPT */ __proxy_sound_pool_set_state_change_callback_script,
- /* CMD_UNSET_POOL_CB */ __proxy_sound_pool_unset_state_change_callback,
+ /* CMD_SET_POOL_CB_MSG */ __proxy_sound_pool_set_state_changed_cb_message,
+ /* CMD_SET_POOL_CB_SCRIPT */ __proxy_sound_pool_set_state_changed_cb_script,
+ /* CMD_UNSET_POOL_CB */ __proxy_sound_pool_unset_state_changed_cb,
/* CMD_LIST_POOL */ __proxy_sound_pool_list,
/* CMD_LOAD_SOURCE */ __proxy_sound_pool_load_source_from_file,
/* CMD_LOAD_MEDIA_PACKAGE */ NULL,
/* CMD_RESUME_STREAM */ __proxy_sound_pool_resume_stream,
/* CMD_SET_STREAM_VOLUME */ __proxy_sound_pool_stream_set_volume,
/* CMD_GET_STREAM_VOLUME */ __proxy_sound_pool_stream_get_volume,
- /* CMD_SET_STREAM_LOOP */ __proxy_sound_pool_stream_set_loop,
- /* CMD_GET_STREAM_LOOP */ __proxy_sound_pool_stream_get_loop,
/* CMD_SET_STREAM_PRIORITY */ __proxy_sound_pool_stream_set_priority,
/* CMD_GET_STREAM_PRIORITY */ __proxy_sound_pool_stream_get_priority,
/* CMD_GET_STREAM_STATE */ __proxy_sound_pool_get_stream_state,
- /* CMD_SET_STREAM_CB_MSG */ __proxy_sound_pool_set_stream_state_change_callback_message,
- /* CMD_SET_STREAM_CB_SCRIPT */ __proxy_sound_pool_set_stream_state_change_callback_script,
- /* CMD_UNSET_STREAM_CB */ __proxy_sound_pool_unset_stream_state_change_callback,
/* CMD_EXECUTE_SCRIPT */ __proxy_sound_pool_execute_script,
/* CMD_SLEEP */ __proxy_sleep };