From 4f4299de894cee1b49238114c80f5c865a1a6026 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 11 Oct 2009 12:40:04 +0200 Subject: [PATCH] src/spectral/fft.c: make sure we set allocated vectors to 0 --- src/spectral/fft.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/spectral/fft.c b/src/spectral/fft.c index c3af6a2d..71acca64 100644 --- a/src/spectral/fft.c +++ b/src/spectral/fft.c @@ -83,6 +83,7 @@ struct _aubio_fft_t { aubio_fft_t * new_aubio_fft(uint_t winsize, uint_t channels) { aubio_fft_t * s = AUBIO_NEW(aubio_fft_t); + uint_t i; s->winsize = winsize; s->channels = channels; /* allocate memory */ @@ -101,6 +102,13 @@ aubio_fft_t * new_aubio_fft(uint_t winsize, uint_t channels) { s->pfw = fftw_plan_r2r_1d(winsize, s->in, s->specdata, FFTW_R2HC, FFTW_ESTIMATE); s->pbw = fftw_plan_r2r_1d(winsize, s->specdata, s->out, FFTW_HC2R, FFTW_ESTIMATE); #endif + for (i = 0; i < s->winsize; i++) { + s->in[i] = 0.; + s->out[i] = 0.; + } + for (i = 0; i < s->fft_size; i++) { + s->specdata[i] = 0.; + } return s; } -- 2.26.2