From: sungwook79.park Date: Mon, 5 Dec 2016 04:59:38 +0000 (+0900) Subject: Adopt wave VI for voice mode X-Git-Tag: accepted/tizen/3.0/common/20161206.125726^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F102123%2F3;p=platform%2Fcore%2Fuifw%2Fise-default.git Adopt wave VI for voice mode Change-Id: Ie31c7166c79d8f31554a458adfbd02d511754a35 Signed-off-by: sungwook79.park --- diff --git a/res/mobile/edje/w-input-stt.edc b/res/mobile/edje/w-input-stt.edc index 82da638..54bbccf 100644 --- a/res/mobile/edje/w-input-stt.edc +++ b/res/mobile/edje/w-input-stt.edc @@ -588,22 +588,34 @@ collections description { state, "default" 0.0; - min, 0 74; - max, 9999 74; - align, 0.5 1; rel1 { - relative, 0 1; - to, "bg"; - offset, 0 -14; + relative, 0.13 0.3; + to, "background"; } rel2 { relative, 1 1; - to, "bg"; - offset, 0 -14; + to, "background"; } } + + description + { + state, "hide" 0.0; + rel1 + { + relative, 0.13 0.3; + to, "background"; + } + rel2 + { + relative, 1 1; + to, "background"; + } + + } + } part { @@ -612,7 +624,7 @@ collections description { state, "default" 0.0; - visible, 0; + visible, 1; rel1 { relative, 0 0; @@ -632,7 +644,6 @@ collections } } - part { name, "MIC_ICON"; @@ -659,7 +670,7 @@ collections { state, "recording" 0.0; inherit, "default" 0.0; - visible, 1; + visible, 0; } description { @@ -813,6 +824,18 @@ collections } color, 255 255 255 255; } + description + { + state, "recording" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description + { + state, "processing" 0.0; + inherit, "default" 0.0; + visible, 0; + } } } diff --git a/res/wearable/edje/w-input-stt.edc b/res/wearable/edje/w-input-stt.edc index b627c6f..df6088c 100644 --- a/res/wearable/edje/w-input-stt.edc +++ b/res/wearable/edje/w-input-stt.edc @@ -589,22 +589,44 @@ 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 { @@ -613,7 +635,7 @@ collections description { state, "default" 0.0; - visible, 0; + visible, 1; rel1 { relative, 0 0; @@ -633,7 +655,6 @@ collections } } - part { name, "MIC_ICON"; @@ -814,6 +835,18 @@ collections } color, 255 255 255 255; } + description + { + state, "recording" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description + { + state, "processing" 0.0; + inherit, "default" 0.0; + visible, 0; + } } } diff --git a/src/MicEffector.cpp b/src/MicEffector.cpp index 5f48e69..2d6c46f 100644 --- 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 "ISE_DEFAULT" + + using namespace is::ui; /** @@ -71,16 +83,24 @@ MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& , 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); + + root = evas_object_vg_root_node_get(vg); + shape = evas_vg_shape_add(root); + evas_vg_node_color_set(shape, 80, 80, 80, 80); -// this->canvas = ea_vector_canvas_create(canvas); + 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); +#ifdef _WEARABLE + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, 255); +#else + evas_vg_shape_stroke_color_set(shape, 51, 204, 255, 255); +#endif DrawDummyFrame(); }; @@ -92,15 +112,18 @@ MicEffector::MicEffector(Evas_Object *canvas, Evas_Object *layout, IMicEffector& */ MicEffector::~MicEffector() { - if (timer) - { + if (timer) { ecore_timer_del(timer); timer = NULL; } + if (vg) + evas_object_del(vg); + + if (root) + evas_object_del(root); -// ea_vector_path_destroy(path); -// ea_vector_paint_destroy(paint); -// ea_vector_canvas_destroy(canvas); + if (shape) + evas_object_del(shape); } /** @@ -109,10 +132,11 @@ MicEffector::~MicEffector() */ 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); } /** @@ -126,35 +150,38 @@ void MicEffector::DrawDummyFrame() */ void MicEffector::DrawQue(int idx, bool is_start) { -// float margin = spectrum_posx; -// float posx = 0.0; + float margin = spectrum_posx; + float posx = 0.0; double speed = cubic_easy_out(idx + 1.0, 0.0, 23.0, 23); unsigned int start = start_stop_anim_count - (int) speed; unsigned int end = start_stop_anim_count + (int) speed; -// double opacity; + double opacity; if (is_start) { -// opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); + opacity = cubic_easy_out(idx, 0.0, 1.0, 26.0); } else { -// opacity = cubic_easy_out(idx, 0, 1.0, 26.0); + opacity = cubic_easy_out(idx, 0, 1.0, 26.0); } -// ea_vector_path_reset(path); + evas_vg_shape_reset(shape); for (unsigned int i = start; i < end; i++) { -// posx = margin + (i * 5); - -// ea_vector_path_move_to(path, posx, 37.0f); -// ea_vector_path_line_to(path, posx, 38.0f); - -// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity); + posx = margin + (i * 5); + + evas_vg_shape_append_move_to(shape, posx, 37); + evas_vg_shape_append_line_to(shape, posx, 38); +#ifdef _WEARABLE + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); +#else + evas_vg_shape_stroke_color_set(shape, 51, 204, 255, 255); +#endif } -// ea_vector_canvas_draw(canvas, path, paint); + evas_object_show(vg); } float MicEffector::GetAmplifyValue(unsigned int idx) @@ -212,28 +239,28 @@ 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 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))); + 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))); - 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 - } +#ifdef _WEARABLE + evas_vg_shape_stroke_color_set(shape, 255, 255, 255, opacity); +#else + evas_vg_shape_stroke_color_set(shape, 51, 204, 255, 255); +#endif } /** @@ -278,7 +305,7 @@ void MicEffector::Start() for (unsigned int i = 0; i < spectrum_count; i++) effector->DrawWave(i, 0, 0); -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); + evas_object_show(effector->vg); effector->drawcount = 0; effector->timer = NULL; @@ -312,20 +339,21 @@ void MicEffector::Effect(bool fake) bool is_empty_prev = effector->prev.empty(); - -// ea_vector_path_reset(effector->path); + evas_vg_shape_reset(effector->shape); for (unsigned int i = 0; i < effector->current.size(); i++) { - if (is_empty_prev) + if (is_empty_prev) { effector->DrawWave(i, effector->current.at(i), 0); - else + } else { effector->DrawWave(i, effector->current.at(i), effector->prev.at(i)); + } } -// ea_vector_canvas_draw(effector->canvas, effector->path, effector->paint); + evas_object_show(effector->vg); if (effector->drawcount < 7) { effector->drawcount++; + effector->VolumeCheck(effector->fake); } else { effector->drawcount = 0; effector->VolumeCheck(effector->fake); @@ -367,9 +395,11 @@ void MicEffector::Stop(bool forced) return ECORE_CALLBACK_RENEW; } else { if (!effector->forcestop) { - effector->Processing(); +// effector->Processing(); } else { +#ifdef _MOBILE effector->Idle(); +#endif } effector->forcestop = false; @@ -390,13 +420,13 @@ void MicEffector::VolumeCheck(bool 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); - } + for (unsigned int i = 0; i < spectrum_count; i++) { + unsigned int seed = time(NULL); +#ifdef _WEARABLE + volumes.push_back(rand_r(&seed) % 6); +#else + volumes.push_back(rand_r(&seed) % 15); +#endif } prev.clear(); @@ -414,8 +444,8 @@ void MicEffector::Listening() { 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,eq,show", "eq"); } /** diff --git a/src/include/MicEffector.h b/src/include/MicEffector.h index ca888eb..aa3b821 100644 --- a/src/include/MicEffector.h +++ b/src/include/MicEffector.h @@ -19,6 +19,7 @@ #include #include + #define SAMPLE_COUNT 59 namespace is { /** name space input selector */ @@ -139,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. * */ @@ -160,6 +153,10 @@ class MicEffector bool started; bool fake; + Evas_Object *vg; + Efl_VG *root; + Efl_VG *shape; + /** * timer handle * diff --git a/src/ise-stt-mode.cpp b/src/ise-stt-mode.cpp index f94da09..19826ad 100644 --- a/src/ise-stt-mode.cpp +++ b/src/ise-stt-mode.cpp @@ -114,7 +114,6 @@ static Eina_Bool _recognition_failure_cb(void *data) } static Eina_Bool change_guide_text(void *data){ - VoiceData *voicedata = (VoiceData *) data; if (!voicedata) return ECORE_CALLBACK_CANCEL; @@ -557,6 +556,15 @@ Evas_Object *create_fullview(Evas_Object *win, VoiceData *r_voicedata) ret = elm_layout_file_set(layout_main, edj_path.c_str(), "mic_control"); LOGD("elm_layout_file_set result = %d", ret); + //Canvas for Cairo effect + Evas_Object *canvas = evas_object_image_filled_add(evas_object_evas_get(layout_main)); + evas_object_propagate_events_set(canvas, EINA_TRUE); + evas_object_image_alpha_set(canvas, EINA_TRUE); + evas_object_size_hint_align_set(canvas, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(canvas, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_move(canvas, 0, 0); + + elm_object_part_content_set(layout_main, "EFFECT_BG", canvas); elm_object_content_set(win, layout_main); // MIC Button