Add policy(Mute option instead of suspend) on revised logic 66/136566/10 accepted/tizen/unified/20170717.172055 submit/tizen/20170717.133102
authoraravind.gara <aravind.gara@samsung.com>
Fri, 30 Jun 2017 08:02:28 +0000 (17:02 +0900)
committeraravind.gara <aravind.gara@samsung.com>
Tue, 11 Jul 2017 09:37:50 +0000 (18:37 +0900)
Change-Id: If02531c35808d622a2e99e25a9364ff6dd9a4274
Signed-off-by: aravind.gara <aravind.gara@samsung.com>
include/internal/stream.h
include/sound_pool.h
include/sound_pool_type.h
src/priority.c
src/sound_pool.c
src/stream.c
test/proxy/src/proxy.c

index 463e97a..bfaad54 100644 (file)
@@ -42,9 +42,12 @@ typedef struct sound_stream_s {
        unsigned loop;
        float volume;
 
+       sound_pool_stream_priority_policy_e priority_policy;
        sound_pool_stream_state_e state;
        sound_pool_stream_state_e state_previous;
        gboolean stopped;
+       gboolean mute;
+       gboolean suspended;
 
        struct {
                sound_pool_stream_state_change_cb callback;
@@ -55,8 +58,8 @@ typedef struct sound_stream_s {
 } sound_stream_t;
 
 sound_pool_error_e _sound_stream_create(sound_source_t *src, unsigned loop,
-               float volume, unsigned priority, sound_pool_stream_state_change_cb cb,
-               void *data, sound_stream_t **stream);
+               float volume, unsigned priority, sound_pool_stream_priority_policy_e priority_policy,
+               sound_pool_stream_state_change_cb cb, void *data, sound_stream_t **stream);
 
 sound_pool_error_e _sound_stream_destroy(sound_stream_t *src);
 
@@ -66,6 +69,8 @@ sound_pool_error_e _sound_stream_pause(sound_stream_t *stream);
 
 sound_pool_error_e _sound_stream_resume(sound_stream_t *stream);
 
+sound_pool_error_e  _sound_stream_suspend(sound_stream_t *stream);
+
 sound_pool_error_e _sound_stream_stop(sound_stream_t *stream);
 
 sound_pool_error_e _sound_stream_set_loop(sound_stream_t *stream, unsigned loop);
@@ -74,9 +79,15 @@ sound_pool_error_e _sound_stream_get_loop(sound_stream_t *stream, unsigned *loop
 sound_pool_error_e _sound_stream_set_volume(sound_stream_t *stream, float volume);
 sound_pool_error_e _sound_stream_get_volume(sound_stream_t *stream, float *volume);
 
+sound_pool_error_e _sound_stream_set_mute(sound_stream_t *stream, gboolean mute);
+sound_pool_error_e _sound_stream_get_mute(sound_stream_t *stream, gboolean *mute);
+
 sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream, unsigned rank);
 sound_pool_error_e _sound_stream_get_priority(sound_stream_t *stream, unsigned *rank);
 
+sound_pool_error_e _sound_stream_set_priority_policy(sound_stream_t *stream,
+               sound_pool_stream_priority_policy_e priority_policy);
+
 sound_pool_error_e _sound_stream_get_state(sound_stream_t *stream,
                sound_pool_stream_state_e *state);
 
@@ -85,9 +96,11 @@ sound_pool_error_e _sound_stream_set_callback(sound_stream_t *stream,
 
 sound_pool_error_e _sound_stream_unset_callback(sound_stream_t *stream);
 
+sound_pool_error_e _sound_stream_send_event(sound_stream_t *stream,
+               sound_pool_stream_state_e state);
+
 sound_pool_error_e _sound_pool_get_stream_by_id(sound_pool_t *pool, unsigned id,
                sound_stream_t **stream);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index d9ad35f..53c4dfa 100644 (file)
@@ -336,6 +336,9 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
  * @param [in]  priority    Stream priority (0 = lowest priority). Check
  *                          @ref sound_pool_stream_set_priority() documentation
  *                          for details on prioritization rules.
+ * @param [in]  priority_policy    Stream priority policy.
+ *                          (#SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED  Suspended)
+ *                          (#SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE Mute)
  * @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
@@ -367,6 +370,7 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
  */
 sound_pool_error_e 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,
                unsigned *id);
 
index 1e624f9..40fc6f7 100644 (file)
@@ -85,6 +85,16 @@ typedef enum {
 } sound_pool_stream_state_e;
 
 /**
+ * @brief Enumeration of sound pool stream priority policy.
+ *
+ * @since_tizen 4.0
+ */
+typedef enum {
+       SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE,             /**< Stream priority policy is mute */
+       SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED       /**< Stream priority policy is suspended */
+} sound_pool_stream_priority_policy_e;
+
+/**
  * @brief Enumeration of sound pool state.
  *
  * @since_tizen 4.0
index a392bf6..b279dfb 100644 (file)
@@ -198,24 +198,69 @@ void _sound_stream_priority_update_playback(stream_priority_manager_t *mgr)
                if (SOUND_POOL_ERROR_NONE != _sound_stream_priority_check(mgr, stream,
                                &can_run))
                        continue;
-               if (TRUE == can_run) {
-                       if (SOUND_POOL_STREAM_STATE_PLAYING != stream->state &&
-                               SOUND_POOL_STREAM_STATE_PAUSED != stream->state)
+
+               if (can_run) {
+                       switch (stream->state) {
+                       case SOUND_POOL_STREAM_STATE_PLAYING:
+                               if (SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE == stream->priority_policy && stream->mute) {
+                                       SP_INFO("stream[%d] with priority[%d] was Playing with mute, now unmute",
+                                                       stream->id, stream->priority);
+                                       _sound_stream_set_mute(stream, FALSE);
+                               }
+                               break;
+                       case SOUND_POOL_STREAM_STATE_NONE:
+                       case SOUND_POOL_STREAM_STATE_SUSPENDED:
+                               SP_INFO("stream[%d] with priority[%d] was Suspended(pool deactivate) or initial created, now play",
+                                               stream->id, stream->priority);
                                _sound_stream_play(stream);
-               } else if (SOUND_POOL_STREAM_STATE_PLAYING == stream->state) {
-                       stream->stopped = TRUE; /* Shows it was stopped due to priority */
-                       _sound_stream_pause(stream);
-               } else if (SOUND_POOL_STREAM_STATE_NONE == stream->state) {
-                       /* This case handles newly created streams in active pool, but with
-                          too low priority for transition to playing state: */
-                       stream->state_previous = stream->state;
-                       stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
-                       if (_stream_cb_manager_register_event(mgr->pool->cbmgr, stream) !=
-                                       SOUND_POOL_ERROR_NONE)
-                               SP_DEBUG("State changing event wasn't registered."
-                                               "Callbacks will be not called");
+                               break;
+                       default:
+                               break;
+                       }
+               } else { /* Can't run */
+                       if (SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE == stream->priority_policy) {
+                               /* mute policy */
+                               switch (stream->state) {
+                               case SOUND_POOL_STREAM_STATE_PLAYING:
+                                       if (!stream->mute) {
+                                               SP_INFO("stream[%d] with priority[%d] was Playing, now mute",
+                                                               stream->id, stream->priority);
+                                               _sound_stream_set_mute(stream, TRUE);
+                                       }
+                                       break;
+                               case SOUND_POOL_STREAM_STATE_NONE:
+                               case SOUND_POOL_STREAM_STATE_SUSPENDED:
+                                       SP_INFO("stream[%d] with priority[%d] was Suspended(pool deactivate) or initial created, now play with mute",
+                                                       stream->id, stream->priority);
+                                       _sound_stream_set_mute(stream, TRUE);
+                                       _sound_stream_play(stream);
+                                       break;
+                               default:
+                                       /* nothing to do */
+                                       break;
+                               }
+                       } else {
+                               /* suspended policy */
+                               switch (stream->state) {
+                               case SOUND_POOL_STREAM_STATE_PLAYING:
+                                       SP_INFO("stream[%d] with priority[%d] was Playing, now Suspend",
+                                                       stream->id, stream->priority);
+                                       _sound_stream_suspend(stream);
+                                       break;
+                               case SOUND_POOL_STREAM_STATE_NONE:
+                                       /* This case handles newly created streams in active pool, but with
+                                               too low priority for transition to playing state: */
+                                       _sound_stream_send_event(stream, SOUND_POOL_STREAM_STATE_SUSPENDED);
+                                       break;
+                               default:
+                                       /* nothing to do */
+                                       break;
+                               }
+                       }
                }
+
        }
 
        SP_DEBUG_FLEAVE();
 }
+
index 20a5743..1cb7e77 100644 (file)
@@ -201,6 +201,7 @@ sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool)
 
 sound_pool_error_e 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 *data, unsigned *id)
 {
        SP_DEBUG_FENTER();
@@ -213,8 +214,8 @@ sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag,
                        "getting sound source [%s] from the sound pool", tag);
 
        sound_stream_t *_stream = NULL;
-       ret = _sound_stream_create(_source, loop, volume, priority, callback, data,
-                       &_stream);
+       ret = _sound_stream_create(_source, loop, volume, priority, priority_policy,
+                       callback, data, &_stream);
        SP_RETVM_IF(ret != SOUND_POOL_ERROR_NONE, ret,
                        "Error while creating sound source instance.");
 
index bed069b..58df7ae 100644 (file)
@@ -73,9 +73,8 @@ static void __al_source_state_cb(ALuint source, ALenum state, ALvoid *data)
                if (pool->state == SOUND_POOL_STATE_INACTIVE) {
                        stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
                } else if (pool->state == SOUND_POOL_STATE_ACTIVE) {
-                       if (stream->stopped) { /* Stream stopped due to priority issue */
+                       if (stream->suspended) { /* Stream stopped due to priority issue */
                                stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
-                               stream->stopped = FALSE;
                        } else {
                                stream->state = SOUND_POOL_STREAM_STATE_PAUSED;
                        }
@@ -160,7 +159,7 @@ static sound_pool_error_e __sound_pool_remove_stream(sound_pool_t *pool, sound_s
 }
 
 static sound_pool_error_e __sound_stream_init(sound_stream_t *stream,
-               unsigned loop, float volume, unsigned priority,
+               unsigned loop, float volume, unsigned priority, sound_pool_stream_priority_policy_e priority_policy,
                sound_pool_stream_state_change_cb cb, void *data)
 {
        SP_DEBUG_FENTER();
@@ -184,12 +183,17 @@ static sound_pool_error_e __sound_stream_init(sound_stream_t *stream,
        SP_RETVM_IF(ret != SOUND_POOL_ERROR_NONE, ret,
                        "Error occurred when setting sound stream priority parameter");
 
+       ret = _sound_stream_set_priority_policy(stream, priority_policy);
+       SP_RETVM_IF (ret != SOUND_POOL_ERROR_NONE, ret,
+                       "Error occurred when setting sound stream priority_policy parameter");
+
        SP_DEBUG_FLEAVE();
        return ret;
 }
 
 sound_pool_error_e _sound_stream_create(sound_source_t *src, unsigned loop,
-               float volume, unsigned priority, sound_pool_stream_state_change_cb cb,
+               float volume, unsigned priority, sound_pool_stream_priority_policy_e priority_policy,
+               sound_pool_stream_state_change_cb cb,
                void *data, sound_stream_t **stream)
 {
        SP_DEBUG_FENTER();
@@ -243,7 +247,7 @@ sound_pool_error_e _sound_stream_create(sound_source_t *src, unsigned loop,
                                "Data to OpenAL Source", cfail);
        }
 
-       ret = __sound_stream_init(_stream, loop, volume, priority, cb, data);
+       ret = __sound_stream_init(_stream, loop, volume, priority, priority_policy, cb, data);
        if (ret != SOUND_POOL_ERROR_NONE)
                GOTO_FAIL("Sound stream initialization error occurred", cfail);
 
@@ -321,7 +325,36 @@ sound_pool_error_e _sound_stream_play(sound_stream_t *stream)
 
        alSourcePlay(stream->al_source);
        SP_RETVM_IF(alGetError() != AL_NO_ERROR, SOUND_POOL_ERROR_INVALID_OPERATION,
-                       "OpenAL error occurred when trying to play OpenAL Source");
+                                       "OpenAL error occured when trying to play OpenAL Source");
+
+       SP_DEBUG_FLEAVE();
+       return ret;
+}
+
+sound_pool_error_e  _sound_stream_suspend(sound_stream_t *stream)
+{
+       SP_DEBUG_FENTER();
+       SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(stream->parent_source, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       sound_pool_error_e ret = SOUND_POOL_ERROR_NONE;
+       stream->suspended = TRUE; /* Shows it was stopped due to priority */
+       alSourcePause(stream->al_source);
+       stream->suspended = FALSE;
+
+       SP_DEBUG_FLEAVE();
+       return ret;
+}
+
+sound_pool_error_e _sound_stream_send_event(sound_stream_t *stream, sound_pool_stream_state_e state)
+{
+       SP_DEBUG_FENTER();
+       sound_pool_t *pool = stream->parent_source->parent_pool;
+       sound_pool_error_e ret = SOUND_POOL_ERROR_NONE;
+       stream->state_previous = stream->state;
+       stream->state = state;
+       ret = _stream_cb_manager_register_event(pool->cbmgr, stream);
+       SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "State changing event "
+                               "wasn't registered. Callbacks will be not called");
 
        SP_DEBUG_FLEAVE();
        return ret;
@@ -345,11 +378,7 @@ sound_pool_error_e _sound_stream_pause(sound_stream_t *stream)
 
        if (pool->state == SOUND_POOL_STATE_INACTIVE &&
                        stream->state == SOUND_POOL_STREAM_STATE_SUSPENDED) {
-               stream->state_previous = stream->state;
-               stream->state = SOUND_POOL_STREAM_STATE_PAUSED;
-               ret = _stream_cb_manager_register_event(pool->cbmgr, stream);
-               SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "State changing event "
-                               "wasn't registered. Callbacks will be not called");
+               ret = _sound_stream_send_event(stream, SOUND_POOL_STREAM_STATE_PAUSED);
                SP_INFO("Don't paused due to SoundPool is in inactive state.");
        } else {
                alSourcePause(stream->al_source);
@@ -376,11 +405,7 @@ sound_pool_error_e _sound_stream_resume(sound_stream_t *stream)
 
        if (pool->state == SOUND_POOL_STATE_INACTIVE &&
                        stream->state == SOUND_POOL_STREAM_STATE_PAUSED) {
-               stream->state_previous = stream->state;
-               stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
-               ret = _stream_cb_manager_register_event(pool->cbmgr, stream);
-               SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "State changing event "
-                               "wasn't registered. Callbacks will be not called");
+               ret = _sound_stream_send_event(stream, SOUND_POOL_STREAM_STATE_SUSPENDED);
                SP_INFO("Don't resumed due to SoundPool is in inactive state.");
        } else {
                alSourcePlay(stream->al_source);
@@ -461,6 +486,36 @@ sound_pool_error_e _sound_stream_set_volume(sound_stream_t *stream, float volume
        return SOUND_POOL_ERROR_NONE;
 }
 
+sound_pool_error_e _sound_stream_set_mute(sound_stream_t *stream, gboolean mute)
+{
+       SP_DEBUG_FENTER();
+
+       SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
+
+       sound_pool_t *pool = stream->parent_source->parent_pool;
+       SP_INST_CHECK(pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_RETVM_IF(!alcMakeContextCurrent(pool->al_context),
+                       SOUND_POOL_ERROR_INVALID_OPERATION, "Can't set current context.");
+
+       alSourcef(stream->al_source, AL_GAIN, ((int)!mute * stream->volume));
+       stream->mute = mute;
+
+       SP_DEBUG_FLEAVE();
+       return SOUND_POOL_ERROR_NONE;
+}
+
+sound_pool_error_e _sound_stream_get_mute(sound_stream_t *stream, gboolean *mute)
+{
+       SP_DEBUG_FENTER();
+       SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(mute, SOUND_POOL_ERROR_INVALID_PARAMETER);
+
+       *mute = stream->mute;
+
+       SP_DEBUG_FLEAVE();
+       return SOUND_POOL_ERROR_NONE;
+}
+
 sound_pool_error_e _sound_stream_get_volume(sound_stream_t *stream, float *volume)
 {
        SP_DEBUG_FENTER();
@@ -482,6 +537,9 @@ sound_pool_error_e _sound_stream_get_state(sound_stream_t *stream,
 
        *state = stream->state;
 
+       if (stream->mute)
+               SP_DEBUG(" Stream is in Mute.");
+
        SP_DEBUG_FLEAVE();
        return SOUND_POOL_ERROR_NONE;
 }
@@ -491,6 +549,7 @@ sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream,
 {
        SP_DEBUG_FENTER();
        SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(stream->parent_source, SOUND_POOL_ERROR_INVALID_PARAMETER);
        SP_INST_CHECK(stream->parent_source->parent_pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
        SP_INST_CHECK(stream->parent_source->parent_pool->mgr_priority,
                        SOUND_POOL_ERROR_INVALID_PARAMETER);
@@ -499,12 +558,9 @@ sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream,
        stream->priority = rank;
        if (stream->parent_source->parent_pool->state == SOUND_POOL_STATE_INACTIVE) {
                if (stream->state == SOUND_POOL_STREAM_STATE_NONE) {
-                       stream->state_previous = stream->state;
-                       stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
-                       ret = _stream_cb_manager_register_event(stream->parent_source->parent_pool->cbmgr,
-                                       stream);
-                       SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "State changing event "
-                                       "wasn't registered. Callbacks will be not called");
+                       ret = _sound_stream_send_event(stream, SOUND_POOL_STREAM_STATE_SUSPENDED);
+                       SP_RETVM_IF(SOUND_POOL_ERROR_NONE != ret, ret, "Error occured during"
+                                       "send event");
                }
                SP_DEBUG("No need to update priority, Sound pool is INACTIVE.");
                return SOUND_POOL_ERROR_NONE;
@@ -516,6 +572,24 @@ sound_pool_error_e _sound_stream_set_priority(sound_stream_t *stream,
        return SOUND_POOL_ERROR_NONE;
 }
 
+sound_pool_error_e _sound_stream_set_priority_policy(sound_stream_t *stream,
+        sound_pool_stream_priority_policy_e priority_policy)
+{
+       SP_DEBUG_FENTER();
+       SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(stream->parent_source, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(stream->parent_source->parent_pool, SOUND_POOL_ERROR_INVALID_PARAMETER);
+       SP_INST_CHECK(stream->parent_source->parent_pool->mgr_priority,
+                       SOUND_POOL_ERROR_INVALID_PARAMETER);
+
+
+       stream->priority_policy = priority_policy;
+
+       SP_INFO("Priority policy is %d.", stream->priority_policy);
+       SP_DEBUG_FLEAVE();
+       return SOUND_POOL_ERROR_NONE;
+}
+
 sound_pool_error_e _sound_stream_get_priority(sound_stream_t *stream,
                unsigned *rank)
 {
index 4bb3fe2..75ba4a8 100644 (file)
@@ -828,14 +828,15 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        int loop = 0;
        float volume = 1.0f;
        unsigned rank = DEFAULT_STREAM_PRIORITY_RANK;
+    sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE;
 
        char tag[MAX_PATH_LEN] = {'\0'};
 
-       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %u",
-                                                               &idx, tag, &loop, &volume, &rank) < 2) {
+       if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %u %u",
+                                                               &idx, tag, &loop, &volume, &rank, &priority_policy) < 2) {
                _printf(CMD_COLOR_RED, "You have to specify at least pool identifier and "
                                "source tag to be played in stream! Format: " CMD_PLAY_STREAM
-                               " <pool id> <source tag> <loop> <volume> <priority rank>... "
+                               " <pool id> <source tag> <loop> <volume> <priority rank> <priority_policy>... "
                                "0 'priority rank' value corresponds to the lowest priority.\n");
                return FAIL;
        }
@@ -854,19 +855,19 @@ static int __proxy_sound_pool_play_stream(const char *pars)
                        "with %zu identifier...", tag, idx);
 
        unsigned stream_idx = 0;
-       int ret = sound_pool_stream_play(pools[idx], tag, loop, volume, rank, NULL,
+       int ret = sound_pool_stream_play(pools[idx], tag, loop, volume, rank, priority_policy, __s_cb_msg,
                        NULL, &stream_idx);
 
        if (ret == SOUND_POOL_ERROR_NONE) {
                _logger_log_info("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
-                               " NULL, NULL, &stream_idx) returned %s value. "
-                               "Generated identifier is %i", tag, loop, volume, rank,
+                               " %u, %p, NULL, &stream_idx) returned %s value. "
+                               "Generated identifier is %i", tag, loop, volume, rank, priority_policy, __s_cb_msg,
                                __stringify_sound_pool_error(ret), stream_idx);
                _printf(CMD_COLOR_GREEN, "Generated stream identifier is %i\n", stream_idx);
        } else {
                _logger_log_err("sound_pool_play_stream(pool, \"%s\", %i, %f, %u,"
-                               " NULL, NULL, &stream_idx) returned %s value",
-                               tag, loop, volume, rank, __stringify_sound_pool_error(ret));
+                               " %u, %p, NULL, &stream_idx) returned %s value",
+                               tag, loop, volume, rank, priority_policy, __s_cb_msg, __stringify_sound_pool_error(ret));
        }
 
        return (ret == SOUND_POOL_ERROR_NONE ? OK : FAIL);