return NULL;
}
-void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *extra_info, void *user_data)
+void __player_focus_state_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_for_change, int sound_behavior, const char *extra_info, void *user_data)
{
SLOG(LOG_DEBUG, tts_tag(), "===== Focus state changed cb");
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Invalid stream info handle");
return;
}
+ SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)focus_state, (int)reason_for_change);
- int ret;
- sound_stream_focus_state_e state_for_playback ;
- ret = sound_manager_get_focus_state(g_stream_info_h, &state_for_playback, NULL);
- if (SOUND_MANAGER_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to get focus state");
- return;
- }
-
- SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)state_for_playback, (int)reason_for_change);
-
- if (AUDIO_STATE_PLAY == g_audio_state && SOUND_STREAM_FOCUS_STATE_RELEASED == state_for_playback) {
+ if (AUDIO_STATE_PLAY == g_audio_state && focus_mask == SOUND_STREAM_FOCUS_FOR_PLAYBACK && SOUND_STREAM_FOCUS_STATE_RELEASED == focus_state) {
if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
g_audio_state = AUDIO_STATE_READY;
/* Set stream info */
int ret;
if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
- ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
if (SOUND_MANAGER_ERROR_NONE != ret) {
SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to acquire focus");
}
int ret;
/* Unset stream info */
if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
- ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
if (SOUND_MANAGER_ERROR_NONE != ret) {
SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to release focus");
}