diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/descriptors.c | 7 | ||||
-rw-r--r-- | src/fini.c | 14 | ||||
-rw-r--r-- | src/init.c | 12 | ||||
-rw-r--r-- | src/vector.c | 1 |
4 files changed, 21 insertions, 13 deletions
diff --git a/src/descriptors.c b/src/descriptors.c index 4c232d7..ac1fd1b 100644 --- a/src/descriptors.c +++ b/src/descriptors.c @@ -24,7 +24,7 @@ #include <string.h> #define XTRACT -void *xtract_make_descriptors(){ +xtract_function_descriptor_t *xtract_make_descriptors(void){ int f , F; char *name, *p_name, *desc, *p_desc, *author; @@ -45,6 +45,7 @@ void *xtract_make_descriptors(){ while(f--){ d = &fd[f]; + d->id = f; argc = &d->argc; argv_type = &d->argv.type; @@ -502,7 +503,7 @@ void *xtract_make_descriptors(){ strcpy(author, ""); break; case XTRACT_ROLLOFF: - strcpy(name, "spectral_rolloff"); + strcpy(name, "rolloff"); strcpy(p_name, "Spectral Rolloff"); strcpy(desc, "Extract the rolloff point of a spectrum"); @@ -1250,7 +1251,7 @@ void *xtract_make_descriptors(){ return fd; } -int xtract_free_descriptors(void *fd){ +int xtract_free_descriptors(xtract_function_descriptor_t *fd){ if (fd != NULL) { free(fd); @@ -22,7 +22,8 @@ #ifdef XTRACT_FFT #include <fftw3.h> -#include "xtract_globals_private.h" +//#include "xtract_globals_private.h" +#include "xtract/libxtract.h" #endif #ifdef __GNUC__ @@ -32,15 +33,8 @@ void _fini() #endif { #ifdef XTRACT_FFT - if(fft_plans.spectrum_plan != NULL) - fftwf_destroy_plan(fft_plans.spectrum_plan); - if(fft_plans.autocorrelation_fft_plan_1 != NULL) - fftwf_destroy_plan(fft_plans.autocorrelation_fft_plan_1); - if(fft_plans.autocorrelation_fft_plan_2 != NULL) - fftwf_destroy_plan(fft_plans.autocorrelation_fft_plan_2); - if(fft_plans.dct_plan != NULL) - fftwf_destroy_plan(fft_plans.dct_plan); - fftwf_cleanup(); +xtract_free_fft(); +fftwf_cleanup(); #endif } @@ -203,6 +203,18 @@ int xtract_init_fft(int N, int feature_name){ } +void xtract_free_fft(void){ + if(fft_plans.spectrum_plan != NULL) + fftwf_destroy_plan(fft_plans.spectrum_plan); + if(fft_plans.autocorrelation_fft_plan_1 != NULL) + fftwf_destroy_plan(fft_plans.autocorrelation_fft_plan_1); + if(fft_plans.autocorrelation_fft_plan_2 != NULL) + fftwf_destroy_plan(fft_plans.autocorrelation_fft_plan_2); + if(fft_plans.dct_plan != NULL) + fftwf_destroy_plan(fft_plans.dct_plan); +// fftwf_cleanup(); +} + #endif int xtract_init_bark(int N, float sr, int *band_limits){ diff --git a/src/vector.c b/src/vector.c index d3fdd67..0ffd8ae 100644 --- a/src/vector.c +++ b/src/vector.c @@ -368,6 +368,7 @@ int xtract_bark_coefficients(const float *data, const int N, const void *argv, f limits = (int *)argv; for(band = 0; band < XTRACT_BARK_BANDS - 1; band++){ + result[band] = 0.f; for(n = limits[band]; n < limits[band + 1]; n++) result[band] += data[n]; } |