From d0c14efbd19e573e38c6e613b60acbd9ce410c40 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Fri, 12 Feb 2021 23:11:57 +0100 Subject: [PATCH] Changed the FFT scaling --- core/src/gui/main_window.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 0ca91d7..8a11068 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -62,17 +62,13 @@ float* tempFFT; float* FFTdata; char buf[1024]; bool experimentalZoom = false; -bool lazyDb = false; - - void fftHandler(dsp::complex_t* samples, int count, void* ctx) { memcpy(fft_in, samples, count * sizeof(dsp::complex_t)); fftwf_execute(p); int half = count / 2; - volk_32fc_s32f_power_spectrum_32f(tempFFT, (lv_32fc_t*)fft_out, count, count); - volk_32f_s32f_multiply_32f(FFTdata, tempFFT, lazyDb ? 1.0f : 0.5f, count); + volk_32fc_s32f_power_spectrum_32f(FFTdata, (lv_32fc_t*)fft_out, count, count); memcpy(tempFFT, &FFTdata[half], half * sizeof(float)); memmove(&FFTdata[half], FFTdata, half * sizeof(float)); @@ -560,8 +556,6 @@ void drawWindow() { spdlog::error("Will this make the software crash?"); } - ImGui::Checkbox("Lazy dB Measurement", &lazyDb); - ImGui::Spacing(); } @@ -605,7 +599,7 @@ void drawWindow() { ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Max").x / 2.0)); ImGui::Text("Max"); ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10); - if (ImGui::VSliderFloat("##_8_", ImVec2(20.0, 150.0), &fftMax, 0.0, lazyDb ? -160.0f : -100.0f, "")) { + if (ImGui::VSliderFloat("##_8_", ImVec2(20.0, 150.0), &fftMax, 0.0, -160.0f, "")) { fftMax = std::max(fftMax, fftMin + 10); core::configManager.aquire(); core::configManager.conf["max"] = fftMax; @@ -617,7 +611,7 @@ void drawWindow() { ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Min").x / 2.0)); ImGui::Text("Min"); ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10); - if (ImGui::VSliderFloat("##_9_", ImVec2(20.0, 150.0), &fftMin, 0.0, lazyDb ? -160.0f : -100.0f, "")) { + if (ImGui::VSliderFloat("##_9_", ImVec2(20.0, 150.0), &fftMin, 0.0, -160.0f, "")) { fftMin = std::min(fftMax - 10, fftMin); core::configManager.aquire(); core::configManager.conf["min"] = fftMin;