From 0971d72ace9b0d4c956817bf88f97e15461af112 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Thu, 21 Dec 2006 11:31:51 +0000 Subject: xtract_magnitude_spectrum() and xtract_peaks() share format of N/2 frequency values and N/2 magnitude coefficients. 'Fixed' xtract_loudness() so that N=1 can be used for specific loudness. --- src/scalar.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/scalar.c') diff --git a/src/scalar.c b/src/scalar.c index 612fa3c..49c4408 100644 --- a/src/scalar.c +++ b/src/scalar.c @@ -291,14 +291,17 @@ int xtract_rolloff(const float *data, const int N, const void *argv, float *resu int xtract_loudness(const float *data, const int N, const void *argv, float *result){ - int n = BARK_BANDS; + int n = N, rv; - /*if(n != N) return BAD_VECTOR_SIZE; */ + if(n > BARK_BANDS) + rv = BAD_VECTOR_SIZE; + else + rv = SUCCESS; while(n--) *result += pow(data[n], 0.23); - return SUCCESS; + return rv; } int xtract_flatness(const float *data, const int N, const void *argv, float *result){ -- cgit v1.2.3