bck
Alejandro Acuña
2024-11-11 f1cb4443aede6d4657bdc3396c8914d3a9f4fa93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/********************************************************************************
 * Class FFTCalculator                                                          *
 *                                                                              *
 * This class acts as a wrapper for the non-managed library FFTw, so it can be  *
 * used in visual studio .net projects                                          *
 * The FFTw library is an open-source library (www.FFTw.org). It does FFT       *
 * calculations in different ways. For this project we use the most simple one  *
 * to obtain the FFT of a one dimmensional vector.                              *
 *                                                                              *
 * How to use the FFTCalculator class:                                          *
 *    1 - When you create an FFTCalculator object, you must pass to the         *
 *        constructor the number of samples to analyze and pointers to the      *
 *        two buffers for the input signal and output FFT.  The input signal    *
 *        must be a 16 bit signed integer array. The FFT is retourned as an     *
 *        array of floating-point doubles.                                      *
 *    2 - To calculate the FFT, simply call the Calculate function.             *
 *                                                                              *
 * EQUITEL - C.V. February 2007                                           ALMDI *
 ********************************************************************************/
 
#include "Libreria FFtw\fftw3.h"
 
#pragma once
 
using namespace System;
 
namespace FFTw_wrapper {
 
   public ref class FFTCalculator
    {
      public:
         //Constructor
         FFTCalculator(int NumeroDeMuestras, array<short>^ BufferEntrada, array<double>^ BufferSalida);
         //destructor
         ~FFTCalculator();
         void Calculate();
 
   private:
         int mNumSamples;
         array<short>^  mBufin;
         array<double>^ mBufout;
         fftw_complex *in;     //Internal buffers
         fftw_complex *out;
         fftw_plan p;
    };
}