1
0

fft.h 2.2 KB

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