1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

Fixed GLSpectrumSettings

This commit is contained in:
f4exb 2020-04-30 14:42:57 +02:00
parent 4d9d804f97
commit 84e44a0948
3 changed files with 11 additions and 5 deletions

View File

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "fftwindow.h"
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "glspectrumsettings.h" #include "glspectrumsettings.h"
@ -56,7 +55,7 @@ QByteArray GLSpectrumSettings::serialize() const
s.writeS32(1, m_fftSize); s.writeS32(1, m_fftSize);
s.writeS32(2, m_fftOverlap); s.writeS32(2, m_fftOverlap);
s.writeS32(3, m_fftWindow); s.writeS32(3, (int) m_fftWindow);
s.writeReal(4, m_refLevel); s.writeReal(4, m_refLevel);
s.writeReal(5, m_powerRange); s.writeReal(5, m_powerRange);
s.writeBool(6, m_displayWaterfall); s.writeBool(6, m_displayWaterfall);
@ -94,7 +93,8 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
{ {
d.readS32(1, &m_fftSize, 1024); d.readS32(1, &m_fftSize, 1024);
d.readS32(2, &m_fftOverlap, 0); d.readS32(2, &m_fftOverlap, 0);
d.readS32(3, &m_fftWindow, FFTWindow::Hanning); d.readS32(3, &tmp, (int) FFTWindow::Hanning);
m_fftWindow = (FFTWindow::Function) tmp;
d.readReal(4, &m_refLevel, 0); d.readReal(4, &m_refLevel, 0);
d.readReal(5, &m_powerRange, 100); d.readReal(5, &m_powerRange, 100);
d.readBool(6, &m_displayWaterfall, true); d.readBool(6, &m_displayWaterfall, true);

View File

@ -15,10 +15,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_DSP_GLSPECTRUMSETTNGS_H
#define SDRBASE_DSP_GLSPECTRUMSETTNGS_H
#include <QByteArray> #include <QByteArray>
#include "export.h" #include "export.h"
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "dsp/fftwindow.h"
#include "settings/serializable.h" #include "settings/serializable.h"
class SDRBASE_API GLSpectrumSettings : public Serializable class SDRBASE_API GLSpectrumSettings : public Serializable
@ -34,7 +38,7 @@ public:
int m_fftSize; int m_fftSize;
int m_fftOverlap; int m_fftOverlap;
int m_fftWindow; FFTWindow::Function m_fftWindow;
Real m_refLevel; Real m_refLevel;
Real m_powerRange; Real m_powerRange;
int m_decay; int m_decay;
@ -67,3 +71,5 @@ public:
static int getAveragingValue(int averagingIndex, AveragingMode averagingMode); static int getAveragingValue(int averagingIndex, AveragingMode averagingMode);
static int getAveragingIndex(int averagingValue, AveragingMode averagingMode); static int getAveragingIndex(int averagingValue, AveragingMode averagingMode);
}; };
#endif // SDRBASE_DSP_GLSPECTRUMSETTNGS_H

View File

@ -259,7 +259,7 @@ void WebAPIAdapterBase::webapiUpdatePreset(
spectrumSettings.m_fftSize = apiPreset->getSpectrumConfig()->getFftSize(); spectrumSettings.m_fftSize = apiPreset->getSpectrumConfig()->getFftSize();
} }
if (spectrumIt->contains("fftWindow")) { if (spectrumIt->contains("fftWindow")) {
spectrumSettings.m_fftWindow = apiPreset->getSpectrumConfig()->getFftWindow(); spectrumSettings.m_fftWindow = (FFTWindow::Function) apiPreset->getSpectrumConfig()->getFftWindow();
} }
if (spectrumIt->contains("histogramStroke")) { if (spectrumIt->contains("histogramStroke")) {
spectrumSettings.m_histogramStroke = apiPreset->getSpectrumConfig()->getHistogramStroke(); spectrumSettings.m_histogramStroke = apiPreset->getSpectrumConfig()->getHistogramStroke();