diff --git a/plugins/feature/demodanalyzer/demodalyzergui.ui b/plugins/feature/demodanalyzer/demodalyzergui.ui deleted file mode 100644 index b0f3ff01c..000000000 --- a/plugins/feature/demodanalyzer/demodalyzergui.ui +++ /dev/null @@ -1,346 +0,0 @@ - - - DemodAnalyzerGUI - - - - 0 - 0 - 739 - 778 - - - - - 720 - 0 - - - - - Liberation Sans - 9 - - - - Demod Analyzer - - - - - 0 - 10 - 631 - 41 - - - - Settings - - - - 3 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - 2 - - - - - start/stop acquisition - - - - - - - :/play.png - :/stop.png:/play.png - - - - - - - - 24 - 16777215 - - - - Refresh indexes of available device sets - - - - - - - :/recycle.png:/recycle.png - - - - - - - Chan - - - - - - - - 200 - 0 - - - - Channel index - - - - - - - - 24 - 24 - - - - Reinitialization of device data - - - - - - - :/checkmark.png:/checkmark.png - - - - - - - - 80 - 0 - - - - Analyzer (sink) sample rate - - - 00000.0 kS/s - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 52 - 0 - - - - Channel power - - - Qt::LeftToRight - - - -100.0 dB - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 0 - 98 - 720 - 284 - - - - - 716 - 0 - - - - Channel Spectrum - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 200 - 250 - - - - - Liberation Mono - 8 - - - - - - - - - - - - - 0 - 390 - 720 - 334 - - - - - 716 - 0 - - - - Channel Scope - - - - 2 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - 200 - 300 - - - - - Liberation Mono - 8 - - - - - - - - - - - - - RollupWidget - QWidget -
gui/rollupwidget.h
- 1 -
- - GLSpectrum - QWidget -
gui/glspectrum.h
- 1 -
- - GLSpectrumGUI - QWidget -
gui/glspectrumgui.h
- 1 -
- - ButtonSwitch - QToolButton -
gui/buttonswitch.h
-
- - GLScope - QWidget -
gui/glscope.h
- 1 -
- - GLScopeGUI - QWidget -
gui/glscopegui.h
- 1 -
-
- - - - -
diff --git a/plugins/feature/demodanalyzer/demodanalyzer.cpp b/plugins/feature/demodanalyzer/demodanalyzer.cpp index ff9cfac9b..f74cec029 100644 --- a/plugins/feature/demodanalyzer/demodanalyzer.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzer.cpp @@ -205,8 +205,7 @@ bool DemodAnalyzer::deserialize(const QByteArray& data) void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool force) { qDebug() << "DemodAnalyzer::applySettings:" - << " m_deviceIndex: " << settings.m_deviceIndex - << " m_channelIndex: " << settings.m_channelIndex + << " m_channelIndex: " << settings.m_log2Decim << " m_title: " << settings.m_title << " m_rgbColor: " << settings.m_rgbColor << " m_useReverseAPI: " << settings.m_useReverseAPI @@ -218,11 +217,8 @@ void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool fo QList reverseAPIKeys; - if ((m_settings.m_deviceIndex != settings.m_deviceIndex) || force) { - reverseAPIKeys.append("deviceIndex"); - } - if ((m_settings.m_channelIndex != settings.m_channelIndex) || force) { - reverseAPIKeys.append("channelIndex"); + if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) { + reverseAPIKeys.append("log2Decim"); } if ((m_settings.m_title != settings.m_title) || force) { reverseAPIKeys.append("title"); @@ -400,9 +396,6 @@ void DemodAnalyzer::webapiFormatFeatureSettings( SWGSDRangel::SWGFeatureSettings& response, const DemodAnalyzerSettings& settings) { - response.getDemodAnalyzerSettings()->setDeviceIndex(settings.m_deviceIndex); - response.getDemodAnalyzerSettings()->setChannelIndex(settings.m_channelIndex); - if (response.getDemodAnalyzerSettings()->getTitle()) { *response.getDemodAnalyzerSettings()->getTitle() = settings.m_title; } else { @@ -428,12 +421,6 @@ void DemodAnalyzer::webapiUpdateFeatureSettings( const QStringList& featureSettingsKeys, SWGSDRangel::SWGFeatureSettings& response) { - if (featureSettingsKeys.contains("deviceIndex")) { - settings.m_deviceIndex = response.getDemodAnalyzerSettings()->getDeviceIndex(); - } - if (featureSettingsKeys.contains("channelIndex")) { - settings.m_channelIndex = response.getDemodAnalyzerSettings()->getChannelIndex(); - } if (featureSettingsKeys.contains("title")) { settings.m_title = *response.getDemodAnalyzerSettings()->getTitle(); } @@ -468,12 +455,6 @@ void DemodAnalyzer::webapiReverseSendSettings(QList& featureSettingsKey // transfer data that has been modified. When force is on transfer all data except reverse API data - if (featureSettingsKeys.contains("deviceIndex") || force) { - swgDemodAnalyzerSettings->setDeviceIndex(settings.m_deviceIndex); - } - if (featureSettingsKeys.contains("channelIndex") || force) { - swgDemodAnalyzerSettings->setChannelIndex(settings.m_channelIndex); - } if (featureSettingsKeys.contains("title") || force) { swgDemodAnalyzerSettings->setTitle(new QString(settings.m_title)); } diff --git a/plugins/feature/demodanalyzer/demodanalyzergui.cpp b/plugins/feature/demodanalyzer/demodanalyzergui.cpp index 723103ba7..fb41e8581 100644 --- a/plugins/feature/demodanalyzer/demodanalyzergui.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzergui.cpp @@ -96,9 +96,10 @@ bool DemodAnalyzerGUI::handleMessage(const Message& message) DemodAnalyzer::MsgReportSampleRate& report = (DemodAnalyzer::MsgReportSampleRate&) message; int sampleRate = report.getSampleRate(); qDebug("DemodAnalyzerGUI::handleMessage: DemodAnalyzer::MsgReportSampleRate: %d", sampleRate); - ui->glSpectrum->setSampleRate(sampleRate); - m_scopeVis->setLiveRate(sampleRate); - displaySampleRate(sampleRate); + ui->glSpectrum->setSampleRate(sampleRate/(1<setLiveRate(sampleRate/(1<spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->glSpectrum->setCenterFrequency(0); - ui->glSpectrum->setSampleRate(48000); - m_scopeVis->setLiveRate(48000); - displaySampleRate(48000); + ui->glSpectrum->setSampleRate(m_sampleRate/(1<setLiveRate(m_sampleRate/(1<glSpectrum->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); @@ -192,6 +194,7 @@ void DemodAnalyzerGUI::displaySettings() setTitleColor(m_settings.m_rgbColor); setWindowTitle(m_settings.m_title); blockApplySettings(true); + ui->log2Decim->setCurrentIndex(m_settings.m_log2Decim); blockApplySettings(false); } @@ -308,6 +311,19 @@ void DemodAnalyzerGUI::on_channelApply_clicked() } } +void DemodAnalyzerGUI::on_log2Decim_currentIndexChanged(int index) +{ + if ((index < 0) || (index > 6)) { + return; + } + + m_settings.m_log2Decim = index; + ui->glSpectrum->setSampleRate(m_sampleRate/(1<setLiveRate(m_sampleRate/(1<getMagSqAvg()); diff --git a/plugins/feature/demodanalyzer/demodanalyzergui.h b/plugins/feature/demodanalyzer/demodanalyzergui.h index 666c92658..7d7b90960 100644 --- a/plugins/feature/demodanalyzer/demodanalyzergui.h +++ b/plugins/feature/demodanalyzer/demodanalyzergui.h @@ -54,6 +54,7 @@ private: PluginAPI* m_pluginAPI; FeatureUISet* m_featureUISet; DemodAnalyzerSettings m_settings; + int m_sampleRate; bool m_doApplySettings; DemodAnalyzer* m_demodAnalyzer; @@ -88,6 +89,7 @@ private slots: void on_devicesRefresh_clicked(); void on_channels_currentIndexChanged(int index); void on_channelApply_clicked(); + void on_log2Decim_currentIndexChanged(int index); void updateStatus(); void tick(); }; diff --git a/plugins/feature/demodanalyzer/demodanalyzergui.ui b/plugins/feature/demodanalyzer/demodanalyzergui.ui index b0f3ff01c..b7b77f103 100644 --- a/plugins/feature/demodanalyzer/demodanalyzergui.ui +++ b/plugins/feature/demodanalyzer/demodanalyzergui.ui @@ -122,7 +122,7 @@ - Reinitialization of device data + (Re) apply channel selection @@ -133,6 +133,54 @@ + + + + + 50 + 16777215 + + + + Channel decimation + + + + 1 + + + + + 2 + + + + + 4 + + + + + 8 + + + + + 16 + + + + + 32 + + + + + 64 + + + + diff --git a/plugins/feature/demodanalyzer/demodanalyzersettings.cpp b/plugins/feature/demodanalyzer/demodanalyzersettings.cpp index 356db8995..3ffe5381d 100644 --- a/plugins/feature/demodanalyzer/demodanalyzersettings.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzersettings.cpp @@ -24,12 +24,16 @@ const QStringList DemodAnalyzerSettings::m_channelTypes = { QStringLiteral("AMDemod"), - QStringLiteral("AMMod") + QStringLiteral("AMMod"), + QStringLiteral("DSDDemod"), + QStringLiteral("NFMDemod"), }; const QStringList DemodAnalyzerSettings::m_channelURIs = { QStringLiteral("sdrangel.channel.amdemod"), - QStringLiteral("sdrangel.channeltx.modam") + QStringLiteral("sdrangel.channeltx.modam"), + QStringLiteral("sdrangel.channel.dsddemod"), + QStringLiteral("sdrangel.channel.nfmdemod"), }; DemodAnalyzerSettings::DemodAnalyzerSettings() : @@ -41,8 +45,7 @@ DemodAnalyzerSettings::DemodAnalyzerSettings() : void DemodAnalyzerSettings::resetToDefaults() { - m_deviceIndex = -1; - m_channelIndex = -1; + m_log2Decim = 0; m_title = "Demod Analyzer"; m_rgbColor = QColor(128, 128, 128).rgb(); m_useReverseAPI = false; @@ -58,8 +61,7 @@ QByteArray DemodAnalyzerSettings::serialize() const s.writeBlob(1, m_spectrumGUI->serialize()); s.writeBlob(2, m_scopeGUI->serialize()); - s.writeS32(3, m_deviceIndex); - s.writeS32(4, m_channelIndex); + s.writeS32(3, m_log2Decim); s.writeString(5, m_title); s.writeU32(6, m_rgbColor); s.writeBool(7, m_useReverseAPI); @@ -99,9 +101,8 @@ bool DemodAnalyzerSettings::deserialize(const QByteArray& data) m_scopeGUI->deserialize(bytetmp); } - d.readS32(3, &m_deviceIndex, -1); - d.readS32(4, &m_channelIndex, -1); - d.readString(5, &m_title, "RigCtl Server"); + d.readS32(3, &m_log2Decim, 0); + d.readString(5, &m_title, "Demod Analyzer"); d.readU32(6, &m_rgbColor, QColor(128, 128, 128).rgb()); d.readBool(7, &m_useReverseAPI, false); d.readString(8, &m_reverseAPIAddress, "127.0.0.1"); diff --git a/plugins/feature/demodanalyzer/demodanalyzersettings.h b/plugins/feature/demodanalyzer/demodanalyzersettings.h index 0f05522ae..d89fcd384 100644 --- a/plugins/feature/demodanalyzer/demodanalyzersettings.h +++ b/plugins/feature/demodanalyzer/demodanalyzersettings.h @@ -41,8 +41,7 @@ struct DemodAnalyzerSettings AvailableChannel& operator=(const AvailableChannel&) = default; }; - int m_deviceIndex; - int m_channelIndex; + int m_log2Decim; QString m_title; quint32 m_rgbColor; bool m_useReverseAPI; diff --git a/plugins/feature/demodanalyzer/demodanalyzerworker.cpp b/plugins/feature/demodanalyzer/demodanalyzerworker.cpp index 49ff187bb..c83019825 100644 --- a/plugins/feature/demodanalyzer/demodanalyzerworker.cpp +++ b/plugins/feature/demodanalyzer/demodanalyzerworker.cpp @@ -69,6 +69,7 @@ void DemodAnalyzerWorker::feedPart(const QByteArray::const_iterator& begin, cons if (countSamples > m_sampleBufferSize) { m_sampleBuffer.resize(countSamples); + m_convBuffer.resize(2*countSamples); m_sampleBufferSize = countSamples; } @@ -77,15 +78,58 @@ void DemodAnalyzerWorker::feedPart(const QByteArray::const_iterator& begin, cons double re = s[i] / (double) std::numeric_limits::max(); m_magsq = re*re; m_channelPowerAvg(m_magsq); - m_sampleBuffer[i].setReal(re * SDR_RX_SCALEF); - m_sampleBuffer[i].setImag(0); + + if (m_settings.m_log2Decim == 0) + { + m_sampleBuffer[i].setReal(re * SDR_RX_SCALEF); + m_sampleBuffer[i].setImag(0); + } + else + { + m_convBuffer[2*i] = s[i]; + m_convBuffer[2*i+1] = 0; + + if (i == countSamples - 1) { + decimate(countSamples); + } + } } if (m_sampleSink) { - m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.begin() + countSamples, false); + m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.begin() + countSamples/(1< + #include #include #include #include "dsp/dsptypes.h" +#include "dsp/decimators.h" #include "util/movingaverage.h" #include "util/message.h" #include "util/messagequeue.h" @@ -110,6 +113,8 @@ private: DemodAnalyzerSettings m_settings; double m_magsq; SampleVector m_sampleBuffer; + std::vector m_convBuffer; + Decimators m_decimators; int m_sampleBufferSize; MovingAverageUtil m_channelPowerAvg; BasebandSampleSink* m_sampleSink; @@ -117,6 +122,7 @@ private: QMutex m_mutex; bool handleMessage(const Message& cmd); + void decimate(int countSamples); private slots: void handleInputMessages();