diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2008-02-16 20:13:05 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2008-02-16 20:13:05 +0000 |
commit | 398afce1d37bad97d50a20aa5406a4dc6327912d (patch) | |
tree | 6b4bbeeaadc14e1e4ef3567565aae7023a6c2161 /src/vector.c | |
parent | 26fa6beab516a699ead017f4a2d68b1d861b9561 (diff) | |
download | LibXtract-398afce1d37bad97d50a20aa5406a4dc6327912d.tar.gz LibXtract-398afce1d37bad97d50a20aa5406a4dc6327912d.tar.bz2 LibXtract-398afce1d37bad97d50a20aa5406a4dc6327912d.zip |
- 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
Diffstat (limited to 'src/vector.c')
-rw-r--r-- | src/vector.c | 13 |
1 files changed, 8 insertions, 5 deletions
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]); |