From a6381fcfc6401f8d02107acfb1d77864be6a2584 Mon Sep 17 00:00:00 2001 From: xufuji456 <839789740@qq.com> Date: Mon, 27 Sep 2021 00:11:02 +0800 Subject: [PATCH] using macro define --- app/src/main/cpp/visualizer/execute_fft.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/cpp/visualizer/execute_fft.cpp b/app/src/main/cpp/visualizer/execute_fft.cpp index e38febe..2b712d4 100644 --- a/app/src/main/cpp/visualizer/execute_fft.cpp +++ b/app/src/main/cpp/visualizer/execute_fft.cpp @@ -202,11 +202,11 @@ int init_visualizer(filter_sys_t *p_filter) p_filter->data = nullptr; p_filter->data_size = 0; p_filter->nb_samples = 0; - if (FIXED_FFT) { - p_filter->out_samples = 1 << 9; - } else { - p_filter->out_samples = FFT_BUFFER_SIZE; - } +#ifdef FIXED_FFT + p_filter->out_samples = 512; +#else + p_filter->out_samples = FFT_BUFFER_SIZE; +#endif p_filter->output = (int8_t *) (malloc(p_filter->out_samples * sizeof(int8_t))); return 0; } @@ -386,9 +386,9 @@ release: void fft_once(filter_sys_t *p_sys) { - if (FIXED_FFT) { - fft_fixed(p_sys); - } else { - fft_float(p_sys); - } +#ifdef FIXED_FFT + fft_fixed(p_sys); +#else + fft_float(p_sys); +#endif }