Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

51 line
1.3KB

  1. #ifndef analyze_fft256_h_
  2. #define analyze_fft256_h_
  3. #include "AudioStream.h"
  4. #include "arm_math.h"
  5. // windows.c
  6. extern "C" {
  7. extern const int16_t AudioWindowHanning256[];
  8. extern const int16_t AudioWindowBartlett256[];
  9. extern const int16_t AudioWindowBlackman256[];
  10. extern const int16_t AudioWindowFlattop256[];
  11. extern const int16_t AudioWindowBlackmanHarris256[];
  12. extern const int16_t AudioWindowNuttall256[];
  13. extern const int16_t AudioWindowBlackmanNuttall256[];
  14. extern const int16_t AudioWindowWelch256[];
  15. extern const int16_t AudioWindowHamming256[];
  16. extern const int16_t AudioWindowCosine256[];
  17. extern const int16_t AudioWindowTukey256[];
  18. }
  19. class AudioAnalyzeFFT256 : public AudioStream
  20. {
  21. public:
  22. AudioAnalyzeFFT256(uint8_t navg = 8, const int16_t *win = AudioWindowHanning256)
  23. : AudioStream(1, inputQueueArray), window(win),
  24. prevblock(NULL), count(0), naverage(navg), outputflag(false) { init(); }
  25. bool available() {
  26. if (outputflag == true) {
  27. outputflag = false;
  28. return true;
  29. }
  30. return false;
  31. }
  32. virtual void update(void);
  33. //uint32_t cycles;
  34. int32_t output[128] __attribute__ ((aligned (4)));
  35. private:
  36. void init(void);
  37. const int16_t *window;
  38. audio_block_t *prevblock;
  39. int16_t buffer[512] __attribute__ ((aligned (4)));
  40. uint8_t count;
  41. uint8_t naverage;
  42. bool outputflag;
  43. audio_block_t *inputQueueArray[1];
  44. };
  45. #endif