zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit bef3e7b138f67b052643edfe7451e54ba026a02c
parent 82cd0bbe9f0749f11981bfa02d3ec9577f31a221
Author: fundamental <[email protected]>
Date:   Sun, 11 Jul 2010 22:56:20 -0400

FFTW: Removing support for fftw 2

* As far as I can tell, fftw is no longer being commonly used
  To anyone who might be affected, it is recommended to use FFTW 3

Diffstat:
Msrc/CMakeLists.txt | 3+--
Msrc/DSP/FFTwrapper.cpp | 38+-------------------------------------
Msrc/DSP/FFTwrapper.h | 19++-----------------
3 files changed, 4 insertions(+), 56 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt @@ -23,7 +23,6 @@ mark_as_advanced(LASH_LIBRARIES) # NOTE: These cache variables should normally not be changed in this # file, but either in in CMakeCache.txt before compile, or by passing # parameters directly into cmake using the -D flag. -SET (FFTW_VERSION 3 CACHE STRING "Version number of FFTW") SET (DefaultOutput oss CACHE STRING "Default Output module: [null, alsa, oss, jack, portaudio]") SET (GuiModule fltk CACHE STRING "GUI module, either fltk, qt or off") @@ -97,7 +96,7 @@ if(LashEnable) message(STATUS "Compiling with lash") endif() -add_definitions(-DFFTW_VERSION_${FFTW_VERSION} +add_definitions( -DASM_F2I_YES -g #TODO #todo put in a better location -Wall diff --git a/src/DSP/FFTwrapper.cpp b/src/DSP/FFTwrapper.cpp @@ -20,7 +20,7 @@ */ -#include <math.h> +#include <cmath> #include "FFTwrapper.h" FFTwrapper::FFTwrapper(int fftsize_) @@ -28,14 +28,6 @@ FFTwrapper::FFTwrapper(int fftsize_) fftsize = fftsize_; tmpfftdata1 = new fftw_real[fftsize]; tmpfftdata2 = new fftw_real[fftsize]; -#ifdef FFTW_VERSION_2 - planfftw = rfftw_create_plan(fftsize, - FFTW_REAL_TO_COMPLEX, - FFTW_ESTIMATE | FFTW_IN_PLACE); - planfftw_inv = rfftw_create_plan(fftsize, - FFTW_COMPLEX_TO_REAL, - FFTW_ESTIMATE | FFTW_IN_PLACE); -#else planfftw = fftw_plan_r2r_1d(fftsize, tmpfftdata1, tmpfftdata1, @@ -46,18 +38,12 @@ FFTwrapper::FFTwrapper(int fftsize_) tmpfftdata2, FFTW_HC2R, FFTW_ESTIMATE); -#endif } FFTwrapper::~FFTwrapper() { -#ifdef FFTW_VERSION_2 - rfftw_destroy_plan(planfftw); - rfftw_destroy_plan(planfftw_inv); -#else fftw_destroy_plan(planfftw); fftw_destroy_plan(planfftw_inv); -#endif delete [] tmpfftdata1; delete [] tmpfftdata2; @@ -68,16 +54,6 @@ FFTwrapper::~FFTwrapper() */ void FFTwrapper::smps2freqs(REALTYPE *smps, FFTFREQS freqs) { -#ifdef FFTW_VERSION_2 - for(int i = 0; i < fftsize; i++) - tmpfftdata1[i] = smps[i]; - rfftw_one(planfftw, tmpfftdata1, tmpfftdata2); - for(int i = 0; i < fftsize / 2; i++) { - freqs.c[i] = tmpfftdata2[i]; - if(i != 0) - freqs.s[i] = tmpfftdata2[fftsize - i]; - } -#else for(int i = 0; i < fftsize; i++) tmpfftdata1[i] = smps[i]; fftw_execute(planfftw); @@ -86,7 +62,6 @@ void FFTwrapper::smps2freqs(REALTYPE *smps, FFTFREQS freqs) if(i != 0) freqs.s[i] = tmpfftdata1[fftsize - i]; } -#endif tmpfftdata2[fftsize / 2] = 0.0; } @@ -96,16 +71,6 @@ void FFTwrapper::smps2freqs(REALTYPE *smps, FFTFREQS freqs) void FFTwrapper::freqs2smps(FFTFREQS freqs, REALTYPE *smps) { tmpfftdata2[fftsize / 2] = 0.0; -#ifdef FFTW_VERSION_2 - for(int i = 0; i < fftsize / 2; i++) { - tmpfftdata1[i] = freqs.c[i]; - if(i != 0) - tmpfftdata1[fftsize - i] = freqs.s[i]; - } - rfftw_one(planfftw_inv, tmpfftdata1, tmpfftdata2); - for(int i = 0; i < fftsize; i++) - smps[i] = tmpfftdata2[i]; -#else for(int i = 0; i < fftsize / 2; i++) { tmpfftdata2[i] = freqs.c[i]; if(i != 0) @@ -114,7 +79,6 @@ void FFTwrapper::freqs2smps(FFTFREQS freqs, REALTYPE *smps) fftw_execute(planfftw_inv); for(int i = 0; i < fftsize; i++) smps[i] = tmpfftdata2[i]; -#endif } void newFFTFREQS(FFTFREQS *f, int size) diff --git a/src/DSP/FFTwrapper.h b/src/DSP/FFTwrapper.h @@ -25,24 +25,9 @@ #include "../globals.h" -#ifdef FFTW_VERSION_2 - -#include <fftw.h> - -/* If you got error messages about rfftw.h, replace the next include line with "#include <srfftw.h>" -or with "#include <drfftw.h> (if one doesn't work try the other). It may be necessary to replace -the <fftw.h> with <dfftw.h> or <sfftw.h>. If the neither one doesn't work, -please install latest version of fftw(recomanded from the sources) from www.fftw.org. -If you'll install fftw3 you need to change the Makefile.inc -Hope all goes right." */ -#include <rfftw.h> - -#else - #include <fftw3.h> -#define fftw_real double -#define rfftw_plan fftw_plan -#endif +typedef double fftw_real; +typedef fftw_plan rfftw_plan; /**A wrapper for the FFTW library (Fast Fourier Transforms)*/ class FFTwrapper