diff src/OnsetDetectionFunction.h @ 93:4aa362058011

Added Kiss FFT option
author Adam Stark <adamstark.uk@gmail.com>
date Sat, 18 Jun 2016 09:24:13 +0100
parents f6708e4c69f1
children 8fb1610c9192
line wrap: on
line diff
--- a/src/OnsetDetectionFunction.h	Wed May 11 00:19:06 2016 +0100
+++ b/src/OnsetDetectionFunction.h	Sat Jun 18 09:24:13 2016 +0100
@@ -22,7 +22,14 @@
 #ifndef __ONSETDETECTIONFUNCTION_H
 #define __ONSETDETECTIONFUNCTION_H
 
+#ifdef USE_FFTW
 #include "fftw3.h"
+#endif
+
+#ifdef USE_KISS_FFT
+#include "kiss_fft.h"
+#endif
+
 #include <vector>
 
 //=======================================================================
@@ -162,6 +169,8 @@
      */
 	double princarg(double phaseVal);
 	
+    void initialiseFFT();
+    void freeFFT();
 	
 	double pi;							/**< pi, the constant */
 	
@@ -169,11 +178,22 @@
 	int hopSize;						/**< audio hopsize */
 	int onsetDetectionFunctionType;		/**< type of detection function */
     int windowType;                     /**< type of window used in calculations */
-	
+
+    //=======================================================================
+#ifdef USE_FFTW
 	fftw_plan p;						/**< fftw plan */
 	fftw_complex* complexIn;			/**< to hold complex fft values for input */
 	fftw_complex* complexOut;			/**< to hold complex fft values for output */
+#endif
+    
+#ifdef USE_KISS_FFT
+    kiss_fft_cfg cfg;                   /**< Kiss FFT configuration */
+    kiss_fft_cpx* fftIn;                /**< FFT input samples, in complex form */
+    kiss_fft_cpx* fftOut;               /**< FFT output samples, in complex form */
+    std::vector<std::vector<double> > complexOut;
+#endif
 	
+    //=======================================================================
 	bool initialised;					/**< flag indicating whether buffers and FFT plans are initialised */
 
     std::vector<double> frame;          /**< audio frame */