* limitations under the License.
*/
+#define EFL_BETA_API_SUPPORT 1
+#define EFL_EO_API_SUPPORT 1
+
+#include <Eo.h>
+
#include <string.h>
#include "MicEffector.h"
+#include <Elementary.h>
+#include <Evas.h>
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "ISE_DEFAULT"
+
+
using namespace is::ui;
/**
, 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();
};
*/
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);
}
/**
*/
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);
}
/**
*/
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)
*/
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
}
/**
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;
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);
return ECORE_CALLBACK_RENEW;
} else {
if (!effector->forcestop) {
- effector->Processing();
+// effector->Processing();
} else {
+#ifdef _MOBILE
effector->Idle();
+#endif
}
effector->forcestop = false;
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();
{
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");
}
/**