From 396e697a6a079284f0facb6d66289fe460e18330 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 10 Oct 2016 21:02:29 +0900 Subject: [PATCH] Acquire recognition sound focus before starting STT Change-Id: I1d767d241a7265ec6e07dae1d8e2a5c1216dfaf4 Signed-off-by: Jihoon Kim --- src/SttManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index f8251f9..46b384e 100644 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -138,9 +138,9 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - 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_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { - LOGW("Fail to acquire focus. ret : %d, stream handle : %p", ret, g_stream_info_h); + LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } ret = stt_start(handle, language.c_str(), asrtype.c_str()); @@ -533,8 +533,8 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - int ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + int ret = sound_manager_release_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { - LOGW("Fail to release focus. ret : %d", ret); + LOGW("Fail to release playback or recording focus. ret : %d", ret); } } -- 2.7.4