1 /*
2   LICENSE
3   -------
4 Copyright 2005-2013 Nullsoft, Inc.
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10   * Redistributions of source code must retain the above copyright notice,
11     this list of conditions and the following disclaimer.
12 
13   * Redistributions in binary form must reproduce the above copyright notice,
14     this list of conditions and the following disclaimer in the documentation
15     and/or other materials provided with the distribution.
16 
17   * Neither the name of Nullsoft nor the names of its contributors may be used to
18     endorse or promote products derived from this software without specific prior written permission.
19 
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
21 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 
30 #ifndef __NULLSOFT_DX9_PLUGIN_SHELL_FFT_H__
31 #define __NULLSOFT_DX9_PLUGIN_SHELL_FFT_H__ 1
32 
33 class FFT
34 {
35 public:
36     FFT();
37     ~FFT();
38     void Init(int samples_in, int samples_out, int bEqualize=1, float envelope_power=1.0f);
39     void time_to_frequency_domain(float *in_wavedata, float *out_spectraldata);
GetNumFreq()40     int  GetNumFreq() { return NFREQ; };
41     void CleanUp();
42 private:
43     int m_ready;
44     int m_samples_in;
45     int NFREQ;
46 
47     void InitEnvelopeTable(float power);
48     void InitEqualizeTable();
49     void InitBitRevTable();
50     void InitCosSinTable();
51 
52     int   *bitrevtable;
53     float *envelope;
54     float *equalize;
55     float *temp1;
56     float *temp2;
57     float (*cossintable)[2];
58 };
59 
60 #endif