aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scalar.c8
-rw-r--r--src/vector.c11
2 files changed, 18 insertions, 1 deletions
diff --git a/src/scalar.c b/src/scalar.c
index ec22dd4..6270869 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -28,6 +28,14 @@
#include <string.h>
#include <stdio.h>
+#ifndef powf
+ #define powf pow
+#endif
+
+#ifndef expf
+ #define expf exp
+#endif
+
int xtract_mean(const float *data, const int N, const void *argv, float *result){
int n = N;
diff --git a/src/vector.c b/src/vector.c
index 77bad64..0df7048 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -27,6 +27,15 @@
#include <string.h>
#include <stdlib.h>
+#ifndef roundf
+ float roundf(float f){
+ if (f - (int)f >= 0.5)
+ return (float)((int)f + 1);
+ else
+ return (float)((int)f);
+ }
+#endif
+
#ifdef XTRACT_FFT
#include <fftw3.h>
@@ -411,7 +420,7 @@ int xtract_harmonic_spectrum(const float *data, const int N, const void *argv, f
while(n--){
if(freqs[n]){
ratio = freqs[n] / f0;
- nearest = round(ratio);
+ nearest = roundf(ratio);
distance = fabs(nearest - ratio);
if(distance > threshold)
result[n] = result[M + n] = 0.f;