1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org>
4  *
5  * Iterative FFT implementation found in this file is
6  * Copyright (C) 1999 Richard Boulton <richard@tartarus.org>
7  * Richard gave permission to relicense the FFT code under the LGPL.
8  *
9  * Authors: Richard Boulton <richard@tartarus.org>
10  * 	    Dennis Smit <ds@nerds-incorporated.org>
11  *
12  * $Id:
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License as
16  * published by the Free Software Foundation; either version 2.1
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  */
28 
29 #ifndef _LV_FFT_H
30 #define _LV_FFT_H
31 
32 #include <libvisual/lv_common.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
38 #define VISUAL_FFTSTATE(obj)				(VISUAL_CHECK_CAST ((obj), 0, VisFFTState))
39 
40 /**
41  * Private FFT define that contains the log size.
42  */
43 #define VISUAL_FFT_BUFFER_SIZE_LOG 9
44 
45 /**
46  * Private FFT define that contains the buffer size.
47  */
48 #define VISUAL_FFT_BUFFER_SIZE (1 << VISUAL_FFT_BUFFER_SIZE_LOG)
49 
50 typedef struct _VisFFTState VisFFTState;
51 
52 /**
53  * Private structure to contain Fast Fourier Transform states in.
54  */
55 struct _VisFFTState {
56 	VisObject	object;				/**< The VisObject data. */
57 	/* Temporary data stores to perform FFT in. */
58 	float		real[VISUAL_FFT_BUFFER_SIZE];	/**< Private data that is used by the FFT engine. */
59 	float		imag[VISUAL_FFT_BUFFER_SIZE];	/**< Private data that is used by the FFT engine. */
60 };
61 
62 VisFFTState *visual_fft_init (void);
63 void visual_fft_perform (int16_t *input, float *output, VisFFTState *state);
64 
65 #ifdef __cplusplus
66 }
67 #endif /* __cplusplus */
68 
69 #endif /* _LV_FFT_H */
70