00001 /***************************************************************************** 00002 * fft.h: Headers for iterative implementation of a FFT 00003 ***************************************************************************** 00004 * $Id$ 00005 * 00006 * Mainly taken from XMMS's code 00007 * 00008 * Authors: Richard Boulton <richard@tartarus.org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00023 *****************************************************************************/ 00024 00025 #ifndef _FFT_H_ 00026 #define _FFT_H_ 00027 00028 #define FFT_BUFFER_SIZE_LOG 9 00029 00030 #define FFT_BUFFER_SIZE (1 << FFT_BUFFER_SIZE_LOG) 00031 00032 /* sound sample - should be an signed 16 bit value */ 00033 typedef short int sound_sample; 00034 00035 struct _struct_fft_state { 00036 /* Temporary data stores to perform FFT in. */ 00037 float real[FFT_BUFFER_SIZE]; 00038 float imag[FFT_BUFFER_SIZE]; 00039 00040 /* */ 00041 unsigned int bitReverse[FFT_BUFFER_SIZE]; 00042 00043 /* The next two tables could be made to use less space in memory, since they 00044 * overlap hugely, but hey. */ 00045 float sintable[FFT_BUFFER_SIZE / 2]; 00046 float costable[FFT_BUFFER_SIZE / 2]; 00047 }; 00048 00049 /* FFT prototypes */ 00050 typedef struct _struct_fft_state fft_state; 00051 fft_state *visual_fft_init (void); 00052 void fft_perform (const sound_sample *input, float *output, fft_state *state); 00053 void fft_close (fft_state *state); 00054 00055 00056 #endif /* _FFT_H_ */
1.5.1