Audaspace  1.3.0
A high level audio library.
FFTPlan.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2015-2016 Juan Francisco Crespo Galán
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16 
17 #pragma once
18 
25 #include <complex>
26 #include <fftw3.h>
27 #include "Audaspace.h"
28 
29 #include <memory>
30 #include <vector>
31 
33 #define DEFAULT_N 4096
34 
36 
41 {
42 private:
46  int m_N;
47 
51  fftwf_plan m_fftPlanR2C;
52 
56  fftwf_plan m_fftPlanC2R;
57 
61  unsigned int m_bufferSize;
62 
63  // delete copy constructor and operator=
64  FFTPlan(const FFTPlan&) = delete;
65  FFTPlan& operator=(const FFTPlan&) = delete;
66 
67 public:
73  FFTPlan(double measureTime = 0);
74 
85  FFTPlan(int n, double measureTime = 0);
86  ~FFTPlan();
87 
92  int getSize();
93 
98  void FFT(void* buffer);
99 
104  void IFFT(void* buffer);
105 
111  void* getBuffer();
112 
117  void freeBuffer(void* buffer);
118 };
119 
FFTPlan::FFTPlan
FFTPlan(int n, double measureTime=0)
Creates a new FFTPlan object with a custom size.
FFTPlan::FFTPlan
FFTPlan(double measureTime=0)
Creates a new FFTPlan object with DEFAULT_N size (4096).
FFTPlan::getBuffer
void * getBuffer()
Reserves memory for a buffer that can be used for inplace transformations with this plan.
FFTPlan::FFT
void FFT(void *buffer)
Calculates the FFT of an input buffer with the current plan.
FFTPlan::getSize
int getSize()
Retrieves the size of the FFT plan.
FFTPlan
Thas class represents an plan object that allows to calculate FFTs and IFFTs.
Definition: FFTPlan.h:41
FFTPlan::IFFT
void IFFT(void *buffer)
Calculates the IFFT of an input buffer with the current plan.
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
FFTPlan::freeBuffer
void freeBuffer(void *buffer)
Frees one of the buffers reserved with the getRealOnlyBuffer(), getComplexOnlyBuffer() or getInplaceB...
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
AUD_API
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
Audaspace.h
The main header file of the library defining the namespace and basic data types.