* @brief Enumeration for sound behavior.
* @since_tizen 3.0
* @remarks These values can be combined with bitwise 'or'.
- * @see sound_manager_focus_set_requesting_behavior()
- * @see sound_manager_focus_get_requesting_behavior()
- * @see sound_manager_focus_get_requested_behavior()
* @see sound_manager_get_current_playback_focus()
* @see sound_manager_get_current_recording_focus()
*/
typedef enum {
SOUND_SESSION_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed*/
SOUND_SESSION_INTERRUPTED_BY_MEDIA, /**< Interrupted by media application*/
- SOUND_SESSION_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call*/
+ SOUND_SESSION_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call*/
SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones*/
SOUND_SESSION_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict*/
SOUND_SESSION_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm*/
* Therefore it is recommended not to call UI update function in this function.
*
* @param[in] stream_info The handle of stream information
+ * @param[in] focus_mask The changed focus mask
+ * @param[in] focus_state The changed focus state
* @param[in] reason The reason for state change of the focus
+ * @param[in] sound_behavior The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
* @param[in] extra_info The extra information
* @param[in] user_data The user data passed from the callback registration function
* @pre You should register this callback using sound_manager_create_stream_information().
- * @post Use sound_manager_get_focus_state() in this callback to figure out how the focus state of\n
- * the @a stream_info has been changed.\n
- * Use sound_manager_focus_get_requested_behavior() in this callback to check the recommended sound behavior\n
- * that should be followed to enhance the sound experience.
* @see sound_manager_create_stream_information()
* @see sound_manager_destroy_stream_information()
* @see sound_manager_get_focus_state()
- * @see sound_manager_get_changed_focus_state()
- * @see sound_manager_focus_get_requested_behavior()
*/
-typedef void (*sound_stream_focus_state_changed_cb) (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data);
+typedef void (*sound_stream_focus_state_changed_cb) (sound_stream_info_h stream_info,
+ sound_stream_focus_mask_e focus_mask,
+ sound_stream_focus_state_e focus_state,
+ sound_stream_focus_change_reason_e reason,
+ int sound_behavior,
+ const char *extra_info,
+ void *user_data);
/**
* @brief Called when the focus state for each sound stream type is changed regardless of the process.
*
* @param[in] stream_info The handle of stream information
* @param[in] focus_mask The focus mask that user wants to acquire
+ * @param[in] sound_behavior The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
* @param[in] extra_info The extra information for this request (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @see sound_manager_release_focus()
* @see sound_manager_get_focus_state()
*/
-int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *extra_info);
+int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info);
/**
* @brief Releases the acquired focus.
*
* @param[in] stream_info The handle of stream information
* @param[in] focus_mask The focus mask that user wants to release
+ * @param[in] sound_behavior The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
* @param[in] extra_info The extra information for this request (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @see sound_manager_acquire_focus()
* @see sound_manager_get_focus_state()
*/
-int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *extra_info);
+int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info);
/**
* @brief Gets the state of focus.
* @see sound_manager_destroy_stream_information()
* @see sound_manager_acquire_focus()
* @see sound_manager_release_focus()
- * @see sound_manager_get_changed_focus_state()
*/
int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording);
/**
- * @brief Gets the changed focus mask and state.
- * @since_tizen 3.0
- *
- * @remarks The changed focus mask and state can be obtained from this function within sound_stream_focus_state_changed_cb().\n
- * This function differs from sound_manager_get_focus_state() in that it only gets the changed focus mask and state.\n
- * Note that this function should be called within sound_stream_focus_state_changed_cb().
- *
- * @param[in] stream_info The handle of stream information
- * @param[out] focus_mask The changed focus mask
- * @param[out] focus_state The changed focus state
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
- * @pre Called sound_stream_focus_state_changed_cb() before calling this function.
- * @see sound_manager_create_stream_information()
- * @see sound_manager_acquire_focus()
- * @see sound_manager_release_focus()
- * @see sound_manager_get_focus_state()
- */
-int sound_manager_get_changed_focus_state(sound_stream_info_h stream_info, sound_stream_focus_mask_e *focus_mask, sound_stream_focus_state_e *focus_state);
-
-/**
* @brief Sets auto focus reacquisition property.
* @since_tizen 3.0
*
int sound_manager_get_focus_reacquisition(sound_stream_info_h stream_info, bool *enabled);
/**
- * @brief Sets sound behavior to be passed to handles that will be affected by acquiring or releasing the stream focus of this handle.
- * @since_tizen 3.0
- *
- * @remarks This function's purpose is to set the sound behavior to be applied by other handles when acquiring or\n
- * releasing the stream focus. Other handles affected by this handle can get this information by using\n
- * sound_manager_focus_get_requested_behavior() after sound_stream_focus_state_changed_cb() is called.
- *
- * @param[in] stream_info The handle of stream information
- * @param[in] flags The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Call sound_manager_create_stream_information() before calling this function.
- * @post It will be passed to the other handle right after calling sound_manager_acquire_focus() or sound_manager_release_focus().
- * @see sound_manager_create_stream_information()
- * @see sound_manager_acquire_focus()
- * @see sound_manager_release_focus()
- * @see sound_manager_focus_get_requesting_behavior()
- * @see sound_manager_focus_get_requested_behavior()
- */
-int sound_manager_focus_set_requesting_behavior(sound_stream_info_h stream_info, int flags);
-
-/**
- * @brief Gets sound behavior to be passed to handles that will be affected by acquiring or releasing the stream focus of this handle.
- * @since_tizen 3.0
- *
- * @remarks This function's purpose is to get the sound behavior to be applied by other handles when acquiring or\n
- * releasing the stream focus. Other handles affected by this handle can get this information by using\n
- * sound_manager_focus_get_requested_behavior() after sound_stream_focus_state_changed_cb() is called.
- *
- * @param[in] stream_info The handle of stream information
- * @param[out] flags The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Call sound_manager_create_stream_information() before calling this function.
- * @post It will be passed to other handles right after calling sound_manager_acquire_focus() or sound_manager_release_focus().
- * @see sound_manager_create_stream_information()
- * @see sound_manager_acquire_focus()
- * @see sound_manager_release_focus()
- * @see sound_manager_focus_set_requesting_behavior()
- * @see sound_manager_focus_get_requested_behavior()
- */
-int sound_manager_focus_get_requesting_behavior(sound_stream_info_h stream_info, int *flags);
-
-/**
- * @brief Gets the requested sound behavior.
- * @since_tizen 3.0
- *
- * @remarks The flags can be used as a guide to how to change the sound behavior right after getting\n
- * sound_stream_focus_state_changed_cb(). It is highly recommended to follow this sound behavior information\n
- * for the enhanced sound experience. Note that this function should be called within sound_stream_focus_state_changed_cb().
- *
- * @param[in] stream_info The handle of stream information
- * @param[out] flags The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
- * @pre Called sound_stream_focus_state_changed_cb() before calling this function.
- * @see sound_manager_create_stream_information()
- * @see sound_manager_focus_set_requesting_behavior()
- * @see sound_manager_focus_get_requesting_behavior()
- * @see sound_manager_acquire_focus()
- * @see sound_manager_release_focus()
- */
-int sound_manager_focus_get_requested_behavior(sound_stream_info_h stream_info, int *flags);
-
-/**
* @brief Gets the reason for the current acquired playback focus.
* @since_tizen 3.0
*
* The @a extra_info should be released using free().
*
* @param[out] acquired_by The reason for the current acquired playback focus
- * @param[out] flags The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
+ * @param[out] sound_behavior The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
* @param[out] extra_info The extra information of the acquired playback focus (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SOUND_MANAGER_ERROR_NO_DATA No data
* @see sound_manager_get_current_recording_focus()
*/
-int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info);
+int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *sound_behavior, char **extra_info);
/**
* @brief Gets the reason for the current acquired recording focus.
* The @a extra_info should be released using free().
*
* @param[out] acquired_by The reason for the current acquired recording focus
- * @param[out] flags The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
+ * @param[out] sound_behavior The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
* @param[out] extra_info The extra information of the acquired recording focus (optional, this can be NULL)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SOUND_MANAGER_ERROR_NO_DATA No data
* @see sound_manager_get_current_playback_focus()
*/
-int sound_manager_get_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info);
+int sound_manager_get_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, int *sound_behavior, char **extra_info);
/**
* @brief Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process.
pa_context *pa_context;
stream_conf_info_s stream_conf_info;
unsigned int acquired_focus;
- mm_sound_focus_type_e changed_focus_type;
- mm_sound_focus_state_e changed_focus_state;
- int requesting_flags;
- int requested_flags;
sound_stream_focus_state_changed_cb user_cb;
void *user_data;
manual_route_info_s manual_route_info;
void _focus_session_interrupt_cb(mm_sound_focus_state_e state, const char *reason, bool is_wcb, void *user_data);
-void _voip_focus_state_change_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data);
+void _voip_focus_state_change_callback(sound_stream_info_h stream_info,
+ sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
+ sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data);
void _device_connected_cb(sound_device_h device, bool is_connected, void *user_data);
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.3.80
+Version: 0.3.81
Release: 0
Group: Multimedia/API
License: Apache-2.0
return _convert_sound_manager_error_code(__func__, ret);
}
-int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *extra_info)
+int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info)
{
int ret = MM_ERROR_NONE;
sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
}
- ret = mm_sound_acquire_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, stream_h->requesting_flags, extra_info);
+ ret = mm_sound_acquire_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, sound_behavior, extra_info);
if (ret == MM_ERROR_NONE) {
stream_h->acquired_focus |= focus_mask;
_update_focus_status(stream_h->index, (unsigned int)stream_h->acquired_focus);
return _convert_sound_manager_error_code(__func__, ret);
}
-int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *extra_info)
+int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, int sound_behavior, const char *extra_info)
{
int ret = MM_ERROR_NONE;
sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
SM_INSTANCE_CHECK(stream_h);
- ret = mm_sound_release_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, stream_h->requesting_flags, extra_info);
+ ret = mm_sound_release_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, sound_behavior, extra_info);
if (ret == MM_ERROR_NONE) {
stream_h->acquired_focus &= ~focus_mask;
_update_focus_status(stream_h->index, (unsigned int)stream_h->acquired_focus);
return _convert_sound_manager_error_code(__func__, ret);
}
-int sound_manager_get_changed_focus_state(sound_stream_info_h stream_info, sound_stream_focus_mask_e *focus_mask, sound_stream_focus_state_e *focus_state)
-{
- int ret = MM_ERROR_NONE;
- sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
- bool is_focus_cb_thread = false;
-
- LOGI(">> enter");
-
- SM_INSTANCE_CHECK(stream_h);
- SM_NULL_ARG_CHECK(focus_mask);
- SM_NULL_ARG_CHECK(focus_state);
-
- if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread)))
- return _convert_sound_manager_error_code(__func__, ret);
-
- if (!is_focus_cb_thread) {
- LOGE("this API should be called in focus state changed callback");
- return SOUND_MANAGER_ERROR_INVALID_OPERATION;
- }
-
- if (stream_h->changed_focus_type == FOCUS_NONE)
- return SOUND_MANAGER_ERROR_INVALID_OPERATION;
-
- *focus_mask = (sound_stream_focus_mask_e)stream_h->changed_focus_type;
- *focus_state = (sound_stream_focus_state_e)stream_h->changed_focus_state;
-
- LOGI("changed focus(mask:0x%x, state:%d)", *focus_mask, *focus_state);
-
- return _convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_focus_set_requesting_behavior(sound_stream_info_h stream_info, int flags)
-{
- sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
-
- LOGI(">> enter");
-
- SM_INSTANCE_CHECK(stream_h);
- SM_RANGE_ARG_CHECK(flags,
- SOUND_BEHAVIOR_NONE,
- (SOUND_BEHAVIOR_NO_RESUME|SOUND_BEHAVIOR_FADING));
-
- stream_h->requesting_flags = flags;
-
- LOGI("the requesting sound behavior(0x%x) is set", stream_h->requesting_flags);
-
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-int sound_manager_focus_get_requesting_behavior(sound_stream_info_h stream_info, int *flags)
-{
- sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
-
- LOGI(">> enter");
-
- SM_INSTANCE_CHECK(stream_h);
- SM_NULL_ARG_CHECK(flags);
-
- *flags = stream_h->requesting_flags;
-
- LOGI("the requesting sound behavior is (0x%x)", stream_h->requesting_flags);
-
- return SOUND_MANAGER_ERROR_NONE;
-}
-
-int sound_manager_focus_get_requested_behavior(sound_stream_info_h stream_info, int *flags)
-{
- int ret = MM_ERROR_NONE;
- sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
- bool is_focus_cb_thread = false;
-
- LOGI(">> enter");
-
- SM_INSTANCE_CHECK(stream_h);
- SM_NULL_ARG_CHECK(flags);
-
- if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread)))
- return _convert_sound_manager_error_code(__func__, ret);
-
- if (!is_focus_cb_thread) {
- LOGE("this API should be called in focus state changed callback");
- return SOUND_MANAGER_ERROR_INVALID_OPERATION;
- }
-
- *flags = stream_h->requested_flags;
-
- LOGI("requested sound behavior is (0x%x)", stream_h->requested_flags);
-
- return SOUND_MANAGER_ERROR_NONE;
-}
-
int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info)
{
int ret = MM_ERROR_NONE;
else if (state == FOCUS_IS_ACQUIRED)
sound_stream_info_arr[i]->acquired_focus |= focus_type;
- /* set flags for requested behavior */
- sound_stream_info_arr[i]->requested_flags = option;
-
- /* set changed focus value */
- sound_stream_info_arr[i]->changed_focus_type = focus_type;
- sound_stream_info_arr[i]->changed_focus_state = state;
-
LOGI("[FOCUS USER CALLBACK(%p) START]", sound_stream_info_arr[i]->user_cb);
- sound_stream_info_arr[i]->user_cb((sound_stream_info_h)sound_stream_info_arr[i], change_reason, extra_info, sound_stream_info_arr[i]->user_data);
+ sound_stream_info_arr[i]->user_cb((sound_stream_info_h)sound_stream_info_arr[i],
+ focus_type, state, change_reason, option, extra_info, sound_stream_info_arr[i]->user_data);
LOGI("[FOCUS USER CALLBACK(%p) END]", sound_stream_info_arr[i]->user_cb);
- /* unset changed focus value */
- sound_stream_info_arr[i]->changed_focus_type = FOCUS_NONE;
-
- /* unset flags for requested behavior */
- sound_stream_info_arr[i]->requested_flags = 0;
break;
}
}
}
/* This is an internal callback for the VOIP SESSION */
-void _voip_focus_state_change_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data)
+void _voip_focus_state_change_callback(sound_stream_info_h stream_info,
+ sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
+ sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data)
{
sound_stream_info_s *info = (sound_stream_info_s *)stream_info;
- LOGI(">> enter, stream_info(%p), change_reason(%d), extra_info(%s)", stream_info, reason, extra_info);
+ LOGI(">> enter, stream_info(%p), change_reason(%d), sound_behavior(0x%x), extra_info(%s)", stream_info, reason, sound_behavior, extra_info);
if (!info) {
LOGE("stream info is null");
CURRENT_STATUS_REMOVE_FOCUS_WATCH_CB,
CURRENT_STATUS_SET_FOCUS_REACQUISITION,
CURRENT_STATUS_GET_FOCUS_REACQUISITION,
- CURRENT_STATUS_SET_REQUESTING_BEHAVIOR,
- CURRENT_STATUS_GET_REQUESTING_BEHAVIOR,
- CURRENT_STATUS_GET_REQUESTED_BEHAVIOR,
CURRENT_STATUS_GET_REASON_FOR_P_FOCUS,
CURRENT_STATUS_GET_REASON_FOR_R_FOCUS,
CURRENT_STATUS_CREATE_VIRTUAL_STREAM,
[SOUND_DEVICE_BLUETOOTH_MODE_MEDIA | SOUND_DEVICE_BLUETOOTH_MODE_VOICE] = "Media & Voice"
};
-void focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data)
+void focus_callback(sound_stream_info_h stream_info,
+ sound_stream_focus_mask_e focus_mask,
+ sound_stream_focus_state_e focus_state,
+ sound_stream_focus_change_reason_e reason,
+ int sound_behavior,
+ const char *extra_info,
+ void *user_data)
{
int ret = SOUND_MANAGER_ERROR_NONE;
sound_stream_focus_state_e playback_focus_state;
sound_stream_focus_state_e recording_focus_state;
- sound_stream_focus_state_e changed_state;
- sound_stream_focus_mask_e changed_mask;
-
- int flags = SOUND_BEHAVIOR_NONE;
g_print("\n*** FOCUS callback is called, stream_info(%p) ***\n", stream_info);
- sound_manager_focus_get_requested_behavior(stream_info, &flags);
- g_print(" - change_reason(%d), behavior(0x%x), extra_info(%s), user_data(%p)\n", reason, flags, extra_info, user_data);
-
- ret = sound_manager_get_changed_focus_state(stream_info, &changed_mask, &changed_state);
- if (!ret)
- g_print(" - changed focus: mask(%x), state(%d) (0:released, 1:acquired)\n", changed_mask, changed_state);
+ g_print(" - changed focus: mask(%x), state(%d) (0:released, 1:acquired)\n", focus_mask, focus_state);
+ g_print(" - change_reason(%d), behavior(0x%x), extra_info(%s), user_data(%p)\n", reason, sound_behavior, extra_info, user_data);
ret = sound_manager_get_focus_state(stream_info, &playback_focus_state, &recording_focus_state);
if (!ret)
g_menu_state = CURRENT_STATUS_SET_FOCUS_REACQUISITION;
else if (strncmp(cmd, "gfr", 3) == 0)
g_menu_state = CURRENT_STATUS_GET_FOCUS_REACQUISITION;
- else if (strncmp(cmd, "srb", 3) == 0)
- g_menu_state = CURRENT_STATUS_SET_REQUESTING_BEHAVIOR;
- else if (strncmp(cmd, "grb", 3) == 0)
- g_menu_state = CURRENT_STATUS_GET_REQUESTING_BEHAVIOR;
- else if (strncmp(cmd, "grd", 3) == 0)
- g_menu_state = CURRENT_STATUS_GET_REQUESTED_BEHAVIOR;
else if (strncmp(cmd, "grp", 3) == 0)
g_menu_state = CURRENT_STATUS_GET_REASON_FOR_P_FOCUS;
else if (strncmp(cmd, "grr", 3) == 0)
g_print("rfw. Remove Focus State Watch CB\n");
g_print("sfr. Set Focus Reacquisition\t");
g_print("gfr. Get Focus Reacquisition\n");
- g_print("srb. Set Requesting Sound Behavior\t");
- g_print("grb. Get Requesting Sound Behavior\t");
- g_print("grd. Get Requested Sound Behavior\n");
g_print("grp. Get Reason for Current Acquired Playback Focus\t");
g_print("grr. Get Reason for Current Acquired Recording Focus\n");
g_print("sso. *Set option for stream routing\n");
else if (g_menu_state == CURRENT_STATUS_SET_STREAM_ROUTING_OPTION)
g_print("*** input option(name/value) for routing (0:option_1/0, 1:option_1/1, 2:option_2/0, 3:option_2:1)\n");
else if (g_menu_state == CURRENT_STATUS_ACQUIRE_FOCUS)
- g_print("*** input focus type to acquire (0:playback, 1:recording, 2:both)\n");
+ g_print("*** input focus type to acquire (0:playback, 1:recording, 2:both, 3:both+noResume, 4:both+fading)\n");
else if (g_menu_state == CURRENT_STATUS_RELEASE_FOCUS)
- g_print("*** input focus type to release (0:playback, 1:recording, 2:both)\n");
+ g_print("*** input focus type to release (0:playback, 1:recording, 2:both, 3:both+noResume, 4:both+fading)\n");
else if (g_menu_state == CURRENT_STATUS_GET_ACQUIRED_FOCUS)
g_print("*** press enter to get focus state\n");
else if (g_menu_state == CURRENT_STATUS_GET_SOUND_TYPE)
g_print("*** input focus reacquisition property (1:enable, 2:disable)\n");
else if (g_menu_state == CURRENT_STATUS_GET_FOCUS_REACQUISITION)
g_print("*** press enter to get focus reacquisition property\n");
- else if (g_menu_state == CURRENT_STATUS_SET_REQUESTING_BEHAVIOR)
- g_print("*** input flags for requesting audio behavior (0:none, 1:no_resume, 2:fading, 3:no_resume+fading)\n");
- else if (g_menu_state == CURRENT_STATUS_GET_REQUESTING_BEHAVIOR)
- g_print("*** press enter to get requesting audio behavior (0:none, 1:no_resume, 2:fading, 3:no_resume+fading)\n");
- else if (g_menu_state == CURRENT_STATUS_GET_REQUESTED_BEHAVIOR)
- g_print("*** press enter to get the requested audio behavior\n");
else if (g_menu_state == CURRENT_STATUS_GET_REASON_FOR_P_FOCUS)
g_print("*** press enter to get reason for current playback focus\n");
else if (g_menu_state == CURRENT_STATUS_GET_REASON_FOR_R_FOCUS)
int ret = SOUND_MANAGER_ERROR_NONE;
int focus_type = 0;
sound_stream_focus_mask_e focus_mask;
+ int behavior = SOUND_BEHAVIOR_NONE;
focus_type = atoi(cmd);
switch (focus_type) {
case 1: /* recording */
focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
break;
- case 2: /* all */
+ case 2: /* both */
+ focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
+ break;
+ case 3: /* both + no-resumption */
focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
+ behavior = SOUND_BEHAVIOR_NO_RESUME;
+ break;
+ case 4: /* both + fading */
+ focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
+ behavior = SOUND_BEHAVIOR_FADING;
break;
default:
+ g_print("invalid selection(%d), keep going with PLAYBACK focus..\n", focus_type);
focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
break;
}
- ret = sound_manager_acquire_focus(g_stream_info_h, focus_mask, "sound_manager_test(acquire_focus)");
+ ret = sound_manager_acquire_focus(g_stream_info_h, focus_mask,
+ behavior,
+ "sound_manager_test(acquire_focus)");
if (ret)
g_print("fail to sound_manager_acquire_focus(), ret(0x%x)\n", ret);
int ret = SOUND_MANAGER_ERROR_NONE;
int focus_type = 0;
sound_stream_focus_mask_e focus_mask;
+ int behavior = SOUND_BEHAVIOR_NONE;
focus_type = atoi(cmd);
switch (focus_type) {
case 2: /* both */
focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
break;
+ case 3: /* both + no-resumption */
+ focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
+ behavior = SOUND_BEHAVIOR_NO_RESUME;
+ break;
+ case 4: /* both + fading */
+ focus_mask = SOUND_STREAM_FOCUS_FOR_BOTH;
+ behavior = SOUND_BEHAVIOR_FADING;
+ break;
default:
+ g_print("invalid selection(%d), keep going with PLAYBACK focus..\n", focus_type);
focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
break;
}
- ret = sound_manager_release_focus(g_stream_info_h, focus_mask, "sound_manager_test(release_focus)");
+ ret = sound_manager_release_focus(g_stream_info_h, focus_mask,
+ behavior,
+ "sound_manager_test(release_focus)");
if (ret)
g_print("fail to sound_manager_release_focus(), ret(0x%x)\n", ret);
reset_menu_state();
break;
}
- case CURRENT_STATUS_SET_REQUESTING_BEHAVIOR: {
- int ret = SOUND_MANAGER_ERROR_NONE;
- int flags;
-
- switch (atoi(cmd)) {
- case 0: /* none */
- flags = SOUND_BEHAVIOR_NONE;
- break;
- case 1: /* no resumption */
- flags = SOUND_BEHAVIOR_NO_RESUME;
- break;
- case 2: /* fading effect */
- flags = SOUND_BEHAVIOR_FADING;
- break;
- case 3: /* no resumption + fading effect */
- flags = SOUND_BEHAVIOR_NO_RESUME | SOUND_BEHAVIOR_FADING;
- break;
- default:
- flags = SOUND_BEHAVIOR_NONE;
- break;
- }
-
- ret = sound_manager_focus_set_requesting_behavior(g_stream_info_h, flags);
- if (ret)
- g_print("fail to sound_manager_focus_set_requesting_behavior, ret(0x%x)\n", ret);
-
- reset_menu_state();
- break;
- }
- case CURRENT_STATUS_GET_REQUESTING_BEHAVIOR: {
- int ret = SOUND_MANAGER_ERROR_NONE;
- int flags;
-
- ret = sound_manager_focus_get_requesting_behavior(g_stream_info_h, &flags);
- if (ret)
- g_print("fail to sound_manager_focus_get_requesting_behavior, ret(0x%x)\n", ret);
- else
- g_print("requesting behavior is (0x%x)\n", flags);
-
- reset_menu_state();
- break;
- }
- case CURRENT_STATUS_GET_REQUESTED_BEHAVIOR: {
- int ret = SOUND_MANAGER_ERROR_NONE;
- int flags;
-
- ret = sound_manager_focus_get_requested_behavior(g_stream_info_h, &flags);
- if (ret)
- g_print("fail to sound_manager_focus_get_requested_behavior, ret(0x%x)\n", ret);
- else
- g_print("requested behavior is (0x%x)\n", flags);
-
- reset_menu_state();
- break;
- }
case CURRENT_STATUS_GET_REASON_FOR_P_FOCUS: {
int ret = SOUND_MANAGER_ERROR_NONE;
char *extra_info = NULL;
sound_stream_focus_change_reason_e reason;
- int flags;
+ int sound_behavior;
- ret = sound_manager_get_current_playback_focus(&reason, &flags, &extra_info);
+ ret = sound_manager_get_current_playback_focus(&reason, &sound_behavior, &extra_info);
if (ret)
g_print("fail to sound_manager_get_current_playback_focus, ret(0x%x)\n", ret);
else
- g_print("reason(%d), flags(0x%x), extra_info(%s)\n", reason, flags, extra_info);
+ g_print("reason(%d), sound_behavior(0x%x, 0x0:none 0x1:no_resume 0x2:fading), extra_info(%s)\n", reason, sound_behavior, extra_info);
free(extra_info);
reset_menu_state();
int ret = SOUND_MANAGER_ERROR_NONE;
char *extra_info = NULL;
sound_stream_focus_change_reason_e reason;
- int flags;
+ int sound_behavior;
- ret = sound_manager_get_current_recording_focus(&reason, &flags, &extra_info);
+ ret = sound_manager_get_current_recording_focus(&reason, &sound_behavior, &extra_info);
if (ret)
g_print("fail to sound_manager_get_current_recording_focus, ret(0x%x)\n", ret);
else
- g_print("reason(%d), flags(0x%x), extra_info(%s)\n", reason, flags, extra_info);
+ g_print("reason(%d), sound_behavior(0x%x, 0x0:none 0x1:no_resume 0x2:fading), extra_info(%s)\n", reason, sound_behavior, extra_info);
free(extra_info);
reset_menu_state();