diff src/scalar.c @ 55:4ea1a8838b14

Finished the essentials of descriptors.c
author Jamie Bullock <jamie@postlude.co.uk>
date Sun, 21 Jan 2007 14:40:23 +0000
parents 9762d7e3d129
children 450712b21565
line wrap: on
line diff
--- a/src/scalar.c	Thu Jan 11 16:37:50 2007 +0000
+++ b/src/scalar.c	Sun Jan 21 14:40:23 2007 +0000
@@ -374,18 +374,20 @@
 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;
 }