Mercurial > hg > qm-dsp
diff dsp/phasevocoder/PhaseVocoder.cpp @ 55:7fe29d8a7eaf
* Various fixes related to the bar estimator code
author | cannam |
---|---|
date | Tue, 10 Feb 2009 16:37:11 +0000 |
parents | d7116e3183f8 |
children | 6cb2b3cd5356 |
line wrap: on
line diff
--- a/dsp/phasevocoder/PhaseVocoder.cpp Tue Feb 10 12:52:43 2009 +0000 +++ b/dsp/phasevocoder/PhaseVocoder.cpp Tue Feb 10 16:37:11 2009 +0000 @@ -28,24 +28,12 @@ void PhaseVocoder::FFTShift(unsigned int size, double *src) { - // IN-place Rotation of FFT arrays - unsigned int i; - - shiftBuffer = new double[size/2]; - - for( i = 0; i < size/2; i++) - { - shiftBuffer[ i ] = src[ i ]; - src[ i ] = src[ i + size/2]; + const int hs = size/2; + for (int i = 0; i < hs; ++i) { + double tmp = src[i]; + src[i] = src[i + hs]; + src[i + hs] = tmp; } - - for( i =size/2; i < size; i++) - { - src[ i ] = shiftBuffer[ i -(size/2)]; - } - - delete [] shiftBuffer; - } void PhaseVocoder::process(unsigned int size, double *src, double *mag, double *theta)