From 64d6de56068584a090e555abf49a16d6bdf97696 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Sun, 21 Jan 2007 14:40:23 +0000 Subject: Finished the essentials of descriptors.c --- src/scalar.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/scalar.c') diff --git a/src/scalar.c b/src/scalar.c index 6e7faeb..68b5b19 100644 --- a/src/scalar.c +++ b/src/scalar.c @@ -374,18 +374,20 @@ int xtract_zcr(const float *data, const int N, const void *argv, float *result){ int xtract_rolloff(const float *data, const int N, const void *argv, float *result){ int n = N; - float pivot, temp; + float pivot, temp, percentile; pivot = temp = 0.f; + percentile = ((float *)argv)[1]; while(n--) pivot += data[n]; - pivot *= ((float *)argv)[0]; + pivot *= percentile / 100.f; for(n = 0; temp < pivot; n++) temp += data[n]; - *result = (n / (float)N) * (((float *)argv)[1] * .5); + *result = n * ((float *)argv)[0]; + /* *result = (n / (float)N) * (((float *)argv)[1] * .5); */ return SUCCESS; } -- cgit v1.2.3