From 423b590d7ccd4fe194961d07655fdf05ceec6a6c Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 14 Dec 2015 19:31:18 -0500 Subject: [PATCH] Fix off-by-one error and missing modem bw defaults --- CMakeLists.txt | 2 +- src/AppFrame.cpp | 1 + src/process/SpectrumVisualProcessor.cpp | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ebf15d..1ab7f52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.8) SET(CUBICSDR_VERSION_MAJOR "0") SET(CUBICSDR_VERSION_MINOR "1") -SET(CUBICSDR_VERSION_PATCH "19") +SET(CUBICSDR_VERSION_PATCH "20") SET(CUBICSDR_VERSION_REL "alpha") SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}-${CUBICSDR_VERSION_REL}") diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 64dec47..c7ded84 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -984,6 +984,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) { // basic demodulators if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) { mgr->setLastDemodulatorType(dSelection); + mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection)); demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB"); } #endif diff --git a/src/process/SpectrumVisualProcessor.cpp b/src/process/SpectrumVisualProcessor.cpp index 68ec134..e0dcd9b 100644 --- a/src/process/SpectrumVisualProcessor.cpp +++ b/src/process/SpectrumVisualProcessor.cpp @@ -404,7 +404,8 @@ void SpectrumVisualProcessor::process() { double visualStart = (double(fftSizeInternal) / 2.0) - (double(fftSizeInternal) * (visualRatio / 2.0)); double visualAccum = 0; double acc = 0, accCount = 0, i = 0; - + + for (int x = 0, xMax = output->spectrum_points.size() / 2; x < xMax; x++) { visualAccum += visualRatio * double(SPECTRUM_VZM); // while (visualAccum >= 1.0) { @@ -420,8 +421,8 @@ void SpectrumVisualProcessor::process() { if (idx < 0) { idx = 0; } - if (idx > fftSizeInternal) { - idx = fftSizeInternal; + if (idx > fftSizeInternal-1) { + idx = fftSizeInternal-1; } acc += fft_result_maa[idx]; accCount += 1.0;