From 398afce1d37bad97d50a20aa5406a4dc6327912d Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Sat, 16 Feb 2008 20:13:05 +0000 Subject: - Added to pd example the ability to differentiate between different argv types (XTRACT_FLOAT, XTRACT_INT) and pass the correct data type to the xtract[]() function - Added xtract_flatness_db() details to descriptors.c - Fixes to tonality and xtract_subbands descriptors - Added Pd examples for 'subband mean' and tonality calculated using subbands --- src/vector.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/vector.c') diff --git a/src/vector.c b/src/vector.c index 97a876b..449cd0d 100644 --- a/src/vector.c +++ b/src/vector.c @@ -545,9 +545,10 @@ int xtract_lpcc(const float *data, const int N, const void *argv, float *result) int cep_length; if(argv == NULL) - cep_length = N - 1; + cep_length = N - 1; /* FIX: if we're going to have default values, they should come from the descriptor */ else - cep_length = (int)((float *)argv)[0]; + cep_length = *(int *)argv; + //cep_length = (int)((float *)argv)[0]; memset(result, 0, cep_length * sizeof(float)); @@ -584,20 +585,22 @@ int xtract_subbands(const float *data, const int N, const void *argv, float *res scale = argi[2]; start = argi[3]; - if(scale == XTRACT_LINEAR_SUBBANDS) bw = floorf((N - start) / nbands); else bw = start; lower = start; + rv = XTRACT_SUCCESS; for(n = 0; n < nbands; n++){ /* Bounds sanity check */ - if(lower + bw >= N) - result[n] = 0.f + if(lower >= N || lower + bw >= N){ + // printf("n: %d\n", n); + result[n] = 0.f; continue; + } rv = xtract[xtract_func](data+lower, bw, NULL, &result[n]); -- cgit v1.2.3