From f8eed0713059b5c4e8e56ba98b8a33fe2a472d84 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Mon, 3 Sep 2007 14:31:58 +0000 Subject: Checked ANSI C89 compliance (basically a few ifndefs for the C99 math functions: powf, roundf etc). Added a few PD examples/tests. --- src/vector.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/vector.c') 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 #include +#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 @@ -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; -- cgit v1.2.3