| 748 | } |
| 749 | |
| 750 | int get_window (int window_function, int window_len, double *output_window) |
| 751 | { |
| 752 | if ((window_len <= 0) || (window_function < 0) || (output_window == NULL)) |
| 753 | { |
| 754 | data_logger->error ("Please check the arguments: data_len must be > 0, window_function >= " |
| 755 | "0 and output_window cannot be empty."); |
| 756 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 757 | } |
| 758 | // from https://www.edn.com/windowing-functions-improve-fft-results-part-i/ |
| 759 | switch (static_cast<WindowOperations> (window_function)) |
| 760 | { |
| 761 | case WindowOperations::NO_WINDOW: |
| 762 | no_window_function (window_len, output_window); |
| 763 | break; |
| 764 | case WindowOperations::HAMMING: |
| 765 | hamming_function (window_len, output_window); |
| 766 | break; |
| 767 | case WindowOperations::HANNING: |
| 768 | hanning_function (window_len, output_window); |
| 769 | break; |
| 770 | case WindowOperations::BLACKMAN_HARRIS: |
| 771 | blackman_harris_function (window_len, output_window); |
| 772 | break; |
| 773 | default: |
| 774 | data_logger->error ("Invalid Window function. Window function:{}", window_function); |
| 775 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 776 | } |
| 777 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 778 | } |
| 779 | |
| 780 | int perform_fft ( |
| 781 | double *data, int data_len, int window_function, double *output_re, double *output_im) |
no test coverage detected