comparison Source/FFTW.h @ 1:e86e9c111b29

Updates stuff that potentially fixes the memory leak and also makes it work on Windows and Linux (Need to test). Still have to fix fftw include for linux in Jucer.
author David Ronan <d.m.ronan@qmul.ac.uk>
date Thu, 09 Jul 2015 15:01:32 +0100
parents 25bf17994ef1
children 005e311b5e62
comparison
equal deleted inserted replaced
0:25bf17994ef1 1:e86e9c111b29
1 //---------------------------------------------------------------------------------------------------------------------- 1 //----------------------------------------------------------------------------------------------------------------------
2 /** 2 /**
3 \author André Bergner 3 \author André Bergner
4 \date Feb/2013 4 \date Feb/2013
5 5
6 \class FFTW 6 \class FFTW
7 7
8 Encapsulates the FFT of lib-fftw 8 Encapsulates the FFT of lib-fftw
9 9
10 (c) Copyright NATIVE INSTRUMENTS, Berlin, Germany 10 (c) Copyright NATIVE INSTRUMENTS, Berlin, Germany
11 ALL RIGHTS RESERVED 11 ALL RIGHTS RESERVED
12 */ 12 */
13 //---------------------------------------------------------------------------------------------------------------------- 13 //----------------------------------------------------------------------------------------------------------------------
14 14
15 #pragma once 15 #pragma once
16 16
17 #include "fftw3.h" 17 #include "fftw3.h"
18 #include <vector> 18 #include <vector>
19 #include <windows.h> 19 #include <stdio.h>
20 #include <string> 20 //#include <windows.h>
21 #include <string.h>
21 //#include <itl/dsp/SimdTools.h> 22 //#include <itl/dsp/SimdTools.h>
22 23
23 24
24 25
25 class FFTW 26 class FFTW
27 28
28 public: 29 public:
29 fftwf_plan m_plan; 30 fftwf_plan m_plan;
30 unsigned m_iFFTSize; 31 unsigned m_iFFTSize;
31 32
32 FFTW(); 33 FFTW();
33 FFTW( unsigned fftLength ) 34 FFTW( unsigned fftLength )
34 { 35 {
35 m_iFFTSize = fftLength; 36 m_iFFTSize = fftLength;
36 37
37 float* tempInput = new float[fftLength]; 38 float* tempInput = new float[fftLength];
69 70
70 fftwf_execute_split_dft_r2c( m_plan, nonConstInput, realPart, imagPart); 71 fftwf_execute_split_dft_r2c( m_plan, nonConstInput, realPart, imagPart);
71 72
72 //Multiply results by 2 to match the iOS output 73 //Multiply results by 2 to match the iOS output
73 for(size_t i = 0; i < m_iFFTSize; i++) 74 for(size_t i = 0; i < m_iFFTSize; i++)
74 { 75 {
75 realPart[i] *= 2.f; 76 realPart[i] *= 2.f;
76 imagPart[i] *= 2.f; 77 imagPart[i] *= 2.f;
77 } 78 }
78 } 79 }
79 80