From: sungwook79.park Date: Fri, 11 Nov 2016 06:07:54 +0000 (+0900) Subject: Support multi session for voice input mode X-Git-Tag: submit/tizen_3.0/20161111.074106~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97c3c0468ab53ec60f5c21b884b75f6aea48a6fe;p=platform%2Fcore%2Fuifw%2Fise-default.git Support multi session for voice input mode Change-Id: I7f512c110e07b527df5b1d095544ced8b34ff318 Signed-off-by: sungwook79.park --- diff --git a/src/ise-stt-mode.cpp b/src/ise-stt-mode.cpp index 5e43b02..fd91c00 100644 --- a/src/ise-stt-mode.cpp +++ b/src/ise-stt-mode.cpp @@ -120,7 +120,9 @@ static Eina_Bool hide_guide_text(void *data) voicedata->guide_text_timer = NULL; elm_object_part_text_set(voicedata->layout_main, "elm.text", ""); - set_guide_text(voicedata, SK_TAP_TO_PAUSE, true); + + if(voicedata->sttmanager->GetCurrent() == STT_STATE_RECORDING || voicedata->sttmanager->GetCurrent() == STT_STATE_PROCESSING) + set_guide_text(voicedata, SK_TAP_TO_PAUSE, true); return ECORE_CALLBACK_CANCEL; } @@ -156,7 +158,39 @@ static void on_mic_button_press_cb(void *data, Evas_Object *obj, void *event_inf VoiceData *voicedata = (VoiceData *)data; if (!voicedata) return; - edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + if (voicedata->sttmanager != NULL && + (voicedata->sttmanager->GetCurrent() == STT_STATE_RECORDING + || voicedata->sttmanager->GetCurrent() == STT_STATE_PROCESSING)) { + try { + voicedata->state = STT_STATE_VAL_INIT; + voicedata->sttmanager->Stop(); + } + catch (is::stt::SttException &e) { + } + + if (voicedata->effector) + voicedata->effector->Stop(true); + + if (NULL != voicedata->start_timer) { + ecore_timer_del(voicedata->start_timer); + voicedata->start_timer = NULL; + } + if (NULL != voicedata->guide_text_timer) { + ecore_timer_del(voicedata->guide_text_timer); + voicedata->guide_text_timer = NULL; + } + if (NULL != voicedata->init_timer) { + ecore_timer_del(voicedata->init_timer); + voicedata->init_timer = NULL; + } + if (NULL != voicedata->refresh_timer) { + ecore_timer_del(voicedata->refresh_timer); + voicedata->refresh_timer = NULL; + } + set_guide_text(voicedata, SK_SPEAK_NOW, true); + } else { + edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + } } static Eina_Bool _mic_button_enable_cb(void *data) @@ -281,7 +315,7 @@ void set_animation_state(VoiceData *voicedata) set_guide_text(voicedata, SK_SPEAK_NOW, true); if (voicedata->effector) - voicedata->effector->Start(); + voicedata->effector->Stop(true); } else if (voicedata->state == STT_STATE_VAL_PROCESSING) { set_guide_text(voicedata, ""); @@ -358,6 +392,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission { LOGD("on_initial_anim_press_cb"); VoiceData *vd = (VoiceData *)data; + if (vd == NULL) + return; int tempVal = vd->sttmanager->GetCurrent(); if (tempVal == STT_STATE_CREATED) { @@ -417,6 +453,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission } catch (is::stt::SttException &e) { } + if (vd->effector) + vd->effector->Stop(true); break;