effector->drawcount = 0;
effector->timer = NULL;
- effector->VolumeCheck();
+ effector->VolumeCheck(true);
effector->Effect();
return ECORE_CALLBACK_CANCEL;
}
if (effector->drawcount < 7) {
effector->drawcount++;
- effector->VolumeCheck(effector->fake);
+ effector->VolumeCheck(true);
} else {
effector->drawcount = 0;
- effector->VolumeCheck(effector->fake);
+ effector->VolumeCheck(true);
}
return ECORE_CALLBACK_RENEW;
this->fake = fake;
- for (unsigned int i = 0; i < spectrum_count; i++) {
- unsigned int seed = time(NULL);
+ if (!fake) {
+ volumes = ieffect.GetVolume();
+ } else {
+ for (unsigned int i = 0; i < spectrum_count; i++) {
+ unsigned int seed = time(NULL);
#ifdef _WEARABLE
- volumes.push_back(rand_r(&seed) % 6);
+ volumes.push_back(rand_r(&seed) % 6);
#else
- volumes.push_back(rand_r(&seed) % 15);
+ volumes.push_back(rand_r(&seed) % 15);
#endif
+ }
}
prev.clear();
#include <cmath>
#include <algorithm>
#include <numeric>
-
+#include <stt.h>
#include <efl_extension.h>
#include "WInputSttMicEffect.h"
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "ISE_DEFAULT"
namespace {
template<class T>
-static unsigned long long SumSquare(unsigned long long const& a, T const& b) {
+static float SumSquare(float const& a, T const& b) {
return a + b*b;
}
std::vector<int> WInputSttMicEffect::GetVolume() {
std::vector<int> result;
- short pcm[512] = {0};
- int size = 0;
+ float pcm[512] = {0};
+ int size = 50;
int ret = 0;
-// ret = stt_get_spectrum(handle, (void *) pcm, &size);
+ ret = stt_get_recording_volume(handle, pcm);
count = 5;
if (STT_ERROR_NONE != ret) {
unsigned int step = (unsigned int) (size/2/sample_count);
for (unsigned int k = 0; k < sample_count; k++ ){
- square_sum = std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare<short>);
+ square_sum = (unsigned long long)std::accumulate(pcm + k*step, pcm + k*step + 5, 0ull, SumSquare<float>);
level = ConvertLevel();
result.push_back(level);
}