summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kurzberg <i.kurtsberg@samsung.com>2017-11-08 14:20:28 +0200
committerEugene Kurzberg <i.kurtsberg@samsung.com>2017-11-09 13:17:02 +0200
commit2f064bfa9923aa08a9f0e9d1e788ca29fa094677 (patch)
tree60a7cedc64965e3a15b40895e27c3e9f648fcb31
parente7bb1c7b0214fe84054032bf960b2a37032f552b (diff)
downloadvoice-control-2f064bfa9923aa08a9f0e9d1e788ca29fa094677.tar.gz
voice-control-2f064bfa9923aa08a9f0e9d1e788ca29fa094677.tar.bz2
voice-control-2f064bfa9923aa08a9f0e9d1e788ca29fa094677.zip
TizenRefApp-9767 Implement wave animation amplification on voice input
Change-Id: I2080fb7c07f56442c9c37fee5906471368c7f13d Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
-rw-r--r--voice-app/inc/Voice/WaveformControl.h8
-rw-r--r--voice-app/res/voice/edje/VoicePath.h1
-rw-r--r--voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gifbin846428 -> 0 bytes
-rw-r--r--voice-app/src/Voice/FloatingView.cpp4
-rw-r--r--voice-app/src/Voice/WaveformControl.cpp24
5 files changed, 28 insertions, 9 deletions
diff --git a/voice-app/inc/Voice/WaveformControl.h b/voice-app/inc/Voice/WaveformControl.h
index 4dcb530..1560bf4 100644
--- a/voice-app/inc/Voice/WaveformControl.h
+++ b/voice-app/inc/Voice/WaveformControl.h
@@ -31,6 +31,12 @@ namespace Voice
WaveformControl();
virtual ~WaveformControl() override;
+ /**
+ * @brief Enable or disable voice input animation.
+ * @param[in] isEnabled Whether animation should be enabled
+ */
+ void setVoiceAnimation(bool isEnabled);
+
private:
virtual Evas_Object *onCreate(Evas_Object *parent) override;
@@ -48,12 +54,14 @@ namespace Voice
cairo_t *m_Cairo;
cairo_surface_t *m_Surface;
+ bool m_IsVoiceAnimEnabled;
struct WaveComponent
{
double freq;
double ampl;
double param;
double paramDelta;
+ double paramAccel;
} m_WaveComponents[4];
};
}
diff --git a/voice-app/res/voice/edje/VoicePath.h b/voice-app/res/voice/edje/VoicePath.h
index 56b3714..f1430a4 100644
--- a/voice-app/res/voice/edje/VoicePath.h
+++ b/voice-app/res/voice/edje/VoicePath.h
@@ -25,7 +25,6 @@
#define PATH_FEEDBACK_BG VOICE_IMG_DIR"circle.png"
#define PATH_FEEDBACK_EFFECT VOICE_IMG_DIR"ring.png"
-#define PATH_FEEDBACK_WAVE VOICE_IMG_DIR"VC_SLOW_VOICE_WAVE.gif"
#define PATH_BUTTON_ICON VOICE_IMG_DIR"mic.png"
#define PATH_BUTTON_EFFECT VOICE_IMG_DIR"glow.png"
diff --git a/voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gif b/voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gif
deleted file mode 100644
index fcce4ad..0000000
--- a/voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gif
+++ /dev/null
Binary files differ
diff --git a/voice-app/src/Voice/FloatingView.cpp b/voice-app/src/Voice/FloatingView.cpp
index 62b1ae3..15ac022 100644
--- a/voice-app/src/Voice/FloatingView.cpp
+++ b/voice-app/src/Voice/FloatingView.cpp
@@ -59,9 +59,7 @@ void FloatingView::setButtonEnabled(bool isEnabled)
void FloatingView::setVoiceAnimation(bool isEnabled)
{
- /* FIXME: current GIF resource animation causes rendering issues
- * elm_image_animated_play_set(m_Waveform, isEnabled);
- */
+ m_Waveform->setVoiceAnimation(isEnabled);
}
void FloatingView::setFullScreen(bool isFullScreen)
diff --git a/voice-app/src/Voice/WaveformControl.cpp b/voice-app/src/Voice/WaveformControl.cpp
index b1d680c..a2aaac6 100644
--- a/voice-app/src/Voice/WaveformControl.cpp
+++ b/voice-app/src/Voice/WaveformControl.cpp
@@ -29,12 +29,12 @@ using namespace Voice;
WaveformControl::WaveformControl()
: m_Image(nullptr), m_Width(0), m_Height(0), m_Animator(nullptr),
- m_Cairo(nullptr), m_Surface(nullptr),
+ m_Cairo(nullptr), m_Surface(nullptr), m_IsVoiceAnimEnabled(false),
m_WaveComponents{
- { 7, 0.2, 0.0, 0.0 },
- { 8, 0.3, 0.0, 0.1 },
- { 11, 0.25, 0.0, 0.1 },
- { 14, 0.25, 0.0, 0.0 } }
+ { 7, 0.2, 0.0, 0.0, 0.0 },
+ { 8, 0.3, 0.0, 0.1, 0.5 },
+ { 11, 0.25, 0.0, 0.1, 0.5 },
+ { 14, 0.25, 0.0, 0.0, 0.0 } }
{
}
@@ -45,6 +45,20 @@ WaveformControl::~WaveformControl()
cairo_surface_destroy(m_Surface);
}
+void WaveformControl::setVoiceAnimation(bool isEnabled)
+{
+ if (m_IsVoiceAnimEnabled != isEnabled) {
+ m_IsVoiceAnimEnabled = isEnabled;
+ for (auto &&component : m_WaveComponents) {
+ if (m_IsVoiceAnimEnabled) {
+ component.paramDelta += component.paramAccel;
+ } else {
+ component.paramDelta -= component.paramAccel;
+ }
+ }
+ }
+}
+
Evas_Object *WaveformControl::onCreate(Evas_Object *parent)
{
Evas_Object *layout = elm_layout_add(parent);