*/
#include <string.h>
-#include <efl_assist.h>
#include "MicEffector.h"
using namespace is::ui;
#define MATH_PI (3.141592)
-double cubic_easy_in_out (double index, double start, double end, double duration)
+double cubic_easy_in_out(double index, double start, double end, double duration)
{
index /= duration/2;
if (index < 1)
: drawcount(0)
, forcestop(false)
, started(false)
+ , fake(false)
, timer(NULL)
, layout(layout)
, ieffect(effect)
- , fake(false)
{
// path = ea_vector_path_create();
// paint = ea_vector_paint_create();
*/
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);
- }
- else {
- opacity = cubic_easy_out(idx, 0, 1.0, 26.0);
+ 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);
}
// ea_vector_path_reset(path);
for(unsigned int i = start; i < end; i++)
{
- posx = margin + (i * 5);
+// posx = margin + (i * 5);
// ea_vector_path_move_to(path, posx, 37.0f);
// ea_vector_path_line_to(path, posx, 38.0f);
* Center of effect area, it applies amplified value.
*
*/
-void MicEffector::DrawWave(unsigned int idx, int amount, int prev_amount, double opacity,bool is_lastcmd)
+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;
// 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) {
+ if (is_lastcmd) {
// ea_vector_paint_set_color(paint, 0.1451f, 0.204f, 0.255f, opacity);//RGB = 37:52:65
- }
- else {
+ } else {
// ea_vector_paint_set_color(paint, 1.0f, 1.0f, 1.0f, opacity);//RGB: 255 255 255
}
}
* Que animation
*
*/
- timer = ecore_timer_add ( timeout_s,
+ timer = ecore_timer_add(timeout_s,
[](void *data)->Eina_Bool
{
MicEffector *effector = static_cast<MicEffector*>(data);
effector->DrawQue(effector->drawcount);
- if(effector->drawcount < (int) start_stop_anim_count)
- {
+ if(effector->drawcount < (int) start_stop_anim_count) {
effector->drawcount += 2;
return ECORE_CALLBACK_RENEW;
- }
- else
- {
+ } else {
for(unsigned int i = 0; i < spectrum_count; i++)
effector->DrawWave(i, 0, 0);
this);
}
-
-
/**
* Volume effect
*
timer = NULL;
}
- timer = ecore_timer_add ( timeout_s,
+ timer = ecore_timer_add(timeout_s,
[](void *data)->Eina_Bool
{
-
MicEffector *effector = static_cast<MicEffector *>(data);
bool is_empty_prev = effector->prev.empty();
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
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) {
+ if (effector->drawcount < 7) {
effector->drawcount++;
- }
- else {
+ } else {
effector->drawcount = 0;
effector->VolumeCheck(effector->fake);
}
effector->DrawQue(start_stop_anim_count - effector->drawcount, false);
- if(effector->drawcount < (int) start_stop_anim_count)
- {
+ if(effector->drawcount < (int) start_stop_anim_count) {
effector->drawcount += 2;
return ECORE_CALLBACK_RENEW;
- }
- else
- {
+ } else {
if(!effector->forcestop) {
effector->Processing();
- }
- else {
+ } else {
effector->Idle();
}
effector->timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
-
}, this);
}
-
-
/**
* Signal. Refresh volume effect
*
if(!fake) {
volumes = ieffect.GetVolume();
- }
- else {
+ } else {
for(unsigned int i = 0; i < spectrum_count; i++) {
- volumes.push_back(rand() % 2);
+ unsigned int seed = time(NULL);
+ volumes.push_back(rand_r(&seed) % 2);
}
}