aboutsummaryrefslogtreecommitdiff
path: root/src/scalar.c
diff options
context:
space:
mode:
authorJamie Bullock <jamie@postlude.co.uk>2006-12-21 11:31:51 +0000
committerJamie Bullock <jamie@postlude.co.uk>2006-12-21 11:31:51 +0000
commit0971d72ace9b0d4c956817bf88f97e15461af112 (patch)
tree184b385a0919bbe6e4dbb7a40c264fabccfdf04c /src/scalar.c
parent55e12c391bbfb4c6bd7054e78b807dfc97cd3ed5 (diff)
downloadLibXtract-0971d72ace9b0d4c956817bf88f97e15461af112.tar.gz
LibXtract-0971d72ace9b0d4c956817bf88f97e15461af112.tar.bz2
LibXtract-0971d72ace9b0d4c956817bf88f97e15461af112.zip
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.
Diffstat (limited to 'src/scalar.c')
-rw-r--r--src/scalar.c9
1 files changed, 6 insertions, 3 deletions
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){