mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
Rename GLSpectrumSettings to SpectrumSettings
This commit is contained in:
parent
15d1584e1f
commit
986b6f3711
@ -23,7 +23,7 @@
|
||||
InterferometerWebAPIAdapter::InterferometerWebAPIAdapter()
|
||||
{
|
||||
m_settings.setScopeGUI(&m_glScopeSettings);
|
||||
m_settings.setSpectrumGUI(&m_glSpectrumSettings);
|
||||
m_settings.setSpectrumGUI(&m_SpectrumSettings);
|
||||
}
|
||||
|
||||
InterferometerWebAPIAdapter::~InterferometerWebAPIAdapter()
|
||||
@ -36,7 +36,7 @@ int InterferometerWebAPIAdapter::webapiSettingsGet(
|
||||
(void) errorMessage;
|
||||
response.setInterferometerSettings(new SWGSDRangel::SWGInterferometerSettings());
|
||||
response.getInterferometerSettings()->init();
|
||||
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_glSpectrumSettings);
|
||||
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_SpectrumSettings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ void InterferometerWebAPIAdapter::webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const InterferometerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings)
|
||||
const SpectrumSettings& spectrumSettings)
|
||||
{
|
||||
response.getInterferometerSettings()->setCorrelationType((int) settings.m_correlationType);
|
||||
response.getInterferometerSettings()->setRgbColor(settings.m_rgbColor);
|
||||
@ -120,7 +120,7 @@ void InterferometerWebAPIAdapter::webapiFormatChannelSettings(
|
||||
swgSpectrum->init();
|
||||
response.getInterferometerSettings()->setSpectrumConfig(swgSpectrum);
|
||||
swgSpectrum->setAveragingMode((int) spectrumSettings.m_averagingMode);
|
||||
swgSpectrum->setAveragingValue(GLSpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode));
|
||||
swgSpectrum->setAveragingValue(SpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode));
|
||||
swgSpectrum->setDecay(spectrumSettings.m_decay);
|
||||
swgSpectrum->setDecayDivisor(spectrumSettings.m_decayDivisor);
|
||||
swgSpectrum->setDisplayCurrent(spectrumSettings.m_displayCurrent ? 1 : 0);
|
||||
@ -143,14 +143,14 @@ int InterferometerWebAPIAdapter::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) force; // no action
|
||||
(void) errorMessage;
|
||||
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_glSpectrumSettings, channelSettingsKeys, response);
|
||||
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_SpectrumSettings, channelSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void InterferometerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
InterferometerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
SpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response)
|
||||
{
|
||||
@ -330,12 +330,12 @@ void InterferometerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("spectrumConfig"))
|
||||
{
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingMode")) {
|
||||
spectrumSettings.m_averagingMode = (GLSpectrumSettings::AveragingMode) response.getInterferometerSettings()->getSpectrumConfig()->getAveragingMode();
|
||||
spectrumSettings.m_averagingMode = (SpectrumSettings::AveragingMode) response.getInterferometerSettings()->getSpectrumConfig()->getAveragingMode();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingValue"))
|
||||
{
|
||||
spectrumSettings.m_averagingValue = response.getInterferometerSettings()->getSpectrumConfig()->getAveragingValue();
|
||||
spectrumSettings.m_averagingIndex = GLSpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
spectrumSettings.m_averagingIndex = SpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.decay")) {
|
||||
spectrumSettings.m_decay = response.getInterferometerSettings()->getSpectrumConfig()->getDecay();
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "channel/channelwebapiadapter.h"
|
||||
#include "dsp/glscopesettings.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "interferometersettings.h"
|
||||
|
||||
/**
|
||||
@ -48,19 +48,19 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const InterferometerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings);
|
||||
const SpectrumSettings& spectrumSettings);
|
||||
|
||||
static void webapiUpdateChannelSettings(
|
||||
InterferometerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
SpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response);
|
||||
|
||||
private:
|
||||
InterferometerSettings m_settings;
|
||||
GLScopeSettings m_glScopeSettings;
|
||||
GLSpectrumSettings m_glSpectrumSettings;
|
||||
SpectrumSettings m_SpectrumSettings;
|
||||
|
||||
static int qColorToInt(const QColor& color);
|
||||
static QColor intToQColor(int intColor);
|
||||
|
@ -23,7 +23,7 @@
|
||||
ChannelAnalyzerWebAPIAdapter::ChannelAnalyzerWebAPIAdapter()
|
||||
{
|
||||
m_settings.setScopeGUI(&m_glScopeSettings);
|
||||
m_settings.setSpectrumGUI(&m_glSpectrumSettings);
|
||||
m_settings.setSpectrumGUI(&m_SpectrumSettings);
|
||||
}
|
||||
|
||||
ChannelAnalyzerWebAPIAdapter::~ChannelAnalyzerWebAPIAdapter()
|
||||
@ -36,7 +36,7 @@ int ChannelAnalyzerWebAPIAdapter::webapiSettingsGet(
|
||||
(void) errorMessage;
|
||||
response.setChannelAnalyzerSettings(new SWGSDRangel::SWGChannelAnalyzerSettings());
|
||||
response.getChannelAnalyzerSettings()->init();
|
||||
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_glSpectrumSettings);
|
||||
webapiFormatChannelSettings(response, m_settings, m_glScopeSettings, m_SpectrumSettings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const ChannelAnalyzerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings)
|
||||
const SpectrumSettings& spectrumSettings)
|
||||
{
|
||||
response.getChannelAnalyzerSettings()->setFrequency(settings.m_inputFrequencyOffset);
|
||||
response.getChannelAnalyzerSettings()->setDownSample(settings.m_rationalDownSample ? 1 : 0);
|
||||
@ -136,7 +136,7 @@ void ChannelAnalyzerWebAPIAdapter::webapiFormatChannelSettings(
|
||||
swgSpectrum->init();
|
||||
response.getChannelAnalyzerSettings()->setSpectrumConfig(swgSpectrum);
|
||||
swgSpectrum->setAveragingMode((int) spectrumSettings.m_averagingMode);
|
||||
swgSpectrum->setAveragingValue(GLSpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode));
|
||||
swgSpectrum->setAveragingValue(SpectrumSettings::getAveragingValue(spectrumSettings.m_averagingIndex, spectrumSettings.m_averagingMode));
|
||||
swgSpectrum->setDecay(spectrumSettings.m_decay);
|
||||
swgSpectrum->setDecayDivisor(spectrumSettings.m_decayDivisor);
|
||||
swgSpectrum->setDisplayCurrent(spectrumSettings.m_displayCurrent ? 1 : 0);
|
||||
@ -159,14 +159,14 @@ int ChannelAnalyzerWebAPIAdapter::webapiSettingsPutPatch(
|
||||
{
|
||||
(void) force;
|
||||
(void) errorMessage;
|
||||
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_glSpectrumSettings, channelSettingsKeys, response);
|
||||
webapiUpdateChannelSettings(m_settings, m_glScopeSettings, m_SpectrumSettings, channelSettingsKeys, response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
ChannelAnalyzerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
SpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response)
|
||||
{
|
||||
@ -394,12 +394,12 @@ void ChannelAnalyzerWebAPIAdapter::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("spectrumConfig"))
|
||||
{
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingMode")) {
|
||||
spectrumSettings.m_averagingMode = (GLSpectrumSettings::AveragingMode) response.getChannelAnalyzerSettings()->getSpectrumConfig()->getAveragingMode();
|
||||
spectrumSettings.m_averagingMode = (SpectrumSettings::AveragingMode) response.getChannelAnalyzerSettings()->getSpectrumConfig()->getAveragingMode();
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.averagingValue"))
|
||||
{
|
||||
spectrumSettings.m_averagingValue = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getAveragingValue();
|
||||
spectrumSettings.m_averagingIndex = GLSpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
spectrumSettings.m_averagingIndex = SpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
}
|
||||
if (channelSettingsKeys.contains("spectrumConfig.decay")) {
|
||||
spectrumSettings.m_decay = response.getChannelAnalyzerSettings()->getSpectrumConfig()->getDecay();
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "channel/channelwebapiadapter.h"
|
||||
#include "dsp/glscopesettings.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "chanalyzersettings.h"
|
||||
|
||||
/**
|
||||
@ -48,19 +48,19 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const ChannelAnalyzerSettings& settings,
|
||||
const GLScopeSettings& scopeSettings,
|
||||
const GLSpectrumSettings& spectrumSettings);
|
||||
const SpectrumSettings& spectrumSettings);
|
||||
|
||||
static void webapiUpdateChannelSettings(
|
||||
ChannelAnalyzerSettings& settings,
|
||||
GLScopeSettings& scopeSettings,
|
||||
GLSpectrumSettings& spectrumSettings,
|
||||
SpectrumSettings& spectrumSettings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response);
|
||||
|
||||
private:
|
||||
ChannelAnalyzerSettings m_settings;
|
||||
GLScopeSettings m_glScopeSettings;
|
||||
GLSpectrumSettings m_glSpectrumSettings;
|
||||
SpectrumSettings m_SpectrumSettings;
|
||||
|
||||
static int qColorToInt(const QColor& color);
|
||||
static QColor intToQColor(int intColor);
|
||||
|
@ -102,7 +102,7 @@ void BFMDemod::start()
|
||||
m_basebandSink->reset();
|
||||
m_thread->start();
|
||||
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = true;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(msg);
|
||||
|
@ -112,7 +112,7 @@ void ChirpChatDemod::start()
|
||||
m_basebandSink->reset();
|
||||
m_thread->start();
|
||||
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = true;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(msg);}
|
||||
|
@ -95,7 +95,7 @@ void FreeDVDemod::start()
|
||||
m_basebandSink->reset();
|
||||
m_thread->start();
|
||||
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = true;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(msg);
|
||||
|
@ -229,7 +229,7 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force)
|
||||
|| (settings.m_rfBandwidth != m_settings.m_rfBandwidth)
|
||||
|| (settings.m_lowCutoff != m_settings.m_lowCutoff) || force)
|
||||
{
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = !settings.m_dsb;
|
||||
spectrumSettings.m_usb = (settings.m_lowCutoff < settings.m_rfBandwidth);
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
|
@ -93,7 +93,7 @@ void FreeDVMod::start()
|
||||
m_basebandSource->reset();
|
||||
m_thread->start();
|
||||
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = true;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(msg);
|
||||
|
@ -304,7 +304,7 @@ void SSBMod::applySettings(const SSBModSettings& settings, bool force)
|
||||
if ((settings.m_dsb != m_settings.m_dsb)
|
||||
|| (settings.m_usb != m_settings.m_usb) || force)
|
||||
{
|
||||
GLSpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = !settings.m_dsb;
|
||||
spectrumSettings.m_usb = settings.m_usb;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
|
@ -124,7 +124,7 @@ set(sdrbase_SOURCES
|
||||
dsp/freqlockcomplex.cpp
|
||||
dsp/interpolator.cpp
|
||||
dsp/glscopesettings.cpp
|
||||
dsp/glspectrumsettings.cpp
|
||||
dsp/spectrumsettings.cpp
|
||||
dsp/goertzel.cpp
|
||||
dsp/hbfilterchainconverter.cpp
|
||||
dsp/hbfiltertraits.cpp
|
||||
@ -295,7 +295,7 @@ set(sdrbase_HEADERS
|
||||
dsp/gfft.h
|
||||
dsp/glscopesettings.h
|
||||
dsp/glspectruminterface.h
|
||||
dsp/glspectrumsettings.h
|
||||
dsp/spectrumsettings.h
|
||||
dsp/goertzel.h
|
||||
dsp/hbfilterchainconverter.h
|
||||
dsp/iirfilter.h
|
||||
|
@ -16,18 +16,18 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "glspectrumsettings.h"
|
||||
#include "spectrumsettings.h"
|
||||
|
||||
GLSpectrumSettings::GLSpectrumSettings()
|
||||
SpectrumSettings::SpectrumSettings()
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
GLSpectrumSettings::~GLSpectrumSettings()
|
||||
SpectrumSettings::~SpectrumSettings()
|
||||
{}
|
||||
|
||||
|
||||
void GLSpectrumSettings::resetToDefaults()
|
||||
void SpectrumSettings::resetToDefaults()
|
||||
{
|
||||
m_fftSize = 1024;
|
||||
m_fftOverlap = 0;
|
||||
@ -57,7 +57,7 @@ void GLSpectrumSettings::resetToDefaults()
|
||||
m_wsSpectrumPort = 8887;
|
||||
}
|
||||
|
||||
QByteArray GLSpectrumSettings::serialize() const
|
||||
QByteArray SpectrumSettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
@ -90,7 +90,7 @@ QByteArray GLSpectrumSettings::serialize() const
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool GLSpectrumSettings::deserialize(const QByteArray& data)
|
||||
bool SpectrumSettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
@ -145,7 +145,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
int GLSpectrumSettings::getAveragingMaxScale(AveragingMode averagingMode)
|
||||
int SpectrumSettings::getAveragingMaxScale(AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingMode == AvgModeMoving) {
|
||||
return 2;
|
||||
@ -154,7 +154,7 @@ int GLSpectrumSettings::getAveragingMaxScale(AveragingMode averagingMode)
|
||||
}
|
||||
}
|
||||
|
||||
int GLSpectrumSettings::getAveragingValue(int averagingIndex, AveragingMode averagingMode)
|
||||
int SpectrumSettings::getAveragingValue(int averagingIndex, AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingIndex <= 0) {
|
||||
return 1;
|
||||
@ -175,7 +175,7 @@ int GLSpectrumSettings::getAveragingValue(int averagingIndex, AveragingMode aver
|
||||
return x * m;
|
||||
}
|
||||
|
||||
int GLSpectrumSettings::getAveragingIndex(int averagingValue, AveragingMode averagingMode)
|
||||
int SpectrumSettings::getAveragingIndex(int averagingValue, AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingValue <= 1) {
|
||||
return 0;
|
@ -15,17 +15,18 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_DSP_GLSPECTRUMSETTNGS_H
|
||||
#define SDRBASE_DSP_GLSPECTRUMSETTNGS_H
|
||||
#ifndef SDRBASE_DSP_SPECTRUMSETTNGS_H
|
||||
#define SDRBASE_DSP_SPECTRUMSETTNGS_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
#include "export.h"
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/fftwindow.h"
|
||||
#include "settings/serializable.h"
|
||||
|
||||
class SDRBASE_API GLSpectrumSettings : public Serializable
|
||||
class SDRBASE_API SpectrumSettings : public Serializable
|
||||
{
|
||||
public:
|
||||
enum AveragingMode
|
||||
@ -63,8 +64,8 @@ public:
|
||||
QString m_wsSpectrumAddress;
|
||||
uint16_t m_wsSpectrumPort;
|
||||
|
||||
GLSpectrumSettings();
|
||||
virtual ~GLSpectrumSettings();
|
||||
SpectrumSettings();
|
||||
virtual ~SpectrumSettings();
|
||||
void resetToDefaults();
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
@ -75,4 +76,4 @@ public:
|
||||
static int getAveragingIndex(int averagingValue, AveragingMode averagingMode);
|
||||
};
|
||||
|
||||
#endif // SDRBASE_DSP_GLSPECTRUMSETTNGS_H
|
||||
#endif // SDRBASE_DSP_SPECTRUMSETTNGS_H
|
@ -130,7 +130,7 @@ void SpectrumVis::feed(const Complex *begin, unsigned int length)
|
||||
int fftMax = (m_frequencyZoomFactor == 1.0f) ?
|
||||
m_settings.m_fftSize : (m_frequencyZoomPos + (0.5f / m_frequencyZoomFactor)) * m_settings.m_fftSize;
|
||||
|
||||
if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeNone)
|
||||
if (m_settings.m_averagingMode == SpectrumSettings::AvgModeNone)
|
||||
{
|
||||
for (int i = 0; i < m_settings.m_fftSize; i++)
|
||||
{
|
||||
@ -170,7 +170,7 @@ void SpectrumVis::feed(const Complex *begin, unsigned int length)
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMoving)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeMoving)
|
||||
{
|
||||
for (int i = 0; i < m_settings.m_fftSize; i++)
|
||||
{
|
||||
@ -213,7 +213,7 @@ void SpectrumVis::feed(const Complex *begin, unsigned int length)
|
||||
|
||||
m_movingAverage.nextAverage();
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeFixed)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeFixed)
|
||||
{
|
||||
double avg;
|
||||
|
||||
@ -264,7 +264,7 @@ void SpectrumVis::feed(const Complex *begin, unsigned int length)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMax)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeMax)
|
||||
{
|
||||
double max;
|
||||
|
||||
@ -367,7 +367,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
Real v;
|
||||
std::size_t halfSize = m_settings.m_fftSize / 2;
|
||||
|
||||
if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeNone)
|
||||
if (m_settings.m_averagingMode == SpectrumSettings::AvgModeNone)
|
||||
{
|
||||
m_specMax = 0.0f;
|
||||
|
||||
@ -428,7 +428,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMoving)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeMoving)
|
||||
{
|
||||
m_specMax = 0.0f;
|
||||
|
||||
@ -494,7 +494,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
|
||||
m_movingAverage.nextAverage();
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeFixed)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeFixed)
|
||||
{
|
||||
double avg;
|
||||
Real specMax = 0.0f;
|
||||
@ -577,7 +577,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMax)
|
||||
else if (m_settings.m_averagingMode == SpectrumSettings::AvgModeMax)
|
||||
{
|
||||
double max;
|
||||
Real specMax = 0.0f;
|
||||
@ -770,7 +770,7 @@ bool SpectrumVis::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
void SpectrumVis::applySettings(const GLSpectrumSettings& settings, bool force)
|
||||
void SpectrumVis::applySettings(const SpectrumSettings& settings, bool force)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
@ -829,7 +829,7 @@ void SpectrumVis::applySettings(const GLSpectrumSettings& settings, bool force)
|
||||
|| (settings.m_averagingIndex != m_settings.m_averagingIndex)
|
||||
|| (settings.m_averagingMode != m_settings.m_averagingMode) || force)
|
||||
{
|
||||
unsigned int averagingValue = GLSpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode);
|
||||
unsigned int averagingValue = SpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode);
|
||||
m_movingAverage.resize(fftSize, averagingValue > 1000 ? 1000 : averagingValue); // Capping to avoid out of memory condition
|
||||
m_fixedAverage.resize(fftSize, averagingValue);
|
||||
m_max.resize(fftSize, averagingValue);
|
||||
@ -895,7 +895,7 @@ int SpectrumVis::webapiSpectrumSettingsPutPatch(
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
GLSpectrumSettings settings = m_settings;
|
||||
SpectrumSettings settings = m_settings;
|
||||
webapiUpdateSpectrumSettings(settings, spectrumSettingsKeys, response);
|
||||
|
||||
MsgConfigureSpectrumVis *msg = MsgConfigureSpectrumVis::create(settings, force);
|
||||
@ -980,7 +980,7 @@ int SpectrumVis::webapiSpectrumServerDelete(SWGSDRangel::SWGSuccessResponse& res
|
||||
return 200;
|
||||
}
|
||||
|
||||
void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const GLSpectrumSettings& settings)
|
||||
void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const SpectrumSettings& settings)
|
||||
{
|
||||
response.setFftSize(settings.m_fftSize);
|
||||
response.setFftOverlap(settings.m_fftOverlap);
|
||||
@ -1001,7 +1001,7 @@ void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& respo
|
||||
response.setDisplayHistogram(settings.m_displayHistogram ? 1 : 0);
|
||||
response.setDisplayGrid(settings.m_displayGrid ? 1 : 0);
|
||||
response.setAveragingMode((int) settings.m_averagingMode);
|
||||
response.setAveragingValue(GLSpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode));
|
||||
response.setAveragingValue(SpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode));
|
||||
response.setLinear(settings.m_linear ? 1 : 0);
|
||||
response.setSsb(settings.m_ssb ? 1 : 0);
|
||||
response.setUsb(settings.m_usb ? 1 : 0);
|
||||
@ -1015,7 +1015,7 @@ void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& respo
|
||||
}
|
||||
|
||||
void SpectrumVis::webapiUpdateSpectrumSettings(
|
||||
GLSpectrumSettings& settings,
|
||||
SpectrumSettings& settings,
|
||||
const QStringList& spectrumSettingsKeys,
|
||||
SWGSDRangel::SWGGLSpectrum& response)
|
||||
{
|
||||
@ -1074,13 +1074,13 @@ void SpectrumVis::webapiUpdateSpectrumSettings(
|
||||
settings.m_displayGrid = response.getDisplayGrid() != 0;
|
||||
}
|
||||
if (spectrumSettingsKeys.contains("averagingMode")) {
|
||||
settings.m_averagingMode = (GLSpectrumSettings::AveragingMode) response.getAveragingMode();
|
||||
settings.m_averagingMode = (SpectrumSettings::AveragingMode) response.getAveragingMode();
|
||||
}
|
||||
if (spectrumSettingsKeys.contains("averagingValue"))
|
||||
{
|
||||
qint32 tmp = response.getAveragingValue();
|
||||
settings.m_averagingIndex = GLSpectrumSettings::getAveragingIndex(tmp, settings.m_averagingMode);
|
||||
settings.m_averagingValue = GLSpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode);
|
||||
settings.m_averagingIndex = SpectrumSettings::getAveragingIndex(tmp, settings.m_averagingMode);
|
||||
settings.m_averagingValue = SpectrumSettings::getAveragingValue(settings.m_averagingIndex, settings.m_averagingMode);
|
||||
}
|
||||
if (spectrumSettingsKeys.contains("linear")) {
|
||||
settings.m_linear = response.getLinear() != 0;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "dsp/fftengine.h"
|
||||
#include "dsp/fftwindow.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "export.h"
|
||||
#include "util/message.h"
|
||||
#include "util/movingaverage2d.h"
|
||||
@ -50,18 +50,18 @@ public:
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const GLSpectrumSettings& getSettings() const { return m_settings; }
|
||||
const SpectrumSettings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureSpectrumVis* create(const GLSpectrumSettings& settings, bool force) {
|
||||
static MsgConfigureSpectrumVis* create(const SpectrumSettings& settings, bool force) {
|
||||
return new MsgConfigureSpectrumVis(settings, force);
|
||||
}
|
||||
|
||||
private:
|
||||
GLSpectrumSettings m_settings;
|
||||
SpectrumSettings m_settings;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureSpectrumVis(const GLSpectrumSettings& settings, bool force) :
|
||||
MsgConfigureSpectrumVis(const SpectrumSettings& settings, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_force(force)
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
void setScalef(Real scalef);
|
||||
void configureWSSpectrum(const QString& address, uint16_t port);
|
||||
const GLSpectrumSettings& getSettings() const { return m_settings; }
|
||||
const SpectrumSettings& getSettings() const { return m_settings; }
|
||||
Real getSpecMax() const { return m_specMax / m_powFFTDiv; }
|
||||
void getPowerSpectrumCopy(std::vector<Real>& copy) { copy.assign(m_powerSpectrum.begin(), m_powerSpectrum.end()); }
|
||||
void getPSDCopy(std::vector<Real>& copy) const { copy.assign(m_psd.begin(), m_psd.begin() + m_settings.m_fftSize); }
|
||||
@ -215,7 +215,7 @@ private:
|
||||
std::vector<Real> m_powerSpectrum; //!< displayable power spectrum
|
||||
std::vector<Real> m_psd; //!< real PSD
|
||||
|
||||
GLSpectrumSettings m_settings;
|
||||
SpectrumSettings m_settings;
|
||||
int m_overlapSize;
|
||||
int m_refillSize;
|
||||
int m_fftBufferFill;
|
||||
@ -244,15 +244,15 @@ private:
|
||||
QMutex m_mutex;
|
||||
|
||||
void setRunning(bool running) { m_running = running; }
|
||||
void applySettings(const GLSpectrumSettings& settings, bool force = false);
|
||||
void applySettings(const SpectrumSettings& settings, bool force = false);
|
||||
void handleConfigureDSP(uint64_t centerFrequency, int sampleRate);
|
||||
void handleScalef(Real scalef);
|
||||
void handleWSOpenClose(bool openClose);
|
||||
void handleConfigureWSSpectrum(const QString& address, uint16_t port);
|
||||
|
||||
static void webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const GLSpectrumSettings& settings);
|
||||
static void webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const SpectrumSettings& settings);
|
||||
static void webapiUpdateSpectrumSettings(
|
||||
GLSpectrumSettings& settings,
|
||||
SpectrumSettings& settings,
|
||||
const QStringList& spectrumSettingsKeys,
|
||||
SWGSDRangel::SWGGLSpectrum& response);
|
||||
};
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "device/deviceutils.h"
|
||||
#include "feature/featurewebapiadapter.h"
|
||||
#include "feature/featureutils.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "webapiadapterbase.h"
|
||||
|
||||
WebAPIAdapterBase::WebAPIAdapterBase()
|
||||
@ -138,7 +138,7 @@ void WebAPIAdapterBase::webapiFormatPreset(
|
||||
apiPreset->setDcOffsetCorrection(preset.hasDCOffsetCorrection() ? 1 : 0);
|
||||
apiPreset->setIqImbalanceCorrection(preset.hasIQImbalanceCorrection() ? 1 : 0);
|
||||
const QByteArray& spectrumConfig = preset.getSpectrumConfig();
|
||||
GLSpectrumSettings m_spectrumSettings;
|
||||
SpectrumSettings m_spectrumSettings;
|
||||
|
||||
if (m_spectrumSettings.deserialize(spectrumConfig))
|
||||
{
|
||||
@ -163,7 +163,7 @@ void WebAPIAdapterBase::webapiFormatPreset(
|
||||
swgSpectrumConfig->setDisplayTraceIntensity(m_spectrumSettings.m_displayTraceIntensity);
|
||||
swgSpectrumConfig->setWaterfallShare(m_spectrumSettings.m_waterfallShare);
|
||||
swgSpectrumConfig->setAveragingMode((int) m_spectrumSettings.m_averagingMode);
|
||||
swgSpectrumConfig->setAveragingValue(GLSpectrumSettings::getAveragingValue(m_spectrumSettings.m_averagingIndex, m_spectrumSettings.m_averagingMode));
|
||||
swgSpectrumConfig->setAveragingValue(SpectrumSettings::getAveragingValue(m_spectrumSettings.m_averagingIndex, m_spectrumSettings.m_averagingMode));
|
||||
swgSpectrumConfig->setLinear(m_spectrumSettings.m_linear ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ void WebAPIAdapterBase::webapiUpdatePreset(
|
||||
preset->setLayout(QByteArray::fromBase64(apiPreset->getLayout()->toUtf8()));
|
||||
}
|
||||
|
||||
GLSpectrumSettings spectrumSettings;
|
||||
SpectrumSettings spectrumSettings;
|
||||
|
||||
if (!force) {
|
||||
spectrumSettings.deserialize(preset->getSpectrumConfig());
|
||||
@ -312,12 +312,12 @@ void WebAPIAdapterBase::webapiUpdatePreset(
|
||||
for (; spectrumIt != presetKeys.m_spectrumKeys.end(); ++spectrumIt)
|
||||
{
|
||||
if (spectrumIt->contains("averagingMode")) {
|
||||
spectrumSettings.m_averagingMode = (GLSpectrumSettings::AveragingMode) apiPreset->getSpectrumConfig()->getAveragingMode();
|
||||
spectrumSettings.m_averagingMode = (SpectrumSettings::AveragingMode) apiPreset->getSpectrumConfig()->getAveragingMode();
|
||||
}
|
||||
if (spectrumIt->contains("averagingValue"))
|
||||
{
|
||||
spectrumSettings.m_averagingValue = apiPreset->getSpectrumConfig()->getAveragingValue();
|
||||
spectrumSettings.m_averagingIndex = GLSpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
spectrumSettings.m_averagingIndex = SpectrumSettings::getAveragingIndex(spectrumSettings.m_averagingValue, spectrumSettings.m_averagingMode);
|
||||
}
|
||||
if (spectrumIt->contains("decay")) {
|
||||
spectrumSettings.m_decay = apiPreset->getSpectrumConfig()->getDecay();
|
||||
|
@ -184,7 +184,7 @@ void GLSpectrumGUI::applySettings()
|
||||
}
|
||||
|
||||
if (m_glSpectrum) {
|
||||
applyGLSpectrumSettings();
|
||||
applySpectrumSettings();
|
||||
}
|
||||
|
||||
if (m_spectrumVis)
|
||||
@ -194,7 +194,7 @@ void GLSpectrumGUI::applySettings()
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::applyGLSpectrumSettings()
|
||||
void GLSpectrumGUI::applySpectrumSettings()
|
||||
{
|
||||
m_glSpectrum->setDisplayWaterfall(m_settings.m_displayWaterfall);
|
||||
m_glSpectrum->setInvertedWaterfall(m_settings.m_invertedWaterfall);
|
||||
@ -209,7 +209,7 @@ void GLSpectrumGUI::applyGLSpectrumSettings()
|
||||
m_glSpectrum->setDisplayTraceIntensity(m_settings.m_displayTraceIntensity);
|
||||
m_glSpectrum->setWaterfallShare(m_settings.m_waterfallShare);
|
||||
|
||||
if ((m_settings.m_averagingMode == GLSpectrumSettings::AvgModeFixed) || (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMax)) {
|
||||
if ((m_settings.m_averagingMode == SpectrumSettings::AvgModeFixed) || (m_settings.m_averagingMode == SpectrumSettings::AvgModeMax)) {
|
||||
m_glSpectrum->setTimingRate(getAveragingValue(m_settings.m_averagingIndex, m_settings.m_averagingMode) == 0 ?
|
||||
1 :
|
||||
getAveragingValue(m_settings.m_averagingIndex, m_settings.m_averagingMode));
|
||||
@ -293,10 +293,10 @@ void GLSpectrumGUI::on_averagingMode_currentIndexChanged(int index)
|
||||
{
|
||||
qDebug("GLSpectrumGUI::on_averagingMode_currentIndexChanged: %d", index);
|
||||
m_settings.m_averagingMode = index < 0 ?
|
||||
GLSpectrumSettings::AvgModeNone :
|
||||
SpectrumSettings::AvgModeNone :
|
||||
index > 3 ?
|
||||
GLSpectrumSettings::AvgModeMax :
|
||||
(GLSpectrumSettings::AveragingMode) index;
|
||||
SpectrumSettings::AvgModeMax :
|
||||
(SpectrumSettings::AveragingMode) index;
|
||||
|
||||
setAveragingCombo();
|
||||
applySettings();
|
||||
@ -432,16 +432,16 @@ void GLSpectrumGUI::on_freeze_toggled(bool checked)
|
||||
m_spectrumVis->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
int GLSpectrumGUI::getAveragingMaxScale(GLSpectrumSettings::AveragingMode averagingMode)
|
||||
int GLSpectrumGUI::getAveragingMaxScale(SpectrumSettings::AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingMode == GLSpectrumSettings::AvgModeMoving) {
|
||||
if (averagingMode == SpectrumSettings::AvgModeMoving) {
|
||||
return 2;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
int GLSpectrumGUI::getAveragingIndex(int averagingValue, GLSpectrumSettings::AveragingMode averagingMode)
|
||||
int GLSpectrumGUI::getAveragingIndex(int averagingValue, SpectrumSettings::AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingValue <= 1) {
|
||||
return 0;
|
||||
@ -473,7 +473,7 @@ int GLSpectrumGUI::getAveragingIndex(int averagingValue, GLSpectrumSettings::Ave
|
||||
return 3 * getAveragingMaxScale(averagingMode) + 3;
|
||||
}
|
||||
|
||||
int GLSpectrumGUI::getAveragingValue(int averagingIndex, GLSpectrumSettings::AveragingMode averagingMode)
|
||||
int GLSpectrumGUI::getAveragingValue(int averagingIndex, SpectrumSettings::AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingIndex <= 0) {
|
||||
return 1;
|
||||
@ -559,7 +559,7 @@ void GLSpectrumGUI::setAveragingToolitp()
|
||||
if (m_glSpectrum)
|
||||
{
|
||||
QString s;
|
||||
int averagingIndex = m_settings.m_averagingMode == GLSpectrumSettings::AvgModeNone ? 0 : m_settings.m_averagingIndex;
|
||||
int averagingIndex = m_settings.m_averagingMode == SpectrumSettings::AvgModeNone ? 0 : m_settings.m_averagingIndex;
|
||||
float halfSize = m_settings.m_fftSize / 2;
|
||||
float overlapFactor = (halfSize - m_settings.m_fftOverlap) / halfSize;
|
||||
float averagingTime = (m_settings.m_fftSize * (getAveragingValue(averagingIndex, m_settings.m_averagingMode) == 0 ?
|
||||
@ -606,7 +606,7 @@ bool GLSpectrumGUI::handleMessage(const Message& message)
|
||||
displaySettings();
|
||||
|
||||
if (m_glSpectrum) {
|
||||
applyGLSpectrumSettings();
|
||||
applySpectrumSettings();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/glspectrumsettings.h"
|
||||
#include "dsp/spectrumsettings.h"
|
||||
#include "export.h"
|
||||
#include "settings/serializable.h"
|
||||
#include "util/messagequeue.h"
|
||||
@ -65,17 +65,17 @@ private:
|
||||
SpectrumVis* m_spectrumVis;
|
||||
GLSpectrum* m_glSpectrum;
|
||||
MessageQueue m_messageQueue;
|
||||
GLSpectrumSettings m_settings;
|
||||
SpectrumSettings m_settings;
|
||||
bool m_doApplySettings;
|
||||
static const int m_fpsMs[];
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings();
|
||||
void applyGLSpectrumSettings();
|
||||
void applySpectrumSettings();
|
||||
void displaySettings();
|
||||
static int getAveragingMaxScale(GLSpectrumSettings::AveragingMode averagingMode); //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
|
||||
static int getAveragingIndex(int averaging, GLSpectrumSettings::AveragingMode averagingMode);
|
||||
static int getAveragingValue(int averagingIndex, GLSpectrumSettings::AveragingMode averagingMode);
|
||||
static int getAveragingMaxScale(SpectrumSettings::AveragingMode averagingMode); //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
|
||||
static int getAveragingIndex(int averaging, SpectrumSettings::AveragingMode averagingMode);
|
||||
static int getAveragingValue(int averagingIndex, SpectrumSettings::AveragingMode averagingMode);
|
||||
void setAveragingCombo();
|
||||
void setNumberStr(int n, QString& s);
|
||||
void setNumberStr(float v, int decimalPlaces, QString& s);
|
||||
|
Loading…
Reference in New Issue
Block a user