diff options
-rw-r--r-- | voice-app/inc/Voice/WaveformControl.h | 8 | ||||
-rw-r--r-- | voice-app/res/voice/edje/VoicePath.h | 1 | ||||
-rw-r--r-- | voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gif | bin | 846428 -> 0 bytes | |||
-rw-r--r-- | voice-app/src/Voice/FloatingView.cpp | 4 | ||||
-rw-r--r-- | voice-app/src/Voice/WaveformControl.cpp | 24 |
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 Binary files differdeleted file mode 100644 index fcce4ad..0000000 --- a/voice-app/res/voice/images/VC_SLOW_VOICE_WAVE.gif +++ /dev/null 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); |