mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-25 10:28:28 +01:00
Changed the FFT scaling
This commit is contained in:
parent
3e9e6de16d
commit
d0c14efbd1
@ -62,17 +62,13 @@ float* tempFFT;
|
|||||||
float* FFTdata;
|
float* FFTdata;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
bool experimentalZoom = false;
|
bool experimentalZoom = false;
|
||||||
bool lazyDb = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
void fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
||||||
memcpy(fft_in, samples, count * sizeof(dsp::complex_t));
|
memcpy(fft_in, samples, count * sizeof(dsp::complex_t));
|
||||||
fftwf_execute(p);
|
fftwf_execute(p);
|
||||||
int half = count / 2;
|
int half = count / 2;
|
||||||
|
|
||||||
volk_32fc_s32f_power_spectrum_32f(tempFFT, (lv_32fc_t*)fft_out, count, count);
|
volk_32fc_s32f_power_spectrum_32f(FFTdata, (lv_32fc_t*)fft_out, count, count);
|
||||||
volk_32f_s32f_multiply_32f(FFTdata, tempFFT, lazyDb ? 1.0f : 0.5f, count);
|
|
||||||
|
|
||||||
memcpy(tempFFT, &FFTdata[half], half * sizeof(float));
|
memcpy(tempFFT, &FFTdata[half], half * sizeof(float));
|
||||||
memmove(&FFTdata[half], FFTdata, half * sizeof(float));
|
memmove(&FFTdata[half], FFTdata, half * sizeof(float));
|
||||||
@ -560,8 +556,6 @@ void drawWindow() {
|
|||||||
spdlog::error("Will this make the software crash?");
|
spdlog::error("Will this make the software crash?");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Checkbox("Lazy dB Measurement", &lazyDb);
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +599,7 @@ void drawWindow() {
|
|||||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Max").x / 2.0));
|
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Max").x / 2.0));
|
||||||
ImGui::Text("Max");
|
ImGui::Text("Max");
|
||||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
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<float>(fftMax, fftMin + 10);
|
fftMax = std::max<float>(fftMax, fftMin + 10);
|
||||||
core::configManager.aquire();
|
core::configManager.aquire();
|
||||||
core::configManager.conf["max"] = fftMax;
|
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::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - (ImGui::CalcTextSize("Min").x / 2.0));
|
||||||
ImGui::Text("Min");
|
ImGui::Text("Min");
|
||||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
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<float>(fftMax - 10, fftMin);
|
fftMin = std::min<float>(fftMax - 10, fftMin);
|
||||||
core::configManager.aquire();
|
core::configManager.aquire();
|
||||||
core::configManager.conf["min"] = fftMin;
|
core::configManager.conf["min"] = fftMin;
|
||||||
|
Loading…
Reference in New Issue
Block a user