From 3aad8388868bbacc8cfda09a3a3ab640b769aa8d Mon Sep 17 00:00:00 2001 From: xufulong Date: Sun, 19 Sep 2021 15:33:12 +0800 Subject: [PATCH] Adjust: init data --- app/src/main/cpp/audio_player.cpp | 3 --- app/src/main/cpp/visualizer/execute_fft.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/audio_player.cpp b/app/src/main/cpp/audio_player.cpp index c4fe739..46861b7 100644 --- a/app/src/main/cpp/audio_player.cpp +++ b/app/src/main/cpp/audio_player.cpp @@ -286,9 +286,6 @@ AUDIO_PLAYER_FUNC(void, play, jstring input_jstr, jstring filter_jstr) { jmethodID fft_method = env->GetMethodID(player_class, "fftCallbackFromJNI", "([S)V"); auto *fft_filter = static_cast(malloc(sizeof(filter_sys_t))); - fft_filter->nb_samples = 0; - fft_filter->data_size = 0; - fft_filter->data = nullptr; init_visualizer(fft_filter); //read audio frame diff --git a/app/src/main/cpp/visualizer/execute_fft.c b/app/src/main/cpp/visualizer/execute_fft.c index c3eec67..a7c4bea 100644 --- a/app/src/main/cpp/visualizer/execute_fft.c +++ b/app/src/main/cpp/visualizer/execute_fft.c @@ -203,6 +203,9 @@ int init_visualizer(filter_sys_t *p_filter) /* Fetch the FFT window parameters */ window_get_param(&p_filter->wind_param); + p_filter->data = NULL; + p_filter->data_size = 0; + p_filter->nb_samples = 0; p_filter->out_samples = FFT_BUFFER_SIZE; p_filter->output = (int16_t *) (malloc(p_filter->out_samples * sizeof(int16_t))); return 0;