From d73a6a8d94060ce2a4035d4a00ef0004bf4faa0f Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Tue, 22 Nov 2016 13:53:59 +0900 Subject: [PATCH 01/16] Remove Profile Build Dependency (trivial) - This is for Tizen 4.0. : Tizen 4.0 Configurability and Build Blocks require to remove all profile-depending build options in spec files. (No More profile macros) : However, this %if/%endif is not removed because this breaks build compatibility with old conventional project-based OBS projects (common only) : The form of %if/%endif and its comments are added/modified to support 4.0 unified build environment. - If you do not want to include this in a specific profile's build project, you can do so by removing this from OBS profile-project. : However, it is already done so for mobile/tv/ivi. Therefore these %if/%endif are useless. Change-Id: I38b75ed2bebd40f1731e5a3e83368e3ef88ce7a5 Signed-off-by: MyungJoo Ham --- packaging/org.tizen.inputdelegator.spec | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index f8cbf92..1f93e38 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,3 +1,12 @@ +# For the backward compatibility, this is to be built for +# wearable profile or 4.0 unified building environment. +# This cannot be built for non-wearable in conventional 3.0 build environment. +# Note that it is not a good idea to limit building with ExcludeArch because there are new architectures being tested. +# Use ExclusiveArch istead. +%if "%{?profile}" == "mobile" || "%{?profile}" == "tv" || "%{?profile}" == "ivi" || "%{?profile}" == "common" +ExclusiveArch: none +%endif + Name: org.tizen.inputdelegator Summary: Input Delegator Application Version: 0.1.161102 @@ -37,22 +46,6 @@ BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(bundle) %endif -%if "%{?profile}" == "mobile" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "tv" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "common" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "ivi" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - %define _appdir /usr/apps %define _app_destdir %{_appdir}/%{name} -- 2.7.4 From ebdbe373c84b61a013b73f5376e81a9d1363c6bb Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Tue, 22 Nov 2016 14:32:44 +0900 Subject: [PATCH 02/16] Update package version to 0.1.161122 Change-Id: I1f4bd19c9f14d8cd1a26be24280c3d7aba352fc9 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index 87d0348..bafb22e 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index f8cbf92..0416a7d 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.161102 +Version: 0.1.161122 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 2c2a1320539c24b872772c15c5a9337bba134ee7 Mon Sep 17 00:00:00 2001 From: "aravind.gara" Date: Tue, 22 Nov 2016 20:55:59 +0900 Subject: [PATCH 03/16] sound-manager API changed Change-Id: Ib748132786489d056d15088faa0a749b417115e1 Signed-off-by: aravind.gara --- src/SttManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index d8c53b5..517b250 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -50,7 +50,8 @@ static inline const char *stt_state_str(stt_state_e cur) { return (const char *) "ABNORMAL CASE"; } -static 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) +static 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_behaviors, const char *extra_info, void *user_data) { } @@ -140,7 +141,7 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - 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); + ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } @@ -554,7 +555,7 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - 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); + 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), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to release playback or recording focus. ret : %d", ret); } -- 2.7.4 From 72b9709f0cb45ae74042cba2e7b8659eb083bd9a Mon Sep 17 00:00:00 2001 From: sungwook park Date: Thu, 24 Nov 2016 02:27:12 -0800 Subject: [PATCH 04/16] Revert "sound-manager API changed" This reverts commit 2c2a1320539c24b872772c15c5a9337bba134ee7. Change-Id: I93bb56fb617397c705c3bd46f46880b165b7651e --- src/SttManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index 517b250..d8c53b5 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -50,8 +50,7 @@ static inline const char *stt_state_str(stt_state_e cur) { return (const char *) "ABNORMAL CASE"; } -static 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_behaviors, const char *extra_info, void *user_data) +static 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) { } @@ -141,7 +140,7 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), SOUND_BEHAVIOR_NONE, 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 playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } @@ -555,7 +554,7 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - 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), SOUND_BEHAVIOR_NONE, 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 playback or recording focus. ret : %d", ret); } -- 2.7.4 From 5cf54f8cc513587ffdaed5141273ff2dd1f6978f Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 25 Nov 2016 17:21:38 +0900 Subject: [PATCH 05/16] Fix build error when Werror option is on Change-Id: I2dc58f397cf225aa83caf0e05f9807c6c15e1efc Signed-off-by: sungwook79.park --- packaging/org.tizen.inputdelegator.spec | 2 -- src/w-input-emoticon.cpp | 29 +++++++++++------------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 0416a7d..5d24c27 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -67,11 +67,9 @@ Input Delegator Application for Wearable environment %setup -q %build -%if 0%{?sec_build_binary_debug_enable} export CFLAGS+=" -DTIZEN_DEBUG_ENABLE -Werror" export CXXFLAGS+=" -DTIZEN_DEBUG_ENABLE -Werror" export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -Werror" -%endif export CXXFLAGS="$CXXFLAGS -std=gnu++0x" diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index d6e17bf..8ad6c45 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -41,7 +41,7 @@ vector recent_emoji_list; typedef struct { int code; - char* name; + const char* name; }Emoticon; static Elm_Object_Item *it_emoticon_empty = NULL; @@ -257,13 +257,6 @@ Emoticon emoticon_info[EMOTICON_CNT] = { }; -static Eina_Bool _custom_back_cb(void *data, Elm_Object_Item *it) -{ - _back_to_genlist_for_selector(); - return EINA_TRUE; -} - - //---------------------------------------------------------------------------------------// static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it) @@ -330,7 +323,7 @@ void get_recent_emoticons(vector &emoticon_list) void set_recent_emoticons(vector &emoticon_list, int val) { - int i; + unsigned int i; int ret = PREFERENCE_ERROR_NONE; if (emoticon_list.size() > 0) { @@ -378,7 +371,7 @@ static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event set_recent_emoticons(recent_emoji_list, index); int length; - const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); reply_to_sender_by_callback((const char*)utf_8, "emoticon"); @@ -400,7 +393,7 @@ Evas_Object* get_emoticon_button(Evas_Object* parent, int index){ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); int length; - const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); @@ -424,7 +417,7 @@ Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); int length; - const Eina_Unicode unicode_event[2] = { emoticon_info[recent_emoji_list.at(index)].code, 0 }; + const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[recent_emoji_list.at(index)].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); @@ -481,7 +474,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo emoticon_contents_pool[index+2].used = 0; } } else if (!strcmp(itc->item_style, "3button_flat_recent")) { - int index = (int)elm_object_item_data_get(it); + unsigned int index = (int)elm_object_item_data_get(it); //PRINTFUNC(DLOG_DEBUG,"index = %d",index); if (index < recent_emoji_list.size()) { @@ -499,7 +492,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part) { if (is_content_reuse_on) { - int index = (int)data; + unsigned int index = (unsigned int)data; int new_index = 0; //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); @@ -525,7 +518,7 @@ static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *o return btn; } } else { - int index = (int)data; + unsigned int index = (unsigned int)data; int new_index = 0; // PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); @@ -579,7 +572,7 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object elm_object_part_text_set(btn, "elm.text", strdup(utf_8)); #else int length; - const Eina_Unicode unicode_event[2] = { emoticon_info[new_index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[new_index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); evas_object_data_set(btn, "index", (void*)new_index); @@ -627,7 +620,7 @@ void _create_reusable_recents(Evas_Object *parent) return; } - int i; + unsigned int i; for (i = 0; i < recent_emoji_list.size(); i++ ) { emoticon_recents_pool[i].index = i; emoticon_recents_pool[i].content = get_recent_emoticon_button(parent, i); @@ -792,7 +785,7 @@ void _update_emoticon_items(void *data) if (!gl) return; - int i; + unsigned int i; Elm_Object_Item *it = NULL; Elm_Object_Item *first_it = NULL; -- 2.7.4 From a204ab0e832a2e7d46a63d96e396e708dfe35403 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 25 Nov 2016 17:24:51 +0900 Subject: [PATCH 06/16] Update package version to 0.1.161125 Change-Id: I6c2bb4ca55413444532f56af7812ba13dfcd54c9 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index bafb22e..950f7e0 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 5d24c27..8194598 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.161122 +Version: 0.1.161125 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 0d9a51f1dcae57c94dd5cd6859a7268857aaeb01 Mon Sep 17 00:00:00 2001 From: "aravind.gara" Date: Tue, 29 Nov 2016 17:38:18 +0900 Subject: [PATCH 07/16] sound-manager API changed. Change-Id: I074b9459d75036e7aa3841c90c1e26d0c920875c Signed-off-by: aravind.gara --- src/SttManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index d8c53b5..3632923 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -50,7 +50,8 @@ static inline const char *stt_state_str(stt_state_e cur) { return (const char *) "ABNORMAL CASE"; } -static 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) +static 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) { } @@ -140,7 +141,7 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - 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); + ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } @@ -554,7 +555,7 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - 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); + 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), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to release playback or recording focus. ret : %d", ret); } -- 2.7.4 From ab216464b5c37788f60eca3ff8d40b036b613038 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 2 Dec 2016 15:01:22 +0900 Subject: [PATCH 08/16] Update package version to 0.1.161202 Change-Id: Ief3cf9dfc50f86d95d90c8d35ea7abf70ab451a7 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index 950f7e0..a00448c 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 8194598..841f06a 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.161125 +Version: 0.1.161202 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From abc3800a7c1bbe30f71aba0aef215452f644d0a8 Mon Sep 17 00:00:00 2001 From: "aravind.gara" Date: Tue, 29 Nov 2016 17:38:18 +0900 Subject: [PATCH 09/16] sound-manager API changed. Change-Id: I074b9459d75036e7aa3841c90c1e26d0c920875c Signed-off-by: aravind.gara --- src/SttManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index d8c53b5..3632923 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -50,7 +50,8 @@ static inline const char *stt_state_str(stt_state_e cur) { return (const char *) "ABNORMAL CASE"; } -static 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) +static 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) { } @@ -140,7 +141,7 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - 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); + ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } @@ -554,7 +555,7 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - 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); + 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), SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { LOGW("Fail to release playback or recording focus. ret : %d", ret); } -- 2.7.4 From 381634f971c2f2b330ce39772b9edddcbe5673a3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 2 Dec 2016 16:17:54 +0900 Subject: [PATCH 10/16] Fix build error Change-Id: Ideda05974beecc2b1f746c1a14f4814966c1b177 Signed-off-by: Jihoon Kim --- src/w-input-emoticon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index 8ad6c45..f0c64f2 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -371,7 +371,7 @@ static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event set_recent_emoticons(recent_emoji_list, index); int length; - const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); reply_to_sender_by_callback((const char*)utf_8, "emoticon"); @@ -393,7 +393,7 @@ Evas_Object* get_emoticon_button(Evas_Object* parent, int index){ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); int length; - const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); @@ -417,7 +417,7 @@ Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); int length; - const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[recent_emoji_list.at(index)].code, 0 }; + const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[recent_emoji_list.at(index)].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); @@ -572,7 +572,7 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object elm_object_part_text_set(btn, "elm.text", strdup(utf_8)); #else int length; - const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[new_index].code, 0 }; + const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[new_index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); evas_object_data_set(btn, "index", (void*)new_index); -- 2.7.4 From 372d6fee3ef4443b31d249ce6f6b2da41d3b4589 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 8 Dec 2016 13:50:30 +0900 Subject: [PATCH 11/16] Adopt wave VI for voice mode Change-Id: I944da15dc5ce5a28308a6575dde14e2a33100b63 Signed-off-by: sungwook79.park --- inc/MicEffector.h | 14 +- res/edje/w-input-stt.edc | 31 ++- src/MicEffector.cpp | 553 ++++++++++++++++++++++----------------------- src/WInputSttMicEffect.cpp | 168 +++++++------- src/w-input-stt-voice.cpp | 116 +++++----- 5 files changed, 446 insertions(+), 436 deletions(-) mode change 100755 => 100644 src/MicEffector.cpp mode change 100755 => 100644 src/WInputSttMicEffect.cpp diff --git a/inc/MicEffector.h b/inc/MicEffector.h index 8284f1c..aa3b821 100755 --- a/inc/MicEffector.h +++ b/inc/MicEffector.h @@ -18,7 +18,7 @@ #include #include -#include "Debug.h" + #define SAMPLE_COUNT 59 @@ -140,14 +140,6 @@ class MicEffector void DrawDummyFrame(); /** - * Efl vector canvas handle - * - */ -// ea_vector_canvas_h *canvas; -// ea_vector_path_h *path; -// ea_vector_paint_h *paint; - - /** * Volume values. * */ @@ -161,6 +153,10 @@ class MicEffector bool started; bool fake; + Evas_Object *vg; + Efl_VG *root; + Efl_VG *shape; + /** * timer handle * diff --git a/res/edje/w-input-stt.edc b/res/edje/w-input-stt.edc index b123590..62d648d 100755 --- a/res/edje/w-input-stt.edc +++ b/res/edje/w-input-stt.edc @@ -603,23 +603,46 @@ collections description { state, "default" 0.0; - min, 0 74; - max, 9999 74; + min, 0 64; + max, 360 64; align, 0.5 1; rel1 { relative, 0 1; to, "bg"; - offset, 0 -14; + offset, 0 -1; } rel2 { relative, 1 1; to, "bg"; - offset, 0 -14; + offset, 0 -1; + } + } + + description + { + state, "hide" 0.0; + min, 0 64; + max, 360 64; + align, 0.5 1; + rel1 + { + relative, 0 (360+64)/360; + to, "bg"; + offset, 0 +13; } + rel2 + { + relative, 1 (360+64)/360; + to, "bg"; + offset, 0 +13; + } + } + } + part { name, "EFFECT_BG"; diff --git a/src/MicEffector.cpp b/src/MicEffector.cpp old mode 100755 new mode 100644 index 9010026..b318e57 --- a/src/MicEffector.cpp +++ b/src/MicEffector.cpp @@ -14,9 +14,21 @@ * limitations under the License. */ +#define EFL_BETA_API_SUPPORT 1 +#define EFL_EO_API_SUPPORT 1 + +#include + #include #include "MicEffector.h" +#include +#include +#include +#undef LOG_TAG +#define LOG_TAG "INPUT_DELEGATOR" + + using namespace is::ui; /** @@ -33,28 +45,27 @@ static float timeout_s = 1.0f / 60.0f; double cubic_easy_in_out(double index, double start, double end, double duration) { - index /= duration/2; - if (index < 1) - return end/2*index*index*index + start; + index /= duration/2; + if (index < 1) + return end/2*index*index*index + start; - index -= 2; - return end/2*(index*index*index + 2) + start; + index -= 2; + return end/2*(index*index*index + 2) + start; } double cubic_easy_in(double index, double start, double end, double duration) { - index /= duration; - return end*index*index*index*index*index + start; + index /= duration; + return end*index*index*index*index*index + start; } double cubic_easy_out(double index, double start, double end, double duration) { - index /= duration; - index--; - return end*(index*index*index + 1) + start; + index /= duration; + index--; + return end*(index*index*index + 1) + start; } - /** * Constructor * @@ -63,30 +74,32 @@ double cubic_easy_out(double index, double start, double end, double duration) * #2. Drawing empty frame to avoid broken screen. * */ - MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& effect) - : drawcount(0) - , forcestop(false) - , started(false) - , fake(false) - , timer(NULL) - , layout(layout) - , ieffect(effect) + : drawcount(0) + , forcestop(false) + , started(false) + , fake(false) + , timer(NULL) + , layout(layout) + , ieffect(effect) { -// path = ea_vector_path_create(); -// paint = ea_vector_paint_create(); -// ea_vector_paint_set_style(paint, EA_VECTOR_PAINT_STYLE_STROKE); -// ea_vector_paint_set_line_cap(paint, EA_VECTOR_PAINT_LINE_CAP_ROUND); -// ea_vector_paint_set_line_join(paint, EA_VECTOR_PAINT_LINE_JOIN_ROUND); -// ea_vector_paint_set_line_width(paint, 3.0); -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, 1.0f); + vg = evas_object_vg_add(evas_object_evas_get(canvas)); + evas_object_show(vg); -// this->canvas = ea_vector_canvas_create(canvas); + root = evas_object_vg_root_node_get(vg); + shape = evas_vg_shape_add(root); + evas_vg_node_color_set(shape, 80, 80, 80, 80); - DrawDummyFrame(); -}; + elm_object_part_content_set(layout, "EFFECT_BG", vg); + evas_vg_shape_stroke_cap_set(shape, EFL_GFX_CAP_BUTT); + evas_vg_shape_stroke_join_set(shape, EFL_GFX_JOIN_MITER); + evas_vg_shape_stroke_width_set(shape, 3.0); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, 255); + + DrawDummyFrame(); +}; /** * Destructor @@ -96,32 +109,32 @@ MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& */ MicEffector::~MicEffector() { - if(timer) - { - ecore_timer_del(timer); - timer = NULL; - } - -// ea_vector_path_destroy(path); -// ea_vector_paint_destroy(paint); -// ea_vector_canvas_destroy(canvas); + if (timer) { + ecore_timer_del(timer); + timer = NULL; + } + if (vg) + evas_object_del(vg); + + if (root) + evas_object_del(root); + + if (shape) + evas_object_del(shape); } - - /** * Draw empty frame to remove or initiate screen * */ void MicEffector::DrawDummyFrame() { -// ea_vector_path_reset(path); -// ea_vector_path_move_to(path, 0, 0); -// ea_vector_path_line_to(path, 0, 0); -// ea_vector_canvas_draw(canvas, path, paint); -} - + evas_vg_shape_reset(shape); + evas_vg_shape_append_move_to(shape, 0, 0); + evas_vg_shape_append_line_to(shape, 0, 0); + evas_object_show(vg); +} /** * Draw Que animation @@ -134,83 +147,80 @@ void MicEffector::DrawDummyFrame() */ void MicEffector::DrawQue(int idx, bool is_start) { -// float margin = spectrum_posx; -// float posx = 0.0; - - double speed = cubic_easy_out(idx + 1.0, 0.0, 23.0, 23); + float margin = spectrum_posx; + float posx = 0.0; - unsigned int start = start_stop_anim_count - (int) speed; - unsigned int end = start_stop_anim_count + (int) speed; + double speed = cubic_easy_out(idx + 1.0, 0.0, 23.0, 23); -// double opacity; + unsigned int start = start_stop_anim_count - (int) speed; + unsigned int end = start_stop_anim_count + (int) speed; - if (is_start) { -// opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); - } else { -// opacity = cubic_easy_out(idx, 0, 1.0, 26.0); - } + double opacity = 0.0;; -// ea_vector_path_reset(path); + if (is_start) { + opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); + } else { + opacity = cubic_easy_out(idx, 0, 1.0, 26.0); + } - for(unsigned int i = start; i < end; i++) - { -// posx = margin + (i * 5); + evas_vg_shape_reset(shape); -// ea_vector_path_move_to(path, posx, 37.0f); -// ea_vector_path_line_to(path, posx, 38.0f); + for (unsigned int i = start; i < end; i++) + { + posx = margin + (i * 5); -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity); - } + evas_vg_shape_append_move_to(shape, posx, 37); + evas_vg_shape_append_line_to(shape, posx, 38); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); + } -// ea_vector_canvas_draw(canvas, path, paint); + evas_object_show(vg); } - - float MicEffector::GetAmplifyValue(unsigned int idx) { - float amplify = 0.0; + float amplify = 0.0; - int max[SAMPLE_COUNT] = { - /** - * dot "A" (9) - * - */ - 1, 1, 1, 1, + int max[SAMPLE_COUNT] = { + /** + * dot "A" (9) + * + */ + 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, - /** - * dot "B" (9) - * - */ - 10, 8, 2, 3, 10, 11, 6, 12, 4, + /** + * dot "B" (9) + * + */ + 10, 8, 2, 3, 10, 11, 6, 12, 4, - /** - * dot "C" (15) - * - */ - 3, 5, 9, 12, 11, 8, 14, 15, 13, 11, 12, 6, 8, 3, 2, + /** + * dot "C" (15) + * + */ + 3, 5, 9, 12, 11, 8, 14, 15, 13, 11, 12, 6, 8, 3, 2, - /** - * reverse dot "B" (9) - * - */ - 4, 12, 6, 11, 10, 3, 2, 8, 10, + /** + * reverse dot "B" (9) + * + */ + 4, 12, 6, 11, 10, 3, 2, 8, 10, - /** - * dot "A" (9) - * - */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, + /** + * dot "A" (9) + * + */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1 - }; + 1, 1, 1, 1 + }; - amplify = (float) max[idx] / 10.0f * 1.9f; + amplify = (float) max[idx] / 10.0f * 1.9f; - return amplify; + return amplify; } /** @@ -222,84 +232,77 @@ float MicEffector::GetAmplifyValue(unsigned int idx) */ void MicEffector::DrawWave(unsigned int idx, int amount, int prev_amount, double opacity, bool is_lastcmd) { -// float ratio = GetAmplifyValue(idx); + float ratio = GetAmplifyValue(idx); -// float am = ((float) amount) * ratio; -// float pam = ((float) prev_amount) * ratio; -// float cnt = (float) drawcount; + float am = ((float) amount) * ratio; + float pam = ((float) prev_amount) * ratio; + float cnt = (float) drawcount; - float posx = spectrum_posx; + float posx = spectrum_posx; -// float height = pam > am? -// pam - cubic_easy_in_out(cnt + 1.0, am, pam, 7): -// cubic_easy_in_out(cnt + 1.0, pam, am, 7); + float height = pam > am? + pam - cubic_easy_in_out(cnt + 1.0, am, pam, 7): + cubic_easy_in_out(cnt + 1.0, pam, am, 7); - posx += idx * 5; + posx += idx * 8; -// ea_vector_path_move_to(path, posx, (37.0f - (height / 2.0))); -// ea_vector_path_line_to(path, posx, (38.0f + (height / 2.0))); - - if (is_lastcmd) { -// ea_vector_paint_set_color(paint, 0.1451f, 0.204f, 0.255f, opacity);//RGB = 37:52:65 - } else { -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity);//RGB: 255 255 255 - } + evas_vg_shape_append_move_to(shape, posx, (37.0f - (height / 2.0))); + evas_vg_shape_append_line_to(shape, posx, (38.0f + (height / 2.0))); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); } - - /** * Effect Start * */ void MicEffector::Start() { - if(timer) { - ecore_timer_del(timer); - timer = NULL; - } - - drawcount = 0; - - prev.clear(); - current.clear(); - - for(size_t i = 0; i < spectrum_count; i++) - { - prev.push_back(0); - current.push_back(0); - } - - Listening(); - - /** - * Que animation - * - */ - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - effector->DrawQue(effector->drawcount); - - if(effector->drawcount < (int) start_stop_anim_count) { - effector->drawcount += 2; - return ECORE_CALLBACK_RENEW; - } else { - for(unsigned int i = 0; i < spectrum_count; i++) - effector->DrawWave(i, 0, 0); - -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); - - effector->drawcount = 0; - effector->timer = NULL; - effector->VolumeCheck(); - effector->Effect(); - return ECORE_CALLBACK_CANCEL; - } - }, - this); + if (timer) { + ecore_timer_del(timer); + timer = NULL; + } + + drawcount = 0; + + prev.clear(); + current.clear(); + + for (size_t i = 0; i < spectrum_count; i++) + { + prev.push_back(0); + current.push_back(0); + } + + Listening(); + + /** + * Que animation + * + */ + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + effector->DrawQue(effector->drawcount); + + if (effector->drawcount < (int) start_stop_anim_count) { + effector->drawcount += 2; + return ECORE_CALLBACK_RENEW; + } else { + for (unsigned int i = 0; i < spectrum_count; i++) + effector->DrawWave(i, 0, 0); + + evas_object_show(effector->vg); + + effector->drawcount = 0; + effector->timer = NULL; + effector->VolumeCheck(true); + effector->Effect(); + return ECORE_CALLBACK_CANCEL; + } + }, + this); } /** @@ -308,90 +311,83 @@ void MicEffector::Start() */ void MicEffector::Effect(bool fake) { - /** - * Volume effect animation - * - */ - if ( timer ) { - ecore_timer_del(timer); - timer = NULL; - } - - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - bool is_empty_prev = effector->prev.empty(); - - -// ea_vector_path_reset(effector->path); - - for(unsigned int i = 0; i < effector->current.size(); i++) - { - if (is_empty_prev) - effector->DrawWave(i, effector->current.at(i), 0); - else - effector->DrawWave(i, effector->current.at(i), effector->prev.at(i)); - } -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); - - if (effector->drawcount < 7) { - effector->drawcount++; - } else { - effector->drawcount = 0; - effector->VolumeCheck(effector->fake); - } - - return ECORE_CALLBACK_RENEW; - }, this); + /** + * Volume effect animation + * + */ + if ( timer ) { + ecore_timer_del(timer); + timer = NULL; + } + + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + bool is_empty_prev = effector->prev.empty(); + + evas_vg_shape_reset(effector->shape); + + for (unsigned int i = 0; i < effector->current.size(); i++) + { + if (is_empty_prev) { + effector->DrawWave(i, effector->current.at(i), 0); + } else { + effector->DrawWave(i, effector->current.at(i), effector->prev.at(i)); + } + } + evas_object_show(effector->vg); + + if (effector->drawcount < 7) { + effector->drawcount++; + effector->VolumeCheck(true); + } else { + effector->drawcount = 0; + effector->VolumeCheck(true); + } + + return ECORE_CALLBACK_RENEW; + }, this); } - - /** * Stop volume animation effect * */ void MicEffector::Stop(bool forced) { - if(timer) - { - ecore_timer_del(timer); - timer = NULL; - } - - if(!started) - { - Idle(); - return; - } - - forcestop = forced; - - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - effector->DrawQue(start_stop_anim_count - effector->drawcount, false); - - if(effector->drawcount < (int) start_stop_anim_count) { - effector->drawcount += 2; - return ECORE_CALLBACK_RENEW; - } else { - if(!effector->forcestop) { - effector->Processing(); - } else { - effector->Idle(); - } - - effector->forcestop = false; - effector->drawcount = 0; - effector->timer = NULL; - return ECORE_CALLBACK_CANCEL; - } - }, this); + if (timer) + { + ecore_timer_del(timer); + timer = NULL; + } + + if (!started) + { + Idle(); + return; + } + + forcestop = forced; + + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + effector->DrawQue(start_stop_anim_count - effector->drawcount, false); + + if (effector->drawcount < (int) start_stop_anim_count) { + effector->drawcount += 2; + return ECORE_CALLBACK_RENEW; + } else { + effector->forcestop = false; + effector->drawcount = 0; + effector->timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + }, this); } /** @@ -400,80 +396,73 @@ void MicEffector::Stop(bool forced) */ void MicEffector::VolumeCheck(bool fake) { - std::vector volumes; + std::vector volumes; - this->fake = fake; + this->fake = fake; - if(!fake) { - volumes = ieffect.GetVolume(); - } else { - for(unsigned int i = 0; i < spectrum_count; i++) { - unsigned int seed = time(NULL); - volumes.push_back(rand_r(&seed) % 2); - } - } + if (!fake) { + volumes = ieffect.GetVolume(); + } else { + for (unsigned int i = 0; i < spectrum_count; i++) { + unsigned int seed = time(NULL); + volumes.push_back(rand_r(&seed) % 6); + } + } - prev.clear(); - prev.assign(current.begin(), current.end()); + prev.clear(); + prev.assign(current.begin(), current.end()); - current.clear(); - current.assign(volumes.begin(), volumes.end()); + current.clear(); + current.assign(volumes.begin(), volumes.end()); } - - /** * Signal. Listening effect * */ void MicEffector::Listening() { - started = true; + started = true; - elm_object_signal_emit(layout, "elm,state,eq,show", "eq"); - elm_object_signal_emit(layout, "elm,state,listening", "elm"); + elm_object_signal_emit(layout, "elm,state,listening", "elm"); + elm_object_signal_emit(layout, "elm,state,eq,show", "eq"); } - - /** * Signal. Processing effect * */ void MicEffector::Processing() { - started = false; + started = false; - elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); - elm_object_signal_emit(layout, "elm,state,processing", "elm"); + elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); + elm_object_signal_emit(layout, "elm,state,processing", "elm"); - ieffect.ProcessingAnimationStart(); + ieffect.ProcessingAnimationStart(); } - - /** * Signal. Idle effect * */ void MicEffector::Idle() { - const char *text; - const char *state; - double val; + const char *text; + const char *state; + double val; - started = false; + started = false; - elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); + elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); - text = elm_object_part_text_get(layout, "elm.text"); - state = edje_object_part_state_get(elm_layout_edje_get(layout), "guide_text_block", &val); + text = elm_object_part_text_get(layout, "elm.text"); + state = edje_object_part_state_get(elm_layout_edje_get(layout), "guide_text_block", &val); - if ((text && strlen(text) > 0) && (state && !strcmp(state, "bottom"))) - elm_object_signal_emit(layout, "elm,state,init_message", "elm"); - else - elm_object_signal_emit(layout, "elm,state,init", "elm"); + if ((text && strlen(text) > 0) && (state && !strcmp(state, "bottom"))) + elm_object_signal_emit(layout, "elm,state,init_message", "elm"); + else + elm_object_signal_emit(layout, "elm,state,init", "elm"); - ieffect.ProcessingAnimationStop(); + ieffect.ProcessingAnimationStop(); } - diff --git a/src/WInputSttMicEffect.cpp b/src/WInputSttMicEffect.cpp old mode 100755 new mode 100644 index 5454f27..b999be7 --- a/src/WInputSttMicEffect.cpp +++ b/src/WInputSttMicEffect.cpp @@ -17,14 +17,17 @@ #include #include #include - +#include #include #include "WInputSttMicEffect.h" +#include +#undef LOG_TAG +#define LOG_TAG "INPUT_DELEGATOR" namespace { template -static unsigned long long SumSquare(unsigned long long const& a, T const& b) { - return a + b*b; +static float SumSquare(float const& a, T const& b) { + return a + b*b; } const double MAX_AMPLITUDE_MEAN_16 = 23170.115738161934; @@ -38,118 +41,113 @@ using namespace is::ui; WInputSttMicEffect::WInputSttMicEffect() - : square_sum(0) - , count(5) - , handle(NULL) - , processing_effect_timer(NULL) - , progressbar(NULL) { + : square_sum(0) + , count(5) + , handle(NULL) + , processing_effect_timer(NULL) + , progressbar(NULL) { } WInputSttMicEffect::~WInputSttMicEffect() { - ProcessingAnimationStop(); + ProcessingAnimationStop(); } std::vector WInputSttMicEffect::GetVolume() { - std::vector result; - - short pcm[512] = {0}; - int size = 0; - int ret = 0; - -// ret = stt_get_spectrum(handle, (void *) pcm, &size); - count = 5; - - if (STT_ERROR_NONE != ret) { - PRINTFUNC(DLOG_ERROR, "stt_audio_snapshot invalid (%d)", ret); - } else { - unsigned int level = 0; - unsigned int step = (unsigned int) (size/2/sample_count); - - for (unsigned int k = 0; k < sample_count; k++ ){ - square_sum = std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare); - level = ConvertLevel(); - result.push_back(level); - } - } - return result; + std::vector result; + + float pcm[512] = {0}; + int size = 50; + int ret = 0; + + ret = stt_get_recording_volume(handle, pcm); + count = 5; + + if (STT_ERROR_NONE != ret) { + } else { + unsigned int level = 0; + unsigned int step = (unsigned int) (size/2/sample_count); + + for (unsigned int k = 0; k < sample_count; k++ ){ + square_sum = (unsigned long long)std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare); + level = ConvertLevel(); + result.push_back(level); + } + } + return result; } float WInputSttMicEffect::GetDecibel() const { - float rms = std::sqrt(square_sum/count); - return 20.0*log10(rms); + float rms = std::sqrt(square_sum/count); + return 20.0*log10(rms); } int WInputSttMicEffect::ConvertLevel() { - float db = GetDecibel(); - - if ( db <= 30.0 ){ - return 0; - } else if ( db <= 33.3 ){ - return 1; - } else if ( db <= 36.6 ){ - return 2; - } else if ( db <= 40 ){ - return 3; - } else if ( db <= 43.3 ){ - return 4; - } else if ( db <= 46.6 ){ - return 5; - } else if ( db <= 50 ){ - return 6; - } else if ( db <= 53.3 ){ - return 7; - } else if ( db <= 56.6 ){ - return 8; - } else if ( db <= 60 ){ - return 9; - } else { - return 10; - } + float db = GetDecibel(); + + if ( db <= 30.0 ){ + return 0; + } else if ( db <= 33.3 ){ + return 1; + } else if ( db <= 36.6 ){ + return 2; + } else if ( db <= 40 ){ + return 3; + } else if ( db <= 43.3 ){ + return 4; + } else if ( db <= 46.6 ){ + return 5; + } else if ( db <= 50 ){ + return 6; + } else if ( db <= 53.3 ){ + return 7; + } else if ( db <= 56.6 ){ + return 8; + } else if ( db <= 60 ){ + return 9; + } else { + return 10; + } } void WInputSttMicEffect::ProcessingAnimationStart() { - elm_progressbar_pulse(progressbar, EINA_TRUE); + elm_progressbar_pulse(progressbar, EINA_TRUE); - processing_effect_timer = ecore_timer_add(0.1, - [](void *data)->Eina_Bool - { - if(!data) return ECORE_CALLBACK_CANCEL; + processing_effect_timer = ecore_timer_add(0.1, + [](void *data)->Eina_Bool + { + if (!data) return ECORE_CALLBACK_CANCEL; /* - WInputSttMicEffect *effect = (WInputSttMicEffect *) data; - Evas_Object *progressbar = effect->progressbar; + WInputSttMicEffect *effect = (WInputSttMicEffect *) data; + Evas_Object *progressbar = effect->progressbar; - double progress = eext_circle_value_get(progressbar); + double progress = eext_circle_value_get(progressbar); - if (progress < 100) - progress += 5.0; - else - progress = 0.0; + if (progress < 100) + progress += 5.0; + else + progress = 0.0; - eext_circle_value_set(progressbar, progress); + eext_circle_value_set(progressbar, progress); */ - return ECORE_CALLBACK_RENEW; - }, this); + return ECORE_CALLBACK_RENEW; + }, this); } void WInputSttMicEffect::ProcessingAnimationStop() { - if(processing_effect_timer) - { - ecore_timer_del(processing_effect_timer); - processing_effect_timer = NULL; - } - elm_progressbar_pulse(progressbar, EINA_FALSE); + if (processing_effect_timer) + { + ecore_timer_del(processing_effect_timer); + processing_effect_timer = NULL; + } + elm_progressbar_pulse(progressbar, EINA_FALSE); } - - void WInputSttMicEffect::SetSttHandle(stt_h handle) { - this->handle = handle; + this->handle = handle; } - - void WInputSttMicEffect::SetProgressBar(Evas_Object *progress) { - this->progressbar = progress; + this->progressbar = progress; } diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index c135e4c..56514f7 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -64,7 +64,7 @@ static Elm_Genlist_Item_Class itc_title; static Elm_Genlist_Item_Class itc_1text; static Elm_Genlist_Item_Class itc_2text; - +static Eina_Bool change_guide_text(void *data); static void set_guide_text(VoiceData *vd, const char* text, bool translatable = false); const char *supported_language[] = { @@ -313,7 +313,6 @@ static Eina_Bool _update_textblock_timer_cb(void *data) if(voicedata->state == STT_STATE_VAL_LISTENING){ if(voicedata->guide_text_timer != NULL){ - PRINTFUNC(DLOG_DEBUG, "Skip hide_guide_text"); ecore_timer_del(voicedata->guide_text_timer); voicedata->guide_text_timer = NULL; } @@ -393,21 +392,48 @@ static Eina_Bool _recognition_failure_cb(void *data) void start_by_press(VoiceData *voicedata) { - PRINTFUNC(DLOG_DEBUG, ""); - + LOGD("start_by_press "); edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); - - return; } static void on_mic_button_press_cb(void *data, Evas_Object *obj, void *event_info) { - PRINTFUNC(NO_PRINT, ""); - + LOGD("on_mic_button_press_cb"); VoiceData *voicedata = (VoiceData *)data; - edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + if (!voicedata) return; - return; + 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->refresh_timer) { + ecore_timer_del(voicedata->refresh_timer); + voicedata->refresh_timer = NULL; + } + } else { + if (NULL != voicedata->guide_text_timer) { + ecore_timer_del(voicedata->guide_text_timer); + voicedata->guide_text_timer = NULL; + } + edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + } } @@ -525,32 +551,33 @@ static Eina_Bool _idler_cb(void *data) if(true == _app_stt_initialize(voicedata)) { - PRINTFUNC(NO_PRINT, "_app_stt_initialize None Error"); + LOGD("_app_stt_initialize None Error"); voicedata->voicefw_state = 1; voicedata->state = STT_STATE_VAL_INIT; } else { voicedata->voicefw_state = 0; - PRINTFUNC(DLOG_ERROR, "Initialization Fail!
Check STT-daemon is running"); + LOGD("Initialization Fail!
Check STT-daemon is running"); } Evas_Object *canvas = elm_object_part_content_get(voicedata->layout_main, "EFFECT_BG"); - is::ui::WInputSttMicEffect *ieffect = new is::ui::WInputSttMicEffect(); - ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + if (ieffect) + ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); is::ui::MicEffector *effector = new is::ui::MicEffector(canvas, voicedata->layout_main, *ieffect); voicedata->ieffect = ieffect; voicedata->effector = effector; - ieffect->SetProgressBar(voicedata->progressbar); - ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + if (ieffect) { + ieffect->SetProgressBar(voicedata->progressbar); + ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + } voicedata->mo->Update(); elm_access_highlight_set(voicedata->mic_button); - return ECORE_CALLBACK_CANCEL; } @@ -606,23 +633,21 @@ void powerLock(void *data, bool enable) } } +static Eina_Bool change_guide_text(void *data){ + VoiceData *voicedata = (VoiceData *) data; + if (!voicedata) return ECORE_CALLBACK_CANCEL; -static Eina_Bool hide_guide_text(void *data){ - if(data) { - VoiceData *voicedata = (VoiceData *) data; - - voicedata->guide_text_timer = NULL; - + stt_state_e state = voicedata->sttmanager->GetCurrent(); + if (state == STT_STATE_RECORDING || state == STT_STATE_PROCESSING) + elm_object_domain_translatable_part_text_set(voicedata->layout_main, "elm.text", PACKAGE, SK_TAP_TO_PAUSE); - PRINTFUNC(DLOG_ERROR, ""); - elm_object_part_text_set(voicedata->layout_main, "elm.text", ""); - } return ECORE_CALLBACK_CANCEL; } + static void set_guide_text(VoiceData *vd, const char* text, bool translatable) { - //elm_object_signal_emit(vd->layout_main, "idle,state,text,visible", "elm"); + elm_object_signal_emit(vd->layout_main, "idle,state,guide_text,bottom", "elm"); if(translatable) elm_object_domain_translatable_part_text_set(vd->layout_main, "elm.text", PACKAGE, text); @@ -631,7 +656,7 @@ static void set_guide_text(VoiceData *vd, const char* text, bool translatable) if(!strcmp(text, SK_SPEAK_NOW)){ if(vd->guide_text_timer == NULL) - vd->guide_text_timer = ecore_timer_add(2.0, hide_guide_text, vd); + vd->guide_text_timer = ecore_timer_add(2.0, change_guide_text, vd); } } @@ -642,22 +667,6 @@ static void set_guide_text(VoiceData *vd, const char* text, bool translatable) */ void set_animation_state(VoiceData *voicedata) { - PRINTFUNC(DLOG_DEBUG, ""); - - PRINTFUNC(DLOG_ERROR, "voicedata->state == %s", - voicedata->state == STT_STATE_VAL_INIT ? - "STT_STATE_VAL_INIT" : - voicedata->state == STT_STATE_VAL_LISTENING ? - "STT_STATE_VAL_LISTENING" : - voicedata->state == STT_STATE_VAL_PREPARE_LISTENING ? - "STT_STATE_VAL_PREPARE_LISTENING" : - voicedata->state == STT_STATE_VAL_PROCESSING ? - "STT_STATE_VAL_PROCESSING" : - voicedata->state == STT_STATE_VAL_PREPARE_PROCESSING ? - "STT_STATE_VAL_PREPARE_PROCESSING" : - voicedata->state == STT_STATE_VAL_TERMINATING ? - "STT_STATE_VAL_TERMINATING" : "STT_STATE_VAL_NOT_RECOGNISED"); - if (voicedata->state == STT_STATE_VAL_INIT) { #if 0 if (voicedata->sttmanager->GetCurrent() == STT_STATE_READY) { @@ -673,9 +682,8 @@ void set_animation_state(VoiceData *voicedata) if(voicedata->effector) voicedata->effector->Stop(true); - set_guide_text(voicedata, ""); + set_guide_text(voicedata, "Tap mic to speak"); - PRINTFUNC(DLOG_DEBUG, "%d", voicedata->stt_results.size()); powerLock((void*)voicedata, false); } else if (voicedata->state == STT_STATE_VAL_LISTENING) { set_guide_text(voicedata, SK_SPEAK_NOW, true); @@ -691,7 +699,6 @@ void set_animation_state(VoiceData *voicedata) stt_feedback(VIBRATION_STOP); } else { - PRINTFUNC(DLOG_DEBUG, "SK_NETWORK_ERROR"); set_guide_text(voicedata, _(SK_RECOGNITION_FAILED)); //_elm_access_say(voicedata->layout_main, _(SK_RECOGNITION_FAILED)); @@ -705,8 +712,6 @@ void set_animation_state(VoiceData *voicedata) voicedata->effector->Stop(true); voicedata->refresh_timer = ecore_timer_add(2.0, _recognition_failure_cb, voicedata); - - //powerLock((void*)voicedata, false); } } @@ -759,20 +764,15 @@ static Eina_Bool _start_timer_cb(void* data) voicedata->sttmanager->Start(); } catch (is::stt::SttException &e) { - PRINTFUNC(DLOG_ERROR, "%s", e.what()); - if (e.GetEcode() == STT_ERROR_OUT_OF_NETWORK) { - PRINTFUNC(DLOG_DEBUG, "SK_NETWORK_ERROR"); set_guide_text(voicedata, _(SK_NETWORK_ERROR)); voicedata->state = STT_STATE_VAL_INIT; } else if (e.GetEcode() == STT_ERROR_RECORDER_BUSY) { - PRINTFUNC(DLOG_WARN, "STT is used by another application"); - show_popup_toast(_(SK_STT_BUSY), false); + set_guide_text(voicedata, _(SK_STT_BUSY)); voicedata->state = STT_STATE_VAL_INIT; } else { - PRINTFUNC(DLOG_WARN, "Check error code"); - show_popup_toast(_(SK_STT_BUSY), false); + set_guide_text(voicedata, _(SK_STT_BUSY)); voicedata->state = STT_STATE_VAL_INIT; } } @@ -791,6 +791,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission PRINTFUNC(NO_PRINT, ""); VoiceData *vd = (VoiceData *)data; + if (vd == NULL) + return; int tempVal = vd->sttmanager->GetCurrent(); if(tempVal == STT_STATE_CREATED) { @@ -856,6 +858,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission catch (is::stt::SttException &e) { PRINTFUNC(DLOG_ERROR, "%s", e.what()); } + if (vd->effector) + vd->effector->Stop(true); break; -- 2.7.4 From 7433778450b55f0cb3a6d76dc49702bdcac351d1 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 8 Dec 2016 16:51:31 +0900 Subject: [PATCH 12/16] Update package version to 0.1.161208 Change-Id: I1a56f39d5bed3ee99b34bec962d3db224580d213 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index a00448c..aee90a5 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 841f06a..2447c13 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.161202 +Version: 0.1.161208 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 542aa89e2e5b0702e0c8853c757291b8811ade70 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 8 Dec 2016 13:50:30 +0900 Subject: [PATCH 13/16] Adopt wave VI for voice mode Change-Id: I944da15dc5ce5a28308a6575dde14e2a33100b63 Signed-off-by: sungwook79.park --- inc/MicEffector.h | 14 +- res/edje/w-input-stt.edc | 31 ++- src/MicEffector.cpp | 553 ++++++++++++++++++++++----------------------- src/WInputSttMicEffect.cpp | 168 +++++++------- src/w-input-stt-voice.cpp | 116 +++++----- 5 files changed, 446 insertions(+), 436 deletions(-) mode change 100755 => 100644 src/MicEffector.cpp mode change 100755 => 100644 src/WInputSttMicEffect.cpp diff --git a/inc/MicEffector.h b/inc/MicEffector.h index 8284f1c..aa3b821 100755 --- a/inc/MicEffector.h +++ b/inc/MicEffector.h @@ -18,7 +18,7 @@ #include #include -#include "Debug.h" + #define SAMPLE_COUNT 59 @@ -140,14 +140,6 @@ class MicEffector void DrawDummyFrame(); /** - * Efl vector canvas handle - * - */ -// ea_vector_canvas_h *canvas; -// ea_vector_path_h *path; -// ea_vector_paint_h *paint; - - /** * Volume values. * */ @@ -161,6 +153,10 @@ class MicEffector bool started; bool fake; + Evas_Object *vg; + Efl_VG *root; + Efl_VG *shape; + /** * timer handle * diff --git a/res/edje/w-input-stt.edc b/res/edje/w-input-stt.edc index b123590..62d648d 100755 --- a/res/edje/w-input-stt.edc +++ b/res/edje/w-input-stt.edc @@ -603,23 +603,46 @@ collections description { state, "default" 0.0; - min, 0 74; - max, 9999 74; + min, 0 64; + max, 360 64; align, 0.5 1; rel1 { relative, 0 1; to, "bg"; - offset, 0 -14; + offset, 0 -1; } rel2 { relative, 1 1; to, "bg"; - offset, 0 -14; + offset, 0 -1; + } + } + + description + { + state, "hide" 0.0; + min, 0 64; + max, 360 64; + align, 0.5 1; + rel1 + { + relative, 0 (360+64)/360; + to, "bg"; + offset, 0 +13; } + rel2 + { + relative, 1 (360+64)/360; + to, "bg"; + offset, 0 +13; + } + } + } + part { name, "EFFECT_BG"; diff --git a/src/MicEffector.cpp b/src/MicEffector.cpp old mode 100755 new mode 100644 index 9010026..b318e57 --- a/src/MicEffector.cpp +++ b/src/MicEffector.cpp @@ -14,9 +14,21 @@ * limitations under the License. */ +#define EFL_BETA_API_SUPPORT 1 +#define EFL_EO_API_SUPPORT 1 + +#include + #include #include "MicEffector.h" +#include +#include +#include +#undef LOG_TAG +#define LOG_TAG "INPUT_DELEGATOR" + + using namespace is::ui; /** @@ -33,28 +45,27 @@ static float timeout_s = 1.0f / 60.0f; double cubic_easy_in_out(double index, double start, double end, double duration) { - index /= duration/2; - if (index < 1) - return end/2*index*index*index + start; + index /= duration/2; + if (index < 1) + return end/2*index*index*index + start; - index -= 2; - return end/2*(index*index*index + 2) + start; + index -= 2; + return end/2*(index*index*index + 2) + start; } double cubic_easy_in(double index, double start, double end, double duration) { - index /= duration; - return end*index*index*index*index*index + start; + index /= duration; + return end*index*index*index*index*index + start; } double cubic_easy_out(double index, double start, double end, double duration) { - index /= duration; - index--; - return end*(index*index*index + 1) + start; + index /= duration; + index--; + return end*(index*index*index + 1) + start; } - /** * Constructor * @@ -63,30 +74,32 @@ double cubic_easy_out(double index, double start, double end, double duration) * #2. Drawing empty frame to avoid broken screen. * */ - MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& effect) - : drawcount(0) - , forcestop(false) - , started(false) - , fake(false) - , timer(NULL) - , layout(layout) - , ieffect(effect) + : drawcount(0) + , forcestop(false) + , started(false) + , fake(false) + , timer(NULL) + , layout(layout) + , ieffect(effect) { -// path = ea_vector_path_create(); -// paint = ea_vector_paint_create(); -// ea_vector_paint_set_style(paint, EA_VECTOR_PAINT_STYLE_STROKE); -// ea_vector_paint_set_line_cap(paint, EA_VECTOR_PAINT_LINE_CAP_ROUND); -// ea_vector_paint_set_line_join(paint, EA_VECTOR_PAINT_LINE_JOIN_ROUND); -// ea_vector_paint_set_line_width(paint, 3.0); -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, 1.0f); + vg = evas_object_vg_add(evas_object_evas_get(canvas)); + evas_object_show(vg); -// this->canvas = ea_vector_canvas_create(canvas); + root = evas_object_vg_root_node_get(vg); + shape = evas_vg_shape_add(root); + evas_vg_node_color_set(shape, 80, 80, 80, 80); - DrawDummyFrame(); -}; + elm_object_part_content_set(layout, "EFFECT_BG", vg); + evas_vg_shape_stroke_cap_set(shape, EFL_GFX_CAP_BUTT); + evas_vg_shape_stroke_join_set(shape, EFL_GFX_JOIN_MITER); + evas_vg_shape_stroke_width_set(shape, 3.0); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, 255); + + DrawDummyFrame(); +}; /** * Destructor @@ -96,32 +109,32 @@ MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& */ MicEffector::~MicEffector() { - if(timer) - { - ecore_timer_del(timer); - timer = NULL; - } - -// ea_vector_path_destroy(path); -// ea_vector_paint_destroy(paint); -// ea_vector_canvas_destroy(canvas); + if (timer) { + ecore_timer_del(timer); + timer = NULL; + } + if (vg) + evas_object_del(vg); + + if (root) + evas_object_del(root); + + if (shape) + evas_object_del(shape); } - - /** * Draw empty frame to remove or initiate screen * */ void MicEffector::DrawDummyFrame() { -// ea_vector_path_reset(path); -// ea_vector_path_move_to(path, 0, 0); -// ea_vector_path_line_to(path, 0, 0); -// ea_vector_canvas_draw(canvas, path, paint); -} - + evas_vg_shape_reset(shape); + evas_vg_shape_append_move_to(shape, 0, 0); + evas_vg_shape_append_line_to(shape, 0, 0); + evas_object_show(vg); +} /** * Draw Que animation @@ -134,83 +147,80 @@ void MicEffector::DrawDummyFrame() */ void MicEffector::DrawQue(int idx, bool is_start) { -// float margin = spectrum_posx; -// float posx = 0.0; - - double speed = cubic_easy_out(idx + 1.0, 0.0, 23.0, 23); + float margin = spectrum_posx; + float posx = 0.0; - unsigned int start = start_stop_anim_count - (int) speed; - unsigned int end = start_stop_anim_count + (int) speed; + double speed = cubic_easy_out(idx + 1.0, 0.0, 23.0, 23); -// double opacity; + unsigned int start = start_stop_anim_count - (int) speed; + unsigned int end = start_stop_anim_count + (int) speed; - if (is_start) { -// opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); - } else { -// opacity = cubic_easy_out(idx, 0, 1.0, 26.0); - } + double opacity = 0.0;; -// ea_vector_path_reset(path); + if (is_start) { + opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); + } else { + opacity = cubic_easy_out(idx, 0, 1.0, 26.0); + } - for(unsigned int i = start; i < end; i++) - { -// posx = margin + (i * 5); + evas_vg_shape_reset(shape); -// ea_vector_path_move_to(path, posx, 37.0f); -// ea_vector_path_line_to(path, posx, 38.0f); + for (unsigned int i = start; i < end; i++) + { + posx = margin + (i * 5); -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity); - } + evas_vg_shape_append_move_to(shape, posx, 37); + evas_vg_shape_append_line_to(shape, posx, 38); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); + } -// ea_vector_canvas_draw(canvas, path, paint); + evas_object_show(vg); } - - float MicEffector::GetAmplifyValue(unsigned int idx) { - float amplify = 0.0; + float amplify = 0.0; - int max[SAMPLE_COUNT] = { - /** - * dot "A" (9) - * - */ - 1, 1, 1, 1, + int max[SAMPLE_COUNT] = { + /** + * dot "A" (9) + * + */ + 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, - /** - * dot "B" (9) - * - */ - 10, 8, 2, 3, 10, 11, 6, 12, 4, + /** + * dot "B" (9) + * + */ + 10, 8, 2, 3, 10, 11, 6, 12, 4, - /** - * dot "C" (15) - * - */ - 3, 5, 9, 12, 11, 8, 14, 15, 13, 11, 12, 6, 8, 3, 2, + /** + * dot "C" (15) + * + */ + 3, 5, 9, 12, 11, 8, 14, 15, 13, 11, 12, 6, 8, 3, 2, - /** - * reverse dot "B" (9) - * - */ - 4, 12, 6, 11, 10, 3, 2, 8, 10, + /** + * reverse dot "B" (9) + * + */ + 4, 12, 6, 11, 10, 3, 2, 8, 10, - /** - * dot "A" (9) - * - */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, + /** + * dot "A" (9) + * + */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1 - }; + 1, 1, 1, 1 + }; - amplify = (float) max[idx] / 10.0f * 1.9f; + amplify = (float) max[idx] / 10.0f * 1.9f; - return amplify; + return amplify; } /** @@ -222,84 +232,77 @@ float MicEffector::GetAmplifyValue(unsigned int idx) */ void MicEffector::DrawWave(unsigned int idx, int amount, int prev_amount, double opacity, bool is_lastcmd) { -// float ratio = GetAmplifyValue(idx); + float ratio = GetAmplifyValue(idx); -// float am = ((float) amount) * ratio; -// float pam = ((float) prev_amount) * ratio; -// float cnt = (float) drawcount; + float am = ((float) amount) * ratio; + float pam = ((float) prev_amount) * ratio; + float cnt = (float) drawcount; - float posx = spectrum_posx; + float posx = spectrum_posx; -// float height = pam > am? -// pam - cubic_easy_in_out(cnt + 1.0, am, pam, 7): -// cubic_easy_in_out(cnt + 1.0, pam, am, 7); + float height = pam > am? + pam - cubic_easy_in_out(cnt + 1.0, am, pam, 7): + cubic_easy_in_out(cnt + 1.0, pam, am, 7); - posx += idx * 5; + posx += idx * 8; -// ea_vector_path_move_to(path, posx, (37.0f - (height / 2.0))); -// ea_vector_path_line_to(path, posx, (38.0f + (height / 2.0))); - - if (is_lastcmd) { -// ea_vector_paint_set_color(paint, 0.1451f, 0.204f, 0.255f, opacity);//RGB = 37:52:65 - } else { -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity);//RGB: 255 255 255 - } + evas_vg_shape_append_move_to(shape, posx, (37.0f - (height / 2.0))); + evas_vg_shape_append_line_to(shape, posx, (38.0f + (height / 2.0))); + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); } - - /** * Effect Start * */ void MicEffector::Start() { - if(timer) { - ecore_timer_del(timer); - timer = NULL; - } - - drawcount = 0; - - prev.clear(); - current.clear(); - - for(size_t i = 0; i < spectrum_count; i++) - { - prev.push_back(0); - current.push_back(0); - } - - Listening(); - - /** - * Que animation - * - */ - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - effector->DrawQue(effector->drawcount); - - if(effector->drawcount < (int) start_stop_anim_count) { - effector->drawcount += 2; - return ECORE_CALLBACK_RENEW; - } else { - for(unsigned int i = 0; i < spectrum_count; i++) - effector->DrawWave(i, 0, 0); - -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); - - effector->drawcount = 0; - effector->timer = NULL; - effector->VolumeCheck(); - effector->Effect(); - return ECORE_CALLBACK_CANCEL; - } - }, - this); + if (timer) { + ecore_timer_del(timer); + timer = NULL; + } + + drawcount = 0; + + prev.clear(); + current.clear(); + + for (size_t i = 0; i < spectrum_count; i++) + { + prev.push_back(0); + current.push_back(0); + } + + Listening(); + + /** + * Que animation + * + */ + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + effector->DrawQue(effector->drawcount); + + if (effector->drawcount < (int) start_stop_anim_count) { + effector->drawcount += 2; + return ECORE_CALLBACK_RENEW; + } else { + for (unsigned int i = 0; i < spectrum_count; i++) + effector->DrawWave(i, 0, 0); + + evas_object_show(effector->vg); + + effector->drawcount = 0; + effector->timer = NULL; + effector->VolumeCheck(true); + effector->Effect(); + return ECORE_CALLBACK_CANCEL; + } + }, + this); } /** @@ -308,90 +311,83 @@ void MicEffector::Start() */ void MicEffector::Effect(bool fake) { - /** - * Volume effect animation - * - */ - if ( timer ) { - ecore_timer_del(timer); - timer = NULL; - } - - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - bool is_empty_prev = effector->prev.empty(); - - -// ea_vector_path_reset(effector->path); - - for(unsigned int i = 0; i < effector->current.size(); i++) - { - if (is_empty_prev) - effector->DrawWave(i, effector->current.at(i), 0); - else - effector->DrawWave(i, effector->current.at(i), effector->prev.at(i)); - } -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); - - if (effector->drawcount < 7) { - effector->drawcount++; - } else { - effector->drawcount = 0; - effector->VolumeCheck(effector->fake); - } - - return ECORE_CALLBACK_RENEW; - }, this); + /** + * Volume effect animation + * + */ + if ( timer ) { + ecore_timer_del(timer); + timer = NULL; + } + + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + bool is_empty_prev = effector->prev.empty(); + + evas_vg_shape_reset(effector->shape); + + for (unsigned int i = 0; i < effector->current.size(); i++) + { + if (is_empty_prev) { + effector->DrawWave(i, effector->current.at(i), 0); + } else { + effector->DrawWave(i, effector->current.at(i), effector->prev.at(i)); + } + } + evas_object_show(effector->vg); + + if (effector->drawcount < 7) { + effector->drawcount++; + effector->VolumeCheck(true); + } else { + effector->drawcount = 0; + effector->VolumeCheck(true); + } + + return ECORE_CALLBACK_RENEW; + }, this); } - - /** * Stop volume animation effect * */ void MicEffector::Stop(bool forced) { - if(timer) - { - ecore_timer_del(timer); - timer = NULL; - } - - if(!started) - { - Idle(); - return; - } - - forcestop = forced; - - timer = ecore_timer_add(timeout_s, - [](void *data)->Eina_Bool - { - MicEffector *effector = static_cast(data); - - effector->DrawQue(start_stop_anim_count - effector->drawcount, false); - - if(effector->drawcount < (int) start_stop_anim_count) { - effector->drawcount += 2; - return ECORE_CALLBACK_RENEW; - } else { - if(!effector->forcestop) { - effector->Processing(); - } else { - effector->Idle(); - } - - effector->forcestop = false; - effector->drawcount = 0; - effector->timer = NULL; - return ECORE_CALLBACK_CANCEL; - } - }, this); + if (timer) + { + ecore_timer_del(timer); + timer = NULL; + } + + if (!started) + { + Idle(); + return; + } + + forcestop = forced; + + timer = ecore_timer_add(timeout_s, + [](void *data)->Eina_Bool + { + MicEffector *effector = static_cast(data); + + effector->DrawQue(start_stop_anim_count - effector->drawcount, false); + + if (effector->drawcount < (int) start_stop_anim_count) { + effector->drawcount += 2; + return ECORE_CALLBACK_RENEW; + } else { + effector->forcestop = false; + effector->drawcount = 0; + effector->timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + }, this); } /** @@ -400,80 +396,73 @@ void MicEffector::Stop(bool forced) */ void MicEffector::VolumeCheck(bool fake) { - std::vector volumes; + std::vector volumes; - this->fake = fake; + this->fake = fake; - if(!fake) { - volumes = ieffect.GetVolume(); - } else { - for(unsigned int i = 0; i < spectrum_count; i++) { - unsigned int seed = time(NULL); - volumes.push_back(rand_r(&seed) % 2); - } - } + if (!fake) { + volumes = ieffect.GetVolume(); + } else { + for (unsigned int i = 0; i < spectrum_count; i++) { + unsigned int seed = time(NULL); + volumes.push_back(rand_r(&seed) % 6); + } + } - prev.clear(); - prev.assign(current.begin(), current.end()); + prev.clear(); + prev.assign(current.begin(), current.end()); - current.clear(); - current.assign(volumes.begin(), volumes.end()); + current.clear(); + current.assign(volumes.begin(), volumes.end()); } - - /** * Signal. Listening effect * */ void MicEffector::Listening() { - started = true; + started = true; - elm_object_signal_emit(layout, "elm,state,eq,show", "eq"); - elm_object_signal_emit(layout, "elm,state,listening", "elm"); + elm_object_signal_emit(layout, "elm,state,listening", "elm"); + elm_object_signal_emit(layout, "elm,state,eq,show", "eq"); } - - /** * Signal. Processing effect * */ void MicEffector::Processing() { - started = false; + started = false; - elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); - elm_object_signal_emit(layout, "elm,state,processing", "elm"); + elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); + elm_object_signal_emit(layout, "elm,state,processing", "elm"); - ieffect.ProcessingAnimationStart(); + ieffect.ProcessingAnimationStart(); } - - /** * Signal. Idle effect * */ void MicEffector::Idle() { - const char *text; - const char *state; - double val; + const char *text; + const char *state; + double val; - started = false; + started = false; - elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); + elm_object_signal_emit(layout, "elm,state,eq,hide", "eq"); - text = elm_object_part_text_get(layout, "elm.text"); - state = edje_object_part_state_get(elm_layout_edje_get(layout), "guide_text_block", &val); + text = elm_object_part_text_get(layout, "elm.text"); + state = edje_object_part_state_get(elm_layout_edje_get(layout), "guide_text_block", &val); - if ((text && strlen(text) > 0) && (state && !strcmp(state, "bottom"))) - elm_object_signal_emit(layout, "elm,state,init_message", "elm"); - else - elm_object_signal_emit(layout, "elm,state,init", "elm"); + if ((text && strlen(text) > 0) && (state && !strcmp(state, "bottom"))) + elm_object_signal_emit(layout, "elm,state,init_message", "elm"); + else + elm_object_signal_emit(layout, "elm,state,init", "elm"); - ieffect.ProcessingAnimationStop(); + ieffect.ProcessingAnimationStop(); } - diff --git a/src/WInputSttMicEffect.cpp b/src/WInputSttMicEffect.cpp old mode 100755 new mode 100644 index 5454f27..b999be7 --- a/src/WInputSttMicEffect.cpp +++ b/src/WInputSttMicEffect.cpp @@ -17,14 +17,17 @@ #include #include #include - +#include #include #include "WInputSttMicEffect.h" +#include +#undef LOG_TAG +#define LOG_TAG "INPUT_DELEGATOR" namespace { template -static unsigned long long SumSquare(unsigned long long const& a, T const& b) { - return a + b*b; +static float SumSquare(float const& a, T const& b) { + return a + b*b; } const double MAX_AMPLITUDE_MEAN_16 = 23170.115738161934; @@ -38,118 +41,113 @@ using namespace is::ui; WInputSttMicEffect::WInputSttMicEffect() - : square_sum(0) - , count(5) - , handle(NULL) - , processing_effect_timer(NULL) - , progressbar(NULL) { + : square_sum(0) + , count(5) + , handle(NULL) + , processing_effect_timer(NULL) + , progressbar(NULL) { } WInputSttMicEffect::~WInputSttMicEffect() { - ProcessingAnimationStop(); + ProcessingAnimationStop(); } std::vector WInputSttMicEffect::GetVolume() { - std::vector result; - - short pcm[512] = {0}; - int size = 0; - int ret = 0; - -// ret = stt_get_spectrum(handle, (void *) pcm, &size); - count = 5; - - if (STT_ERROR_NONE != ret) { - PRINTFUNC(DLOG_ERROR, "stt_audio_snapshot invalid (%d)", ret); - } else { - unsigned int level = 0; - unsigned int step = (unsigned int) (size/2/sample_count); - - for (unsigned int k = 0; k < sample_count; k++ ){ - square_sum = std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare); - level = ConvertLevel(); - result.push_back(level); - } - } - return result; + std::vector result; + + float pcm[512] = {0}; + int size = 50; + int ret = 0; + + ret = stt_get_recording_volume(handle, pcm); + count = 5; + + if (STT_ERROR_NONE != ret) { + } else { + unsigned int level = 0; + unsigned int step = (unsigned int) (size/2/sample_count); + + for (unsigned int k = 0; k < sample_count; k++ ){ + square_sum = (unsigned long long)std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare); + level = ConvertLevel(); + result.push_back(level); + } + } + return result; } float WInputSttMicEffect::GetDecibel() const { - float rms = std::sqrt(square_sum/count); - return 20.0*log10(rms); + float rms = std::sqrt(square_sum/count); + return 20.0*log10(rms); } int WInputSttMicEffect::ConvertLevel() { - float db = GetDecibel(); - - if ( db <= 30.0 ){ - return 0; - } else if ( db <= 33.3 ){ - return 1; - } else if ( db <= 36.6 ){ - return 2; - } else if ( db <= 40 ){ - return 3; - } else if ( db <= 43.3 ){ - return 4; - } else if ( db <= 46.6 ){ - return 5; - } else if ( db <= 50 ){ - return 6; - } else if ( db <= 53.3 ){ - return 7; - } else if ( db <= 56.6 ){ - return 8; - } else if ( db <= 60 ){ - return 9; - } else { - return 10; - } + float db = GetDecibel(); + + if ( db <= 30.0 ){ + return 0; + } else if ( db <= 33.3 ){ + return 1; + } else if ( db <= 36.6 ){ + return 2; + } else if ( db <= 40 ){ + return 3; + } else if ( db <= 43.3 ){ + return 4; + } else if ( db <= 46.6 ){ + return 5; + } else if ( db <= 50 ){ + return 6; + } else if ( db <= 53.3 ){ + return 7; + } else if ( db <= 56.6 ){ + return 8; + } else if ( db <= 60 ){ + return 9; + } else { + return 10; + } } void WInputSttMicEffect::ProcessingAnimationStart() { - elm_progressbar_pulse(progressbar, EINA_TRUE); + elm_progressbar_pulse(progressbar, EINA_TRUE); - processing_effect_timer = ecore_timer_add(0.1, - [](void *data)->Eina_Bool - { - if(!data) return ECORE_CALLBACK_CANCEL; + processing_effect_timer = ecore_timer_add(0.1, + [](void *data)->Eina_Bool + { + if (!data) return ECORE_CALLBACK_CANCEL; /* - WInputSttMicEffect *effect = (WInputSttMicEffect *) data; - Evas_Object *progressbar = effect->progressbar; + WInputSttMicEffect *effect = (WInputSttMicEffect *) data; + Evas_Object *progressbar = effect->progressbar; - double progress = eext_circle_value_get(progressbar); + double progress = eext_circle_value_get(progressbar); - if (progress < 100) - progress += 5.0; - else - progress = 0.0; + if (progress < 100) + progress += 5.0; + else + progress = 0.0; - eext_circle_value_set(progressbar, progress); + eext_circle_value_set(progressbar, progress); */ - return ECORE_CALLBACK_RENEW; - }, this); + return ECORE_CALLBACK_RENEW; + }, this); } void WInputSttMicEffect::ProcessingAnimationStop() { - if(processing_effect_timer) - { - ecore_timer_del(processing_effect_timer); - processing_effect_timer = NULL; - } - elm_progressbar_pulse(progressbar, EINA_FALSE); + if (processing_effect_timer) + { + ecore_timer_del(processing_effect_timer); + processing_effect_timer = NULL; + } + elm_progressbar_pulse(progressbar, EINA_FALSE); } - - void WInputSttMicEffect::SetSttHandle(stt_h handle) { - this->handle = handle; + this->handle = handle; } - - void WInputSttMicEffect::SetProgressBar(Evas_Object *progress) { - this->progressbar = progress; + this->progressbar = progress; } diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index c135e4c..56514f7 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -64,7 +64,7 @@ static Elm_Genlist_Item_Class itc_title; static Elm_Genlist_Item_Class itc_1text; static Elm_Genlist_Item_Class itc_2text; - +static Eina_Bool change_guide_text(void *data); static void set_guide_text(VoiceData *vd, const char* text, bool translatable = false); const char *supported_language[] = { @@ -313,7 +313,6 @@ static Eina_Bool _update_textblock_timer_cb(void *data) if(voicedata->state == STT_STATE_VAL_LISTENING){ if(voicedata->guide_text_timer != NULL){ - PRINTFUNC(DLOG_DEBUG, "Skip hide_guide_text"); ecore_timer_del(voicedata->guide_text_timer); voicedata->guide_text_timer = NULL; } @@ -393,21 +392,48 @@ static Eina_Bool _recognition_failure_cb(void *data) void start_by_press(VoiceData *voicedata) { - PRINTFUNC(DLOG_DEBUG, ""); - + LOGD("start_by_press "); edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); - - return; } static void on_mic_button_press_cb(void *data, Evas_Object *obj, void *event_info) { - PRINTFUNC(NO_PRINT, ""); - + LOGD("on_mic_button_press_cb"); VoiceData *voicedata = (VoiceData *)data; - edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + if (!voicedata) return; - return; + 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->refresh_timer) { + ecore_timer_del(voicedata->refresh_timer); + voicedata->refresh_timer = NULL; + } + } else { + if (NULL != voicedata->guide_text_timer) { + ecore_timer_del(voicedata->guide_text_timer); + voicedata->guide_text_timer = NULL; + } + edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background"); + } } @@ -525,32 +551,33 @@ static Eina_Bool _idler_cb(void *data) if(true == _app_stt_initialize(voicedata)) { - PRINTFUNC(NO_PRINT, "_app_stt_initialize None Error"); + LOGD("_app_stt_initialize None Error"); voicedata->voicefw_state = 1; voicedata->state = STT_STATE_VAL_INIT; } else { voicedata->voicefw_state = 0; - PRINTFUNC(DLOG_ERROR, "Initialization Fail!
Check STT-daemon is running"); + LOGD("Initialization Fail!
Check STT-daemon is running"); } Evas_Object *canvas = elm_object_part_content_get(voicedata->layout_main, "EFFECT_BG"); - is::ui::WInputSttMicEffect *ieffect = new is::ui::WInputSttMicEffect(); - ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + if (ieffect) + ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); is::ui::MicEffector *effector = new is::ui::MicEffector(canvas, voicedata->layout_main, *ieffect); voicedata->ieffect = ieffect; voicedata->effector = effector; - ieffect->SetProgressBar(voicedata->progressbar); - ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + if (ieffect) { + ieffect->SetProgressBar(voicedata->progressbar); + ieffect->SetSttHandle(voicedata->sttmanager->GetSttHandle()); + } voicedata->mo->Update(); elm_access_highlight_set(voicedata->mic_button); - return ECORE_CALLBACK_CANCEL; } @@ -606,23 +633,21 @@ void powerLock(void *data, bool enable) } } +static Eina_Bool change_guide_text(void *data){ + VoiceData *voicedata = (VoiceData *) data; + if (!voicedata) return ECORE_CALLBACK_CANCEL; -static Eina_Bool hide_guide_text(void *data){ - if(data) { - VoiceData *voicedata = (VoiceData *) data; - - voicedata->guide_text_timer = NULL; - + stt_state_e state = voicedata->sttmanager->GetCurrent(); + if (state == STT_STATE_RECORDING || state == STT_STATE_PROCESSING) + elm_object_domain_translatable_part_text_set(voicedata->layout_main, "elm.text", PACKAGE, SK_TAP_TO_PAUSE); - PRINTFUNC(DLOG_ERROR, ""); - elm_object_part_text_set(voicedata->layout_main, "elm.text", ""); - } return ECORE_CALLBACK_CANCEL; } + static void set_guide_text(VoiceData *vd, const char* text, bool translatable) { - //elm_object_signal_emit(vd->layout_main, "idle,state,text,visible", "elm"); + elm_object_signal_emit(vd->layout_main, "idle,state,guide_text,bottom", "elm"); if(translatable) elm_object_domain_translatable_part_text_set(vd->layout_main, "elm.text", PACKAGE, text); @@ -631,7 +656,7 @@ static void set_guide_text(VoiceData *vd, const char* text, bool translatable) if(!strcmp(text, SK_SPEAK_NOW)){ if(vd->guide_text_timer == NULL) - vd->guide_text_timer = ecore_timer_add(2.0, hide_guide_text, vd); + vd->guide_text_timer = ecore_timer_add(2.0, change_guide_text, vd); } } @@ -642,22 +667,6 @@ static void set_guide_text(VoiceData *vd, const char* text, bool translatable) */ void set_animation_state(VoiceData *voicedata) { - PRINTFUNC(DLOG_DEBUG, ""); - - PRINTFUNC(DLOG_ERROR, "voicedata->state == %s", - voicedata->state == STT_STATE_VAL_INIT ? - "STT_STATE_VAL_INIT" : - voicedata->state == STT_STATE_VAL_LISTENING ? - "STT_STATE_VAL_LISTENING" : - voicedata->state == STT_STATE_VAL_PREPARE_LISTENING ? - "STT_STATE_VAL_PREPARE_LISTENING" : - voicedata->state == STT_STATE_VAL_PROCESSING ? - "STT_STATE_VAL_PROCESSING" : - voicedata->state == STT_STATE_VAL_PREPARE_PROCESSING ? - "STT_STATE_VAL_PREPARE_PROCESSING" : - voicedata->state == STT_STATE_VAL_TERMINATING ? - "STT_STATE_VAL_TERMINATING" : "STT_STATE_VAL_NOT_RECOGNISED"); - if (voicedata->state == STT_STATE_VAL_INIT) { #if 0 if (voicedata->sttmanager->GetCurrent() == STT_STATE_READY) { @@ -673,9 +682,8 @@ void set_animation_state(VoiceData *voicedata) if(voicedata->effector) voicedata->effector->Stop(true); - set_guide_text(voicedata, ""); + set_guide_text(voicedata, "Tap mic to speak"); - PRINTFUNC(DLOG_DEBUG, "%d", voicedata->stt_results.size()); powerLock((void*)voicedata, false); } else if (voicedata->state == STT_STATE_VAL_LISTENING) { set_guide_text(voicedata, SK_SPEAK_NOW, true); @@ -691,7 +699,6 @@ void set_animation_state(VoiceData *voicedata) stt_feedback(VIBRATION_STOP); } else { - PRINTFUNC(DLOG_DEBUG, "SK_NETWORK_ERROR"); set_guide_text(voicedata, _(SK_RECOGNITION_FAILED)); //_elm_access_say(voicedata->layout_main, _(SK_RECOGNITION_FAILED)); @@ -705,8 +712,6 @@ void set_animation_state(VoiceData *voicedata) voicedata->effector->Stop(true); voicedata->refresh_timer = ecore_timer_add(2.0, _recognition_failure_cb, voicedata); - - //powerLock((void*)voicedata, false); } } @@ -759,20 +764,15 @@ static Eina_Bool _start_timer_cb(void* data) voicedata->sttmanager->Start(); } catch (is::stt::SttException &e) { - PRINTFUNC(DLOG_ERROR, "%s", e.what()); - if (e.GetEcode() == STT_ERROR_OUT_OF_NETWORK) { - PRINTFUNC(DLOG_DEBUG, "SK_NETWORK_ERROR"); set_guide_text(voicedata, _(SK_NETWORK_ERROR)); voicedata->state = STT_STATE_VAL_INIT; } else if (e.GetEcode() == STT_ERROR_RECORDER_BUSY) { - PRINTFUNC(DLOG_WARN, "STT is used by another application"); - show_popup_toast(_(SK_STT_BUSY), false); + set_guide_text(voicedata, _(SK_STT_BUSY)); voicedata->state = STT_STATE_VAL_INIT; } else { - PRINTFUNC(DLOG_WARN, "Check error code"); - show_popup_toast(_(SK_STT_BUSY), false); + set_guide_text(voicedata, _(SK_STT_BUSY)); voicedata->state = STT_STATE_VAL_INIT; } } @@ -791,6 +791,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission PRINTFUNC(NO_PRINT, ""); VoiceData *vd = (VoiceData *)data; + if (vd == NULL) + return; int tempVal = vd->sttmanager->GetCurrent(); if(tempVal == STT_STATE_CREATED) { @@ -856,6 +858,8 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission catch (is::stt::SttException &e) { PRINTFUNC(DLOG_ERROR, "%s", e.what()); } + if (vd->effector) + vd->effector->Stop(true); break; -- 2.7.4 From 66dfc2590e32b15fecf61da0ff58bb14b6ddad52 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 8 Dec 2016 16:59:43 +0900 Subject: [PATCH 14/16] Update package version to 0.1.161208 Change-Id: If8fdc8921360cffefabdeff2f7f54ddc21392479 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index a00448c..aee90a5 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 276804c..ff2b19f 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -9,7 +9,7 @@ ExclusiveArch: none Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.161202 +Version: 0.1.161208 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 35e18dbe3b0789fbe3489f65fb8c295813ab1f85 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Mon, 12 Dec 2016 17:21:17 +0900 Subject: [PATCH 15/16] Fix issue that emoticon is crash in genlist fisheye VI Change-Id: I64eb34797049ade7947173201b410bf155be0461 Signed-off-by: sungwook79.park --- res/edje/w-input-stt.edc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/edje/w-input-stt.edc b/res/edje/w-input-stt.edc index 62d648d..082731d 100755 --- a/res/edje/w-input-stt.edc +++ b/res/edje/w-input-stt.edc @@ -2039,7 +2039,7 @@ collections to: "padding_right_bottom"; } text { - max: 1 0; + min: 1 0; style: "button_general_text_normal"; } } -- 2.7.4 From 6087c90964b4c678db60432671c327f8e3dd8bc3 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 5 Jan 2017 20:44:23 +0900 Subject: [PATCH 16/16] Improve Portability: Support 64bit Systems You cannot directly cast from 64b pointer to 32b int or 32b int to 64b pointer. Change-Id: I6fa7eb50c5760b599071eded65f328d5a89022f0 Signed-off-by: MyungJoo Ham --- src/w-input-emoticon.cpp | 31 ++++++++++++++++--------------- src/w-input-stt-tos.cpp | 3 ++- src/w-input-stt-voice.cpp | 13 +++++++------ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index f0c64f2..42bd53b 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -363,7 +364,7 @@ void set_recent_emoticons(vector &emoticon_list, int val) static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info) { - int index = (int)data; + int index = (uintptr_t)data; PRINTFUNC(DLOG_DEBUG, "index = %d", index); @@ -402,7 +403,7 @@ Evas_Object* get_emoticon_button(Evas_Object* parent, int index){ evas_object_layer_set(btn, 32000); - evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)index); + evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)(uintptr_t)index); return btn; } @@ -421,13 +422,13 @@ Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){ char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); - evas_object_data_set(btn, "index", (void*) recent_emoji_list.at(index)); + evas_object_data_set(btn, "index", (void*)(uintptr_t) recent_emoji_list.at(index)); if (utf_8) free(utf_8); evas_object_layer_set(btn, 32000); - evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*) recent_emoji_list.at(index)); + evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*)(uintptr_t) recent_emoji_list.at(index)); return btn; } @@ -460,7 +461,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo // PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style); if (!strcmp(itc->item_style, "3button_flat")) { - int index = (int)elm_object_item_data_get(it); + int index = (uintptr_t)elm_object_item_data_get(it); //PRINTFUNC(DLOG_DEBUG,"it = %p", it); PRINTFUNC(DLOG_DEBUG, "index = %d %d %d", index, index+1, index+2); @@ -474,7 +475,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo emoticon_contents_pool[index+2].used = 0; } } else if (!strcmp(itc->item_style, "3button_flat_recent")) { - unsigned int index = (int)elm_object_item_data_get(it); + unsigned int index = (uintptr_t)elm_object_item_data_get(it); //PRINTFUNC(DLOG_DEBUG,"index = %d",index); if (index < recent_emoji_list.size()) { @@ -492,7 +493,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part) { if (is_content_reuse_on) { - unsigned int index = (unsigned int)data; + unsigned int index = (uintptr_t)data; int new_index = 0; //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); @@ -518,7 +519,7 @@ static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *o return btn; } } else { - unsigned int index = (unsigned int)data; + unsigned int index = (uintptr_t)data; int new_index = 0; // PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); @@ -548,7 +549,7 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object //PRINTFUNC(DLOG_DEBUG,"%s", __func__); if (is_content_reuse_on) { - int index = (int)data; + int index = (uintptr_t)data; int new_index = 0; if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { @@ -575,7 +576,7 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[new_index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); elm_object_part_text_set(btn, "elm.text", utf_8); - evas_object_data_set(btn, "index", (void*)new_index); + evas_object_data_set(btn, "index", (void*)(uintptr_t)new_index); if (utf_8) free(utf_8); @@ -588,7 +589,7 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object return btn; } } else { - int index = (int)data; + int index = (uintptr_t)data; int new_index = 0; if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { @@ -722,7 +723,7 @@ static Eina_Bool _lazy_loader_cb_for_items(void *data) int i; for (i = loading_done_for_item; i < loading_top; i++ ) { if (i%3 == 0) - elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i); } loading_done_for_item = loading_top; @@ -739,7 +740,7 @@ void _create_reusable_contents(Evas_Object *gl){ for (i = 0; i < INITAL_ITEM_UNIT; i++ ) { if (i%3 == 0) - elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i); } lazy_loading_timer_for_items = ecore_timer_add(0.1, _lazy_loader_cb_for_items, (void *)gl); @@ -842,7 +843,7 @@ void _update_emoticon_items(void *data) for (i=0;i < recent_emoji_list.size();i=i+3) { - it = elm_genlist_item_append(gl, itc_recent, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + it = elm_genlist_item_append(gl, itc_recent, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i); } } @@ -857,7 +858,7 @@ void _update_emoticon_items(void *data) } else { // Emoticons for (i=0;i< EMOTICON_CNT;i=i+3) { - it = elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + it = elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i); it_last = it; } elm_genlist_item_class_free(itc_emoticon); diff --git a/src/w-input-stt-tos.cpp b/src/w-input-stt-tos.cpp index 2084348..8f0a283 100755 --- a/src/w-input-stt-tos.cpp +++ b/src/w-input-stt-tos.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -375,7 +376,7 @@ static void _language_changed_cb(void *_data, Evas_Object *_obj, void *_event_in if (!_obj) return ; if (!_data) return ; - int index = (int)_data; + int index = (uintptr_t)_data; std::string terms = ""; char body_str[40000]; diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index 56514f7..7305ddb 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "Debug.h" #include "w-input-selector.h" @@ -40,7 +41,7 @@ using namespace std; #define GRP_PORTRAIT "mic_control" #define item_append(obj, style, index, cb, udata) \ - elm_genlist_item_append(obj, &(style), (void *)index, NULL, ELM_GENLIST_ITEM_NONE, cb, udata) + elm_genlist_item_append(obj, &(style), (void *)(uintptr_t)index, NULL, ELM_GENLIST_ITEM_NONE, cb, udata) #define VIRTUAL_TEXT_AREA_FONT_STYLE \ "DEFAULT='font=Tizen:style=Regular font_size=32 color=#FFFFFF color_class=AT013 text_class=tizen wrap=mixed align=center' \ @@ -906,11 +907,11 @@ char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part) if(!strcmp(part, "elm.text")) { - if((int)data == 0) { + if((uintptr_t)data == 0) { return strdup(_("IDS_VC_BODY_AUTOMATIC")); } else { char *s = NULL; - s = (char *)disp_lang_array[(int)data]; + s = (char *)disp_lang_array[(uintptr_t)data]; if(s) { char *p = strchr(s, '('); @@ -925,7 +926,7 @@ char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part) } return strdup(text); } else if (!strcmp(part, "elm.text.1")) { - if ((int)data == 0) { + if ((uintptr_t)data == 0) { char* value = NULL; value = vconf_get_str(VCONFKEY_LANGSET); if (NULL == value) { @@ -945,7 +946,7 @@ char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part) } else { char *s = NULL; - s = (char *)disp_lang_array[(int)data]; + s = (char *)disp_lang_array[(uintptr_t)data]; if(s) { char *p = strchr(s, '('); @@ -1103,7 +1104,7 @@ static void language_set_genlist_radio_cb(void *data, Evas_Object *obj, void *ev Elm_Object_Item * item = (Elm_Object_Item *) event_info; if (item) { elm_genlist_item_selected_set(item, 0); - index = (int)elm_object_item_data_get(item); + index = (uintptr_t)elm_object_item_data_get(item); elm_genlist_item_update(item); } set_language_value(index); -- 2.7.4