diff --git a/plugins/channelrx/chanalyzer/chanalyzergui.cpp b/plugins/channelrx/chanalyzer/chanalyzergui.cpp index 5ddf44f33..fb839e645 100644 --- a/plugins/channelrx/chanalyzer/chanalyzergui.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzergui.cpp @@ -99,6 +99,7 @@ void ChannelAnalyzerGUI::displaySettings() ui->rrcRolloffText->setText(rolloffStr); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -233,6 +234,10 @@ bool ChannelAnalyzerGUI::handleMessage(const Message& message) { DSPSignalNotification& cmd = (DSPSignalNotification&) message; m_basebandSampleRate = cmd.getSampleRate(); + m_deviceCenterFrequency = cmd.getCenterFrequency(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); qDebug("ChannelAnalyzerGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: %d", m_basebandSampleRate); setSinkSampleRate(); @@ -275,6 +280,7 @@ void ChannelAnalyzerGUI::channelMarkerChangedByCursor() { ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -388,6 +394,7 @@ void ChannelAnalyzerGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -468,7 +475,6 @@ void ChannelAnalyzerGUI::onMenuDialogCalled(const QPoint& p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -703,3 +709,8 @@ void ChannelAnalyzerGUI::makeUIConnections() QObject::connect(ui->lowCut, &QSlider::valueChanged, this, &ChannelAnalyzerGUI::on_lowCut_valueChanged); QObject::connect(ui->ssb, &QCheckBox::toggled, this, &ChannelAnalyzerGUI::on_ssb_toggled); } + +void ChannelAnalyzerGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/chanalyzer/chanalyzergui.h b/plugins/channelrx/chanalyzer/chanalyzergui.h index 1126b5fc3..bfd8016ed 100644 --- a/plugins/channelrx/chanalyzer/chanalyzergui.h +++ b/plugins/channelrx/chanalyzer/chanalyzergui.h @@ -69,6 +69,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ChannelAnalyzerSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; int m_basebandSampleRate; //!< sample rate after final in-channel decimation (spanlog2) MovingAverageUtil m_channelPowerAvg; @@ -93,6 +94,7 @@ private: void setSpectrumDisplay(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index 303019598..ac1e0f0fa 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -2132,7 +2132,7 @@ QString ADSBDemodGUI::subAircraftString(Aircraft *aircraft, const QString &strin bool ADSBDemodGUI::handleMessage(const Message& message) { -if (DSPSignalNotification::match(message)) + if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; int sr = notif.getSampleRate(); @@ -2144,6 +2144,11 @@ if (DSPSignalNotification::match(message)) ui->warning->setText(""); } getRollupContents()->arrangeRollups(); + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = sr; + ui->deltaFrequency->setValueRange(false, 7, -sr/2, sr/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(sr/2)); + updateAbsoluteCenterFrequency(); return true; } else if (ADSBDemodReport::MsgReportADSB::match(message)) @@ -2211,6 +2216,7 @@ void ADSBDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -2776,7 +2782,6 @@ void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -3675,6 +3680,8 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_basicSettingsShown(false), m_doApplySettings(true), m_tickCount(0), @@ -4691,3 +4698,8 @@ void ADSBDemodGUI::makeUIConnections() QObject::connect(ui->logFilename, &QToolButton::clicked, this, &ADSBDemodGUI::on_logFilename_clicked); QObject::connect(ui->logOpen, &QToolButton::clicked, this, &ADSBDemodGUI::on_logOpen_clicked); } + +void ADSBDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.h b/plugins/channelrx/demodadsb/adsbdemodgui.h index c37be1e15..d3d1fa96b 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.h +++ b/plugins/channelrx/demodadsb/adsbdemodgui.h @@ -785,6 +785,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ADSBDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_basicSettingsShown; bool m_doApplySettings; @@ -848,6 +850,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void updatePosition(Aircraft *aircraft); bool updateLocalPosition(Aircraft *aircraft, double latitude, double longitude, bool surfacePosition); diff --git a/plugins/channelrx/demodais/aisdemod.cpp b/plugins/channelrx/demodais/aisdemod.cpp index c24d3d601..9079b2b93 100644 --- a/plugins/channelrx/demodais/aisdemod.cpp +++ b/plugins/channelrx/demodais/aisdemod.cpp @@ -151,6 +151,10 @@ bool AISDemod::handleMessage(const Message& cmd) qDebug() << "AISDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } + return true; } else if (MsgMessage::match(cmd)) diff --git a/plugins/channelrx/demodais/aisdemodgui.cpp b/plugins/channelrx/demodais/aisdemodgui.cpp index ab01d438a..2d9c805bf 100644 --- a/plugins/channelrx/demodais/aisdemodgui.cpp +++ b/plugins/channelrx/demodais/aisdemodgui.cpp @@ -217,6 +217,16 @@ bool AISDemodGUI::handleMessage(const Message& message) messageReceived(report.getMessage(), report.getDateTime()); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } return false; } @@ -250,6 +260,7 @@ void AISDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -426,6 +437,8 @@ AISDemodGUI::AISDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_tickCount(0) { @@ -617,6 +630,7 @@ void AISDemodGUI::displaySettings() filter(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -778,3 +792,8 @@ void AISDemodGUI::makeUIConnections() QObject::connect(ui->logFilename, &QToolButton::clicked, this, &AISDemodGUI::on_logFilename_clicked); QObject::connect(ui->logOpen, &QToolButton::clicked, this, &AISDemodGUI::on_logOpen_clicked); } + +void AISDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodais/aisdemodgui.h b/plugins/channelrx/demodais/aisdemodgui.h index 727ac72eb..fb977d1f0 100644 --- a/plugins/channelrx/demodais/aisdemodgui.h +++ b/plugins/channelrx/demodais/aisdemodgui.h @@ -78,6 +78,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; AISDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ScopeVis* m_scopeVis; @@ -98,6 +100,7 @@ private: void messageReceived(const QByteArray& message, const QDateTime& dateTime); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 2bbfbd814..b420cf5b5 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -167,6 +167,10 @@ bool AMDemod::handleMessage(const Message& cmd) qDebug() << "AMDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } + return true; } else if (MainCore::MsgChannelDemodQuery::match(cmd)) diff --git a/plugins/channelrx/demodam/amdemodgui.cpp b/plugins/channelrx/demodam/amdemodgui.cpp index 0b7f8c723..7a3eda71d 100644 --- a/plugins/channelrx/demodam/amdemodgui.cpp +++ b/plugins/channelrx/demodam/amdemodgui.cpp @@ -24,17 +24,17 @@ #include "device/deviceuiset.h" #include "dsp/dspengine.h" -#include "ui_amdemodgui.h" +#include "dsp/dspcommands.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" -#include "dsp/dspengine.h" #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "maincore.h" +#include "ui_amdemodgui.h" #include "amdemod.h" AMDemodGUI* AMDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) @@ -85,6 +85,17 @@ bool AMDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + + return true; + } return false; } @@ -118,6 +129,7 @@ void AMDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -199,7 +211,6 @@ void AMDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -238,6 +249,8 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_squelchOpen(false), m_audioSampleRate(-1), @@ -378,6 +391,7 @@ void AMDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -493,3 +507,8 @@ void AMDemodGUI::makeUIConnections() QObject::connect(ui->squelch, &QSlider::valueChanged, this, &AMDemodGUI::on_squelch_valueChanged); QObject::connect(ui->audioMute, &QToolButton::toggled, this, &AMDemodGUI::on_audioMute_toggled); } + +void AMDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodam/amdemodgui.h b/plugins/channelrx/demodam/amdemodgui.h index bfb834b78..7e838efc0 100644 --- a/plugins/channelrx/demodam/amdemodgui.h +++ b/plugins/channelrx/demodam/amdemodgui.h @@ -51,6 +51,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; AMDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; AMDemod* m_amDemod; @@ -72,6 +74,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodapt/aptdemod.cpp b/plugins/channelrx/demodapt/aptdemod.cpp index 7e0380edb..96b01b626 100644 --- a/plugins/channelrx/demodapt/aptdemod.cpp +++ b/plugins/channelrx/demodapt/aptdemod.cpp @@ -209,8 +209,9 @@ bool APTDemod::handleMessage(const Message& cmd) qDebug() << "APTDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) + if (m_guiMessageQueue) { m_guiMessageQueue->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodapt/aptdemodgui.cpp b/plugins/channelrx/demodapt/aptdemodgui.cpp index 1aa2d942f..43720e084 100644 --- a/plugins/channelrx/demodapt/aptdemodgui.cpp +++ b/plugins/channelrx/demodapt/aptdemodgui.cpp @@ -274,7 +274,11 @@ bool APTDemodGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); return true; } @@ -310,6 +314,7 @@ void APTDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -592,6 +597,7 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_tickCount(0), m_scene(nullptr), @@ -779,6 +785,7 @@ void APTDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -912,3 +919,8 @@ void APTDemodGUI::makeUIConnections() QObject::connect(ui->zoomOut, &QToolButton::clicked, this, &APTDemodGUI::on_zoomOut_clicked); QObject::connect(ui->zoomAll, &ButtonSwitch::clicked, this, &APTDemodGUI::on_zoomAll_clicked); } + +void APTDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodapt/aptdemodgui.h b/plugins/channelrx/demodapt/aptdemodgui.h index 52981e464..ecd76ef13 100644 --- a/plugins/channelrx/demodapt/aptdemodgui.h +++ b/plugins/channelrx/demodapt/aptdemodgui.h @@ -95,6 +95,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; APTDemodSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; APTDemod* m_aptDemod; @@ -124,6 +125,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void deleteImageFromMap(const QString &name); void resetDecoder(); diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 58eddf8b7..7770a6348 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -127,10 +127,8 @@ bool ATVDemod::handleMessage(const Message& cmd) m_basebandSink->getInputMessageQueue()->push(notifToSink); // Forward to GUI - if (getMessageQueueToGUI()) - { - DSPSignalNotification *notifToGUI = new DSPSignalNotification(notif); - getMessageQueueToGUI()->push(notifToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index 8c7b72861..e76ff36ed 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -121,6 +121,7 @@ void ATVDemodGUI::displaySettings() applySampleRate(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); m_doApplySettings = true; } @@ -168,6 +169,10 @@ bool ATVDemodGUI::handleMessage(const Message& message) { DSPSignalNotification& notif = (DSPSignalNotification&) message; m_basebandSampleRate = notif.getSampleRate(); + m_deviceCenterFrequency = notif.getCenterFrequency(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); applySampleRate(); return true; @@ -219,6 +224,7 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base m_pluginAPI(objPluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(false), m_intTickCount(0), m_basebandSampleRate(48000) @@ -499,6 +505,7 @@ void ATVDemodGUI::on_deltaFrequency_changed(qint64 value) { m_settings.m_inputFrequencyOffset = value; m_channelMarker.setCenterFrequency(value); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -592,3 +599,8 @@ void ATVDemodGUI::makeUIConnections() QObject::connect(ui->amScaleOffset, &QDial::valueChanged, this, &ATVDemodGUI::on_amScaleOffset_valueChanged); QObject::connect(ui->screenTabWidget, &QTabWidget::currentChanged, this, &ATVDemodGUI::on_screenTabWidget_currentChanged); } + +void ATVDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodatv/atvdemodgui.h b/plugins/channelrx/demodatv/atvdemodgui.h index 793015d60..e66415e89 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.h +++ b/plugins/channelrx/demodatv/atvdemodgui.h @@ -71,6 +71,7 @@ private: RollupState m_rollupState; ATVDemod* m_atvDemod; ATVDemodSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; @@ -97,6 +98,7 @@ private: void topTimeUpdate(); bool handleMessage(const Message& objMessage); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 64d8fad7c..2afb6de93 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -151,6 +151,10 @@ bool BFMDemod::handleMessage(const Message& cmd) qDebug() << "BFMDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } + return true; } else diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp index 936ed0146..dfb2fd838 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp @@ -29,6 +29,7 @@ #include "dsp/dspengine.h" #include "dsp/spectrumvis.h" +#include "dsp/dspcommands.h" #include "gui/glspectrum.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" @@ -110,6 +111,16 @@ bool BFMDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -145,6 +156,7 @@ void BFMDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -322,7 +334,6 @@ void BFMDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -361,6 +372,8 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_rdsTimerCount(0), m_radiotext_AB_flag(false), m_rate(625000) @@ -483,6 +496,7 @@ void BFMDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -847,3 +861,8 @@ void BFMDemodGUI::makeUIConnections() QObject::connect(ui->rds, &ButtonSwitch::clicked, this, &BFMDemodGUI::on_rds_clicked); QObject::connect(ui->clearData, &QPushButton::clicked, this, &BFMDemodGUI::on_clearData_clicked); } + +void BFMDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.h b/plugins/channelrx/demodbfm/bfmdemodgui.h index c6d69ae75..79892b3a8 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.h +++ b/plugins/channelrx/demodbfm/bfmdemodgui.h @@ -68,6 +68,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; BFMDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; int m_rdsTimerCount; bool m_radiotext_AB_flag; @@ -90,6 +92,7 @@ private: void rdsUpdateFixedFields(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp index c03c26096..17d261310 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp @@ -285,10 +285,8 @@ bool ChirpChatDemod::handleMessage(const Message& cmd) qDebug() << "ChirpChatDemod::handleMessage: DSPSignalNotification: m_basebandSampleRate: " << m_basebandSampleRate; m_basebandSink->getInputMessageQueue()->push(rep); - if (getMessageQueueToGUI()) - { - DSPSignalNotification* repToGUI = new DSPSignalNotification(notif); // make a copy - getMessageQueueToGUI()->push(repToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); // make a copy } return true; diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp index 211c1c2f4..412a12e14 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.cpp @@ -81,6 +81,7 @@ bool ChirpChatDemodGUI::handleMessage(const Message& message) if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); int basebandSampleRate = notif.getSampleRate(); qDebug() << "ChirpChatDemodGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: " << basebandSampleRate; @@ -90,6 +91,10 @@ bool ChirpChatDemodGUI::handleMessage(const Message& message) setBandwidths(); } + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; } else if (ChirpChatDemod::MsgReportDecodeBytes::match(message)) @@ -151,6 +156,7 @@ void ChirpChatDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -340,7 +346,6 @@ void ChirpChatDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -379,6 +384,7 @@ ChirpChatDemodGUI::ChirpChatDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_basebandSampleRate(250000), m_doApplySettings(true), m_tickCount(0) @@ -504,6 +510,7 @@ void ChirpChatDemodGUI::displaySettings() displaySquelch(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -793,3 +800,8 @@ void ChirpChatDemodGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &ChirpChatDemodGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &ChirpChatDemodGUI::on_udpPort_editingFinished); } + +void ChirpChatDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.h b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.h index 3d62b5bff..ea5a547cc 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemodgui.h +++ b/plugins/channelrx/demodchirpchat/chirpchatdemodgui.h @@ -97,6 +97,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ChirpChatDemodSettings m_settings; + qint64 m_deviceCenterFrequency; int m_basebandSampleRate; bool m_doApplySettings; @@ -124,6 +125,7 @@ private: void resetLoRaStatus(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); }; #endif // INCLUDE_CHIRPCHATDEMODGUI_H diff --git a/plugins/channelrx/demoddab/dabdemod.cpp b/plugins/channelrx/demoddab/dabdemod.cpp index 245ccfb47..e42c47928 100644 --- a/plugins/channelrx/demoddab/dabdemod.cpp +++ b/plugins/channelrx/demoddab/dabdemod.cpp @@ -162,10 +162,8 @@ bool DABDemod::handleMessage(const Message& cmd) qDebug() << "DABDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) - { - rep = new DSPSignalNotification(notif); - m_guiMessageQueue->push(rep); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/demoddab/dabdemodgui.cpp b/plugins/channelrx/demoddab/dabdemodgui.cpp index ebc036720..6c7feeddc 100644 --- a/plugins/channelrx/demoddab/dabdemodgui.cpp +++ b/plugins/channelrx/demoddab/dabdemodgui.cpp @@ -200,15 +200,22 @@ bool DABDemodGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); bool srTooLow = m_basebandSampleRate < 2048000; ui->warning->setVisible(srTooLow); + if (srTooLow) { ui->warning->setText("Sample rate must be >= 2048000"); } else { ui->warning->setText(""); } + getRollupContents()->arrangeRollups(); + updateAbsoluteCenterFrequency(); + return true; } else if (DABDemod::MsgDABEnsembleName::match(message)) @@ -318,6 +325,7 @@ void DABDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -439,6 +447,7 @@ DABDemodGUI::DABDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_tickCount(0), m_channelFreq(0.0) @@ -574,6 +583,7 @@ void DABDemodGUI::displaySettings() filter(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -708,3 +718,8 @@ void DABDemodGUI::makeUIConnections() QObject::connect(ui->programs, &QTableWidget::cellDoubleClicked, this, &DABDemodGUI::on_programs_cellDoubleClicked); QObject::connect(ui->channel, QOverload::of(&QComboBox::currentIndexChanged), this, &DABDemodGUI::on_channel_currentIndexChanged); } + +void DABDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demoddab/dabdemodgui.h b/plugins/channelrx/demoddab/dabdemodgui.h index 9b080e1ba..2ce282c2c 100644 --- a/plugins/channelrx/demoddab/dabdemodgui.h +++ b/plugins/channelrx/demoddab/dabdemodgui.h @@ -73,6 +73,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; DABDemodSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; DABDemod* m_dabDemod; @@ -93,6 +94,7 @@ private: void addProgramName(const DABDemod::MsgDABProgramName& program); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demoddatv/datvdemod.cpp b/plugins/channelrx/demoddatv/datvdemod.cpp index b1c67c74d..988508501 100644 --- a/plugins/channelrx/demoddatv/datvdemod.cpp +++ b/plugins/channelrx/demoddatv/datvdemod.cpp @@ -138,6 +138,11 @@ bool DATVDemod::handleMessage(const Message& cmd) DSPSignalNotification* notifToSink = new DSPSignalNotification(notif); // make a copy m_basebandSink->getInputMessageQueue()->push(notifToSink); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } + return true; } else diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp index 5af728860..5f5d08454 100644 --- a/plugins/channelrx/demoddatv/datvdemodgui.cpp +++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp @@ -23,16 +23,17 @@ #include "device/deviceuiset.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" -#include "ui_datvdemodgui.h" #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" #include "mainwindow.h" +#include "ui_datvdemodgui.h" #include "datvdemodreport.h" #include "datvdvbs2ldpcdialog.h" #include "datvdemodgui.h" @@ -100,6 +101,16 @@ bool DATVDemodGUI::handleMessage(const Message& message) displaySettings(); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -154,7 +165,6 @@ void DATVDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_centerFrequency = m_objChannelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_objChannelMarker.getColor().rgb(); m_settings.m_title = m_objChannelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -188,16 +198,18 @@ void DATVDemodGUI::onMenuDialogCalled(const QPoint &p) } DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* objParent) : - ChannelGUI(objParent), - ui(new Ui::DATVDemodGUI), - m_objPluginAPI(objPluginAPI), - m_deviceUISet(deviceUISet), - m_objChannelMarker(this), - m_blnBasicSettingsShown(false), - m_blnDoApplySettings(true), - m_modcodModulationIndex(-1), - m_modcodCodeRateIndex(-1), - m_cstlnSetByModcod(false) + ChannelGUI(objParent), + ui(new Ui::DATVDemodGUI), + m_objPluginAPI(objPluginAPI), + m_deviceUISet(deviceUISet), + m_objChannelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), + m_blnBasicSettingsShown(false), + m_blnDoApplySettings(true), + m_modcodModulationIndex(-1), + m_modcodCodeRateIndex(-1), + m_cstlnSetByModcod(false) { ui->setupUi(getRollupContents()); getRollupContents()->arrangeRollups(); @@ -400,6 +412,7 @@ void DATVDemodGUI::displaySettings() } getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -779,6 +792,7 @@ void DATVDemodGUI::on_deltaFrequency_changed(qint64 value) { m_objChannelMarker.setCenterFrequency(value); m_settings.m_centerFrequency = m_objChannelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -952,3 +966,8 @@ void DATVDemodGUI::makeUIConnections() QObject::connect(ui->udpTSPort, &QLineEdit::editingFinished, this, &DATVDemodGUI::on_udpTSPort_editingFinished); QObject::connect(ui->playerEnable, &QCheckBox::clicked, this, &DATVDemodGUI::on_playerEnable_clicked); } + +void DATVDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_centerFrequency); +} diff --git a/plugins/channelrx/demoddatv/datvdemodgui.h b/plugins/channelrx/demoddatv/datvdemodgui.h index 5ef25996c..a3028f206 100644 --- a/plugins/channelrx/demoddatv/datvdemodgui.h +++ b/plugins/channelrx/demoddatv/datvdemodgui.h @@ -114,6 +114,8 @@ private: DATVDemod* m_datvDemod; MessageQueue m_inputMessageQueue; DATVDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; QTimer m_objTimer; qint64 m_intPreviousDecodedData; @@ -146,6 +148,7 @@ private: void enterEvent(QEvent*); bool handleMessage(const Message& objMessage); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); }; #endif // INCLUDE_DATVDEMODGUI_H diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp index 05e75178a..051c6fc66 100644 --- a/plugins/channelrx/demoddsd/dsddemod.cpp +++ b/plugins/channelrx/demoddsd/dsddemod.cpp @@ -149,6 +149,10 @@ bool DSDDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "DSDDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demoddsd/dsddemodgui.cpp b/plugins/channelrx/demoddsd/dsddemodgui.cpp index ae2e33071..5d1213cf2 100644 --- a/plugins/channelrx/demoddsd/dsddemodgui.cpp +++ b/plugins/channelrx/demoddsd/dsddemodgui.cpp @@ -22,6 +22,7 @@ #include "ui_dsddemodgui.h" #include "dsp/scopevisxy.h" +#include "dsp/dspcommands.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" @@ -94,6 +95,16 @@ bool DSDDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -117,6 +128,7 @@ void DSDDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -266,7 +278,6 @@ void DSDDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -311,6 +322,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_enableCosineFiltering(false), m_syncOrConstellation(false), @@ -468,6 +481,7 @@ void DSDDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -640,3 +654,8 @@ void DSDDemodGUI::makeUIConnections() QObject::connect(ui->symbolPLLLock, &QToolButton::toggled, this, &DSDDemodGUI::on_symbolPLLLock_toggled); QObject::connect(ui->viewStatusLog, &QPushButton::clicked, this, &DSDDemodGUI::on_viewStatusLog_clicked); } + +void DSDDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demoddsd/dsddemodgui.h b/plugins/channelrx/demoddsd/dsddemodgui.h index 57f072a73..55453875f 100644 --- a/plugins/channelrx/demoddsd/dsddemodgui.h +++ b/plugins/channelrx/demoddsd/dsddemodgui.h @@ -81,6 +81,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; DSDDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ScopeVisXY* m_scopeVisXY; @@ -113,6 +115,7 @@ private: void updateMyPosition(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index e8e92b373..b5ff705e5 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -151,6 +151,10 @@ bool FreeDVDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "FreeDVDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp index 00455c0b1..75ce5b79a 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp @@ -95,6 +95,16 @@ bool FreeDVDemodGUI::handleMessage(const Message& message) applyBandwidths(5 - ui->spanLog2->value()); // will update spectrum details with new sample rate return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -130,6 +140,7 @@ void FreeDVDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -199,7 +210,6 @@ void FreeDVDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -247,6 +257,8 @@ FreeDVDemodGUI::FreeDVDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_spectrumRate(6000), m_audioBinaural(false), @@ -398,6 +410,7 @@ void FreeDVDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -502,3 +515,8 @@ void FreeDVDemodGUI::makeUIConnections() QObject::connect(ui->agc, &ButtonSwitch::toggled, this, &FreeDVDemodGUI::on_agc_toggled); QObject::connect(ui->audioMute, &QToolButton::toggled, this, &FreeDVDemodGUI::on_audioMute_toggled); } + +void FreeDVDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.h b/plugins/channelrx/demodfreedv/freedvdemodgui.h index f50c72fca..c68bfaa15 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.h +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.h @@ -70,6 +70,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; FreeDVDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; int m_spectrumRate; bool m_audioBinaural; @@ -97,6 +99,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index b73140806..1239c0e36 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -151,6 +151,10 @@ bool NFMDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "NFMDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodnfm/nfmdemodgui.cpp b/plugins/channelrx/demodnfm/nfmdemodgui.cpp index b7cd4dd0b..3825bb7ef 100644 --- a/plugins/channelrx/demodnfm/nfmdemodgui.cpp +++ b/plugins/channelrx/demodnfm/nfmdemodgui.cpp @@ -13,6 +13,7 @@ #include "gui/audioselectdialog.h" #include "dsp/dspengine.h" #include "dsp/dcscodes.h" +#include "dsp/dspcommands.h" #include "maincore.h" #include "nfmdemodreport.h" @@ -80,6 +81,16 @@ bool NFMDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } return false; } @@ -113,6 +124,7 @@ void NFMDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -297,7 +309,6 @@ void NFMDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -336,6 +347,8 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_basicSettingsShown(false), m_doApplySettings(true), m_squelchOpen(false), @@ -514,6 +527,7 @@ void NFMDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -634,3 +648,8 @@ void NFMDemodGUI::makeUIConnections() QObject::connect(ui->highPassFilter, &ButtonSwitch::toggled, this, &NFMDemodGUI::on_highPassFilter_toggled); QObject::connect(ui->audioMute, &QToolButton::toggled, this, &NFMDemodGUI::on_audioMute_toggled); } + +void NFMDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodnfm/nfmdemodgui.h b/plugins/channelrx/demodnfm/nfmdemodgui.h index 0514d59aa..6ae22810b 100644 --- a/plugins/channelrx/demodnfm/nfmdemodgui.h +++ b/plugins/channelrx/demodnfm/nfmdemodgui.h @@ -50,6 +50,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; NFMDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_basicSettingsShown; bool m_doApplySettings; @@ -72,6 +74,7 @@ private: void setDcsCode(unsigned int dcsCode); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodpacket/packetdemod.cpp b/plugins/channelrx/demodpacket/packetdemod.cpp index d4eafb1d5..94886d91f 100644 --- a/plugins/channelrx/demodpacket/packetdemod.cpp +++ b/plugins/channelrx/demodpacket/packetdemod.cpp @@ -153,10 +153,8 @@ bool PacketDemod::handleMessage(const Message& cmd) qDebug() << "PacketDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) - { - rep = new DSPSignalNotification(notif); - m_guiMessageQueue->push(rep); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/demodpacket/packetdemodgui.cpp b/plugins/channelrx/demodpacket/packetdemodgui.cpp index ce32d954b..6a344d1ab 100644 --- a/plugins/channelrx/demodpacket/packetdemodgui.cpp +++ b/plugins/channelrx/demodpacket/packetdemodgui.cpp @@ -218,7 +218,11 @@ bool PacketDemodGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); return true; } else if (MainCore::MsgPacket::match(message)) @@ -260,6 +264,7 @@ void PacketDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -424,6 +429,7 @@ PacketDemodGUI::PacketDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_tickCount(0) { @@ -558,6 +564,7 @@ void PacketDemodGUI::displaySettings() filter(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -704,3 +711,8 @@ void PacketDemodGUI::makeUIConnections() QObject::connect(ui->logFilename, &QToolButton::clicked, this, &PacketDemodGUI::on_logFilename_clicked); QObject::connect(ui->logOpen, &QToolButton::clicked, this, &PacketDemodGUI::on_logOpen_clicked); } + +void PacketDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodpacket/packetdemodgui.h b/plugins/channelrx/demodpacket/packetdemodgui.h index 56fe1e3d7..e7ed265ed 100644 --- a/plugins/channelrx/demodpacket/packetdemodgui.h +++ b/plugins/channelrx/demodpacket/packetdemodgui.h @@ -78,6 +78,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; PacketDemodSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; PacketDemod* m_packetDemod; @@ -97,6 +98,7 @@ private: void packetReceived(QByteArray packet); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodpager/pagerdemod.cpp b/plugins/channelrx/demodpager/pagerdemod.cpp index 773acc50d..8f7552375 100644 --- a/plugins/channelrx/demodpager/pagerdemod.cpp +++ b/plugins/channelrx/demodpager/pagerdemod.cpp @@ -145,6 +145,10 @@ bool PagerDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "PagerDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodpager/pagerdemodgui.cpp b/plugins/channelrx/demodpager/pagerdemodgui.cpp index 6ef17a027..14472b25c 100644 --- a/plugins/channelrx/demodpager/pagerdemodgui.cpp +++ b/plugins/channelrx/demodpager/pagerdemodgui.cpp @@ -277,6 +277,16 @@ bool PagerDemodGUI::handleMessage(const Message& message) report.getEvenParityErrors(), report.getBCHParityErrors()); return true; } + else if (DSPSignalNotification::match(message)) + { + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } return false; } @@ -310,6 +320,7 @@ void PagerDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -475,6 +486,8 @@ PagerDemodGUI::PagerDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_tickCount(0) { @@ -650,6 +663,7 @@ void PagerDemodGUI::displaySettings() filter(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -819,3 +833,8 @@ void PagerDemodGUI::makeUIConnections() QObject::connect(ui->logFilename, &QToolButton::clicked, this, &PagerDemodGUI::on_logFilename_clicked); QObject::connect(ui->logOpen, &QToolButton::clicked, this, &PagerDemodGUI::on_logOpen_clicked); } + +void PagerDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodpager/pagerdemodgui.h b/plugins/channelrx/demodpager/pagerdemodgui.h index 4549f8078..5e9c3b718 100644 --- a/plugins/channelrx/demodpager/pagerdemodgui.h +++ b/plugins/channelrx/demodpager/pagerdemodgui.h @@ -72,6 +72,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; PagerDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ScopeVis* m_scopeVis; @@ -93,6 +95,7 @@ private: int evenParityErrors, int bchParityErrors); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp index e559c95a4..6964c3d2b 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp @@ -149,6 +149,10 @@ bool RadiosondeDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "RadiosondeDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp index 87074c6e3..0cf731d3a 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp @@ -324,6 +324,16 @@ bool RadiosondeDemodGUI::handleMessage(const Message& frame) frameReceived(report.getMessage(), report.getDateTime(), report.getErrorsCorrected(), report.getThreshold()); return true; } + else if (DSPSignalNotification::match(frame)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) frame; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } return false; } @@ -357,6 +367,7 @@ void RadiosondeDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -532,6 +543,8 @@ RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_tickCount(0) { @@ -754,6 +767,7 @@ void RadiosondeDemodGUI::displaySettings() filter(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -914,3 +928,8 @@ void RadiosondeDemodGUI::makeUIConnections() QObject::connect(ui->logFilename, &QToolButton::clicked, this, &RadiosondeDemodGUI::on_logFilename_clicked); QObject::connect(ui->logOpen, &QToolButton::clicked, this, &RadiosondeDemodGUI::on_logOpen_clicked); } + +void RadiosondeDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.h b/plugins/channelrx/demodradiosonde/radiosondedemodgui.h index 173a7a74b..4f44d1fe8 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.h +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.h @@ -74,6 +74,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; RadiosondeDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ScopeVis* m_scopeVis; @@ -96,6 +98,7 @@ private: void frameReceived(const QByteArray& frame, const QDateTime& dateTime, int errorsCorrected, int threshold); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 658b03e2c..a3ebb7910 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -145,6 +145,10 @@ bool SSBDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "SSBDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forwatd to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index 511ca5358..2449d299b 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -84,6 +84,16 @@ bool SSBDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -139,6 +149,7 @@ void SSBDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -239,7 +250,6 @@ void SSBDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -287,6 +297,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_spectrumRate(6000), m_audioBinaural(false), @@ -581,6 +593,7 @@ void SSBDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -696,3 +709,8 @@ void SSBDemodGUI::makeUIConnections() QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &SSBDemodGUI::on_spanLog2_valueChanged); QObject::connect(ui->flipSidebands, &QPushButton::clicked, this, &SSBDemodGUI::on_flipSidebands_clicked); } + +void SSBDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodssb/ssbdemodgui.h b/plugins/channelrx/demodssb/ssbdemodgui.h index c520777fc..f5da7c3ed 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.h +++ b/plugins/channelrx/demodssb/ssbdemodgui.h @@ -53,6 +53,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; SSBDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; int m_spectrumRate; bool m_audioBinaural; @@ -82,6 +84,7 @@ private: void displayAGCThresholdGate(int value); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodvor/vordemod.cpp b/plugins/channelrx/demodvor/vordemod.cpp index e81f613c7..efb88b475 100644 --- a/plugins/channelrx/demodvor/vordemod.cpp +++ b/plugins/channelrx/demodvor/vordemod.cpp @@ -150,10 +150,8 @@ bool VORDemod::handleMessage(const Message& cmd) qDebug() << "VORDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) - { - rep = new DSPSignalNotification(notif); - m_guiMessageQueue->push(rep); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/demodvor/vordemodgui.cpp b/plugins/channelrx/demodvor/vordemodgui.cpp index 5ae5d0720..54cb5904b 100644 --- a/plugins/channelrx/demodvor/vordemodgui.cpp +++ b/plugins/channelrx/demodvor/vordemodgui.cpp @@ -764,7 +764,9 @@ bool VORDemodGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + updateAbsoluteCenterFrequency(); return true; } else if (VORDemodReport::MsgReportRadial::match(message)) @@ -1160,6 +1162,7 @@ VORDemodGUI::VORDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_squelchOpen(false), m_tickCount(0), @@ -1441,3 +1444,8 @@ void VORDemodGUI::makeUIConnections() QObject::connect(ui->getOpenAIPVORDB, &QPushButton::clicked, this, &VORDemodGUI::on_getOpenAIPVORDB_clicked); QObject::connect(ui->magDecAdjust, &QPushButton::clicked, this, &VORDemodGUI::on_magDecAdjust_clicked); } + +void VORDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency); +} diff --git a/plugins/channelrx/demodvor/vordemodgui.h b/plugins/channelrx/demodvor/vordemodgui.h index a1909572a..875cfdf9c 100644 --- a/plugins/channelrx/demodvor/vordemodgui.h +++ b/plugins/channelrx/demodvor/vordemodgui.h @@ -236,6 +236,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; VORDemodSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; VORDemod* m_vorDemod; @@ -263,6 +264,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodvorsc/vordemodsc.cpp b/plugins/channelrx/demodvorsc/vordemodsc.cpp index a373394ba..d4d3ea223 100644 --- a/plugins/channelrx/demodvorsc/vordemodsc.cpp +++ b/plugins/channelrx/demodvorsc/vordemodsc.cpp @@ -152,10 +152,8 @@ bool VORDemodSC::handleMessage(const Message& cmd) qDebug() << "VORDemodSC::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) - { - rep = new DSPSignalNotification(notif); - m_guiMessageQueue->push(rep); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/demodvorsc/vordemodscgui.cpp b/plugins/channelrx/demodvorsc/vordemodscgui.cpp index 361152963..9966497f8 100644 --- a/plugins/channelrx/demodvorsc/vordemodscgui.cpp +++ b/plugins/channelrx/demodvorsc/vordemodscgui.cpp @@ -91,7 +91,11 @@ bool VORDemodSCGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); return true; } else if (VORDemodSCReport::MsgReportRadial::match(message)) @@ -188,6 +192,7 @@ void VORDemodSCGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -277,6 +282,7 @@ VORDemodSCGUI::VORDemodSCGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas ui(new Ui::VORDemodSCGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), + m_deviceCenterFrequency(0), m_channelMarker(this), m_doApplySettings(true), m_squelchOpen(false), @@ -377,6 +383,7 @@ void VORDemodSCGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -456,3 +463,8 @@ void VORDemodSCGUI::makeUIConnections() QObject::connect(ui->squelch, &QDial::valueChanged, this, &VORDemodSCGUI::on_squelch_valueChanged); QObject::connect(ui->audioMute, &QToolButton::toggled, this, &VORDemodSCGUI::on_audioMute_toggled); } + +void VORDemodSCGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodvorsc/vordemodscgui.h b/plugins/channelrx/demodvorsc/vordemodscgui.h index c8fc4b8aa..a1534a077 100644 --- a/plugins/channelrx/demodvorsc/vordemodscgui.h +++ b/plugins/channelrx/demodvorsc/vordemodscgui.h @@ -68,6 +68,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; VORDemodSCSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; VORDemodSC* m_vorDemod; @@ -85,6 +86,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index c6c824f49..dfda76957 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -148,6 +148,10 @@ bool WFMDemod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "WFMDemod::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forwatd to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.cpp b/plugins/channelrx/demodwfm/wfmdemodgui.cpp index 723c4b43f..0e0862d69 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.cpp +++ b/plugins/channelrx/demodwfm/wfmdemodgui.cpp @@ -8,6 +8,7 @@ #include "ui_wfmdemodgui.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" @@ -56,7 +57,6 @@ bool WFMDemodGUI::deserialize(const QByteArray& data) bool WFMDemodGUI::handleMessage(const Message& message) { - (void) message; if (WFMDemod::MsgConfigureWFMDemod::match(message)) { qDebug("WFMDemodGUI::handleMessage: WFMDemod::MsgConfigureWFMDemod"); @@ -67,6 +67,16 @@ bool WFMDemodGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -102,6 +112,7 @@ void WFMDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -162,7 +173,6 @@ void WFMDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -201,6 +211,8 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_basicSettingsShown(false), m_squelchOpen(false), m_audioSampleRate(-1) @@ -299,6 +311,7 @@ void WFMDemodGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -375,3 +388,8 @@ void WFMDemodGUI::makeUIConnections() QObject::connect(ui->squelch, &QSlider::valueChanged, this, &WFMDemodGUI::on_squelch_valueChanged); QObject::connect(ui->audioMute, &QToolButton::toggled, this, &WFMDemodGUI::on_audioMute_toggled); } + +void WFMDemodGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.h b/plugins/channelrx/demodwfm/wfmdemodgui.h index 5894b8253..3c83d13d8 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.h +++ b/plugins/channelrx/demodwfm/wfmdemodgui.h @@ -48,6 +48,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; WFMDemodSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_basicSettingsShown; bool m_doApplySettings; bool m_audioMute; @@ -66,6 +68,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/filesink/filesink.cpp b/plugins/channelrx/filesink/filesink.cpp index cc7c17a23..f9491275b 100644 --- a/plugins/channelrx/filesink/filesink.cpp +++ b/plugins/channelrx/filesink/filesink.cpp @@ -170,10 +170,8 @@ bool FileSink::handleMessage(const Message& cmd) DSPSignalNotification *notif = new DSPSignalNotification(cfg); m_basebandSink->getInputMessageQueue()->push(notif); - if (getMessageQueueToGUI()) - { - DSPSignalNotification *notifToGUI = new DSPSignalNotification(cfg); - getMessageQueueToGUI()->push(notifToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(cfg)); } return true; diff --git a/plugins/channelrx/filesink/filesinkgui.cpp b/plugins/channelrx/filesink/filesinkgui.cpp index 0c4b6890b..cf1993061 100644 --- a/plugins/channelrx/filesink/filesinkgui.cpp +++ b/plugins/channelrx/filesink/filesinkgui.cpp @@ -76,7 +76,11 @@ bool FileSinkGUI::handleMessage(const Message& message) if (DSPSignalNotification::match(message)) { DSPSignalNotification notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); displayRate(); if (m_fixedPosition) @@ -178,6 +182,7 @@ FileSinkGUI::FileSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_running(false), m_fixedShiftIndex(0), m_basebandSampleRate(0), @@ -284,6 +289,7 @@ void FileSinkGUI::displaySettings() setPosFromFrequency(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -410,6 +416,7 @@ void FileSinkGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); setPosFromFrequency(); applySettings(); } @@ -542,6 +549,7 @@ void FileSinkGUI::setFrequencyFromPos() m_channelMarker.setCenterFrequency(inputFrequencyOffset); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); } void FileSinkGUI::setPosFromFrequency() @@ -609,3 +617,8 @@ void FileSinkGUI::makeUIConnections() QObject::connect(ui->record, &ButtonSwitch::toggled, this, &FileSinkGUI::on_record_toggled); QObject::connect(ui->showFileDialog, &QPushButton::clicked, this, &FileSinkGUI::on_showFileDialog_clicked); } + +void FileSinkGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/filesink/filesinkgui.h b/plugins/channelrx/filesink/filesinkgui.h index daec1f789..10a8da955 100644 --- a/plugins/channelrx/filesink/filesinkgui.h +++ b/plugins/channelrx/filesink/filesinkgui.h @@ -69,6 +69,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; FileSinkSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_running; int m_fixedShiftIndex; int m_basebandSampleRate; @@ -97,6 +98,7 @@ private: QString displayScaled(uint64_t value, int precision); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index d885a4c29..934e9f146 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -142,10 +142,8 @@ bool FreqTracker::handleMessage(const Message& cmd) qDebug() << "FreqTracker::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); - if (getMessageQueueToGUI()) - { - DSPSignalNotification *msg = new DSPSignalNotification(notif); - getMessageQueueToGUI()->push(msg); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/freqtracker/freqtrackergui.cpp b/plugins/channelrx/freqtracker/freqtrackergui.cpp index 1b91b8388..ba57f429e 100644 --- a/plugins/channelrx/freqtracker/freqtrackergui.cpp +++ b/plugins/channelrx/freqtracker/freqtrackergui.cpp @@ -90,7 +90,11 @@ bool FreqTrackerGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& cfg = (DSPSignalNotification&) message; + m_deviceCenterFrequency = cfg.getCenterFrequency(); m_basebandSampleRate = cfg.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); int sinkSampleRate = m_basebandSampleRate / (1<channelSampleRateText->setText(tr("%1k").arg(QString::number(sinkSampleRate / 1000.0f, 'g', 5))); displaySpectrumBandwidth(m_settings.m_spanLog2); @@ -147,6 +151,7 @@ void FreqTrackerGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -268,7 +273,6 @@ void FreqTrackerGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -308,6 +312,7 @@ FreqTrackerGUI::FreqTrackerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B m_deviceUISet(deviceUISet), m_channelMarker(this), m_pllChannelMarker(this), + m_deviceCenterFrequency(0), m_basebandSampleRate(0), m_doApplySettings(true), m_squelchOpen(false), @@ -438,6 +443,7 @@ void FreqTrackerGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -535,3 +541,8 @@ void FreqTrackerGUI::makeUIConnections() QObject::connect(ui->squelch, &QSlider::valueChanged, this, &FreqTrackerGUI::on_squelch_valueChanged); QObject::connect(ui->squelchGate, &QDial::valueChanged, this, &FreqTrackerGUI::on_squelchGate_valueChanged); } + +void FreqTrackerGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/freqtracker/freqtrackergui.h b/plugins/channelrx/freqtracker/freqtrackergui.h index 81990dd69..eb3cac976 100644 --- a/plugins/channelrx/freqtracker/freqtrackergui.h +++ b/plugins/channelrx/freqtracker/freqtrackergui.h @@ -70,6 +70,7 @@ private: ChannelMarker m_pllChannelMarker; RollupState m_rollupState; FreqTrackerSettings m_settings; + qint64 m_deviceCenterFrequency; int m_basebandSampleRate; bool m_doApplySettings; @@ -90,6 +91,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index dd0db8cba..abfd2f096 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -41,7 +41,6 @@ #include "localsink.h" MESSAGE_CLASS_DEFINITION(LocalSink::MsgConfigureLocalSink, Message) -MESSAGE_CLASS_DEFINITION(LocalSink::MsgBasebandSampleRateNotification, Message) const char* const LocalSink::m_channelIdURI = "sdrangel.channel.localsink"; const char* const LocalSink::m_channelId = "LocalSink"; @@ -138,10 +137,8 @@ bool LocalSink::handleMessage(const Message& cmd) DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency()); m_basebandSink->getInputMessageQueue()->push(msg); - if (getMessageQueueToGUI()) - { - MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(notif.getSampleRate()); - getMessageQueueToGUI()->push(msg); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/localsink/localsink.h b/plugins/channelrx/localsink/localsink.h index 41cc56a77..9dce4752a 100644 --- a/plugins/channelrx/localsink/localsink.h +++ b/plugins/channelrx/localsink/localsink.h @@ -61,26 +61,6 @@ public: { } }; - class MsgBasebandSampleRateNotification : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgBasebandSampleRateNotification* create(int sampleRate) { - return new MsgBasebandSampleRateNotification(sampleRate); - } - - int getSampleRate() const { return m_sampleRate; } - - private: - - MsgBasebandSampleRateNotification(int sampleRate) : - Message(), - m_sampleRate(sampleRate) - { } - - int m_sampleRate; - }; - LocalSink(DeviceAPI *deviceAPI); virtual ~LocalSink(); virtual void destroy() { delete this; } diff --git a/plugins/channelrx/localsink/localsinkgui.cpp b/plugins/channelrx/localsink/localsinkgui.cpp index 905dbab15..558c270c2 100644 --- a/plugins/channelrx/localsink/localsinkgui.cpp +++ b/plugins/channelrx/localsink/localsinkgui.cpp @@ -21,6 +21,7 @@ #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" #include "dsp/hbfilterchainconverter.h" +#include "dsp/dspcommands.h" #include "mainwindow.h" #include "localsinkgui.h" @@ -69,11 +70,13 @@ bool LocalSinkGUI::deserialize(const QByteArray& data) bool LocalSinkGUI::handleMessage(const Message& message) { - if (LocalSink::MsgBasebandSampleRateNotification::match(message)) + if (DSPSignalNotification::match(message)) { - LocalSink::MsgBasebandSampleRateNotification& notif = (LocalSink::MsgBasebandSampleRateNotification&) message; + DSPSignalNotification& notif = (DSPSignalNotification&) message; //m_channelMarker.setBandwidth(notif.getSampleRate()); + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + updateAbsoluteCenterFrequency(); displayRateAndShift(); return true; } @@ -98,6 +101,7 @@ LocalSinkGUI::LocalSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb ui(new Ui::LocalSinkGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), + m_deviceCenterFrequency(0), m_basebandSampleRate(0), m_tickCount(0) { @@ -363,6 +367,7 @@ void LocalSinkGUI::applyPosition() m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Decim, m_settings.m_filterChainHash, s); ui->filterChainText->setText(s); + updateAbsoluteCenterFrequency(); displayRateAndShift(); applySettings(); } @@ -382,3 +387,9 @@ void LocalSinkGUI::makeUIConnections() QObject::connect(ui->localDevicesRefresh, &QPushButton::clicked, this, &LocalSinkGUI::on_localDevicesRefresh_clicked); QObject::connect(ui->localDevicePlay, &ButtonSwitch::toggled, this, &LocalSinkGUI::on_localDevicePlay_toggled); } + +void LocalSinkGUI::updateAbsoluteCenterFrequency() +{ + int shift = m_shiftFrequencyFactor * m_basebandSampleRate; + setStatusFrequency(m_deviceCenterFrequency + shift); +} diff --git a/plugins/channelrx/localsink/localsinkgui.h b/plugins/channelrx/localsink/localsinkgui.h index 614f64dfd..a0f8c2b1c 100644 --- a/plugins/channelrx/localsink/localsinkgui.h +++ b/plugins/channelrx/localsink/localsinkgui.h @@ -64,6 +64,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; LocalSinkSettings m_settings; + qint64 m_deviceCenterFrequency; int m_basebandSampleRate; double m_shiftFrequencyFactor; //!< Channel frequency shift factor bool m_doApplySettings; @@ -85,6 +86,7 @@ private: int getLocalDeviceIndexInCombo(int localDeviceIndex); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/noisefigure/noisefigure.cpp b/plugins/channelrx/noisefigure/noisefigure.cpp index 4c6851bf0..0953a028c 100644 --- a/plugins/channelrx/noisefigure/noisefigure.cpp +++ b/plugins/channelrx/noisefigure/noisefigure.cpp @@ -445,10 +445,8 @@ bool NoiseFigure::handleMessage(const Message& cmd) qDebug() << "NoiseFigure::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); // Forward to GUI if any - if (m_guiMessageQueue) - { - rep = new DSPSignalNotification(notif); - m_guiMessageQueue->push(rep); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/noisefigure/noisefiguregui.cpp b/plugins/channelrx/noisefigure/noisefiguregui.cpp index f70b07ceb..0f9a9c23f 100644 --- a/plugins/channelrx/noisefigure/noisefiguregui.cpp +++ b/plugins/channelrx/noisefigure/noisefiguregui.cpp @@ -269,7 +269,11 @@ bool NoiseFigureGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getSampleRate(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); updateBW(); return true; } @@ -323,6 +327,7 @@ void NoiseFigureGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -587,6 +592,7 @@ NoiseFigureGUI::NoiseFigureGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_basebandSampleRate(1000000), m_tickCount(0), @@ -747,6 +753,7 @@ void NoiseFigureGUI::displaySettings() } getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -810,3 +817,8 @@ void NoiseFigureGUI::makeUIConnections() QObject::connect(ui->openReference, &QToolButton::clicked, this, &NoiseFigureGUI::on_openReference_clicked); QObject::connect(ui->clearReference, &QToolButton::clicked, this, &NoiseFigureGUI::on_clearReference_clicked); } + +void NoiseFigureGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/noisefigure/noisefiguregui.h b/plugins/channelrx/noisefigure/noisefiguregui.h index 95981be46..c04a7e12e 100644 --- a/plugins/channelrx/noisefigure/noisefiguregui.h +++ b/plugins/channelrx/noisefigure/noisefiguregui.h @@ -75,6 +75,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; NoiseFigureSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; NoiseFigure* m_noiseFigure; @@ -101,6 +102,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 1fd786728..fb73a4a6a 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -973,10 +973,16 @@ bool RadioAstronomyGUI::handleMessage(const Message& message) DSPSignalNotification& notif = (DSPSignalNotification&) message; m_basebandSampleRate = notif.getSampleRate(); m_centerFrequency = notif.getCenterFrequency(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + if (m_settings.m_tempGalLink) { calcGalacticBackgroundTemp(); } + updateTSys0(); + return true; } else if (RadioAstronomy::MsgReportAvailableFeatures::match(message)) @@ -1199,6 +1205,7 @@ void RadioAstronomyGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -1997,6 +2004,7 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_basebandSampleRate(0), m_centerFrequency(0), @@ -2555,6 +2563,7 @@ void RadioAstronomyGUI::displaySettings() } getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); getRollupContents()->arrangeRollups(); } @@ -6145,3 +6154,8 @@ void RadioAstronomyGUI::makeUIConnections() QObject::connect(ui->powerColourPalette, QOverload::of(&QComboBox::currentIndexChanged), this, &RadioAstronomyGUI::on_powerColourPalette_currentIndexChanged); QObject::connect(ui->powerTable, &QTableWidget::cellDoubleClicked, this, &RadioAstronomyGUI::on_powerTable_cellDoubleClicked); } + +void RadioAstronomyGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.h b/plugins/channelrx/radioastronomy/radioastronomygui.h index e40761d1c..d82e265d4 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.h +++ b/plugins/channelrx/radioastronomy/radioastronomygui.h @@ -218,6 +218,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; RadioAstronomySettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; QList m_availableFeatures; @@ -333,6 +334,7 @@ private: void updateRotatorList(const QList& rotators); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); double degreesToSteradian(double deg) const; double hpbwToSteradians(double hpbw) const; diff --git a/plugins/channelrx/radioclock/radioclock.cpp b/plugins/channelrx/radioclock/radioclock.cpp index f4c56359d..14b9437ef 100644 --- a/plugins/channelrx/radioclock/radioclock.cpp +++ b/plugins/channelrx/radioclock/radioclock.cpp @@ -165,6 +165,10 @@ bool RadioClock::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "RadioClock::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/radioclock/radioclockgui.cpp b/plugins/channelrx/radioclock/radioclockgui.cpp index 19000cd14..f660370ac 100644 --- a/plugins/channelrx/radioclock/radioclockgui.cpp +++ b/plugins/channelrx/radioclock/radioclockgui.cpp @@ -132,6 +132,16 @@ bool RadioClockGUI::handleMessage(const Message& message) ui->status->setText(report.getStatus()); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } return false; } @@ -165,6 +175,7 @@ void RadioClockGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -266,6 +277,8 @@ RadioClockGUI::RadioClockGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_tickCount(0) { @@ -372,6 +385,7 @@ void RadioClockGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -422,3 +436,8 @@ void RadioClockGUI::makeUIConnections() QObject::connect(ui->modulation, QOverload::of(&QComboBox::currentIndexChanged), this, &RadioClockGUI::on_modulation_currentIndexChanged); QObject::connect(ui->timezone, QOverload::of(&QComboBox::currentIndexChanged), this, &RadioClockGUI::on_timezone_currentIndexChanged); } + +void RadioClockGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/radioclock/radioclockgui.h b/plugins/channelrx/radioclock/radioclockgui.h index fe39104f9..c5691d9bc 100644 --- a/plugins/channelrx/radioclock/radioclockgui.h +++ b/plugins/channelrx/radioclock/radioclockgui.h @@ -71,6 +71,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; RadioClockSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ScopeVis* m_scopeVis; @@ -89,6 +91,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void displayDateTime(); diff --git a/plugins/channelrx/remotesink/remotesink.cpp b/plugins/channelrx/remotesink/remotesink.cpp index 232b35a0f..00e6ef750 100644 --- a/plugins/channelrx/remotesink/remotesink.cpp +++ b/plugins/channelrx/remotesink/remotesink.cpp @@ -155,10 +155,8 @@ bool RemoteSink::handleMessage(const Message& cmd) m_basebandSink->getInputMessageQueue()->push(msgToBaseband); // Forward to the GUI - if (getMessageQueueToGUI()) - { - DSPSignalNotification* msgToGUI = new DSPSignalNotification(notif); // make a copy - getMessageQueueToGUI()->push(msgToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channelrx/remotesink/remotesinkgui.cpp b/plugins/channelrx/remotesink/remotesinkgui.cpp index fee089eb3..c2c114c4c 100644 --- a/plugins/channelrx/remotesink/remotesinkgui.cpp +++ b/plugins/channelrx/remotesink/remotesinkgui.cpp @@ -79,6 +79,7 @@ bool RemoteSinkGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& cfg = (DSPSignalNotification&) message; + m_deviceCenterFrequency = cfg.getCenterFrequency(); m_basebandSampleRate = cfg.getSampleRate(); qDebug("RemoteSinkGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: %d", m_basebandSampleRate); displayRateAndShift(); @@ -97,6 +98,7 @@ RemoteSinkGUI::RemoteSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_basebandSampleRate(0), + m_deviceCenterFrequency(0), m_tickCount(0) { ui->setupUi(getRollupContents()); @@ -176,6 +178,7 @@ void RemoteSinkGUI::displaySettings() applyDecimation(); displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -366,6 +369,7 @@ void RemoteSinkGUI::applyPosition() m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Decim, m_settings.m_filterChainHash, s); ui->filterChainText->setText(s); + updateAbsoluteCenterFrequency(); displayRateAndShift(); applySettings(); } @@ -387,3 +391,9 @@ void RemoteSinkGUI::makeUIConnections() QObject::connect(ui->nbFECBlocks, &QDial::valueChanged, this, &RemoteSinkGUI::on_nbFECBlocks_valueChanged); QObject::connect(ui->nbTxBytes, QOverload::of(&QComboBox::currentIndexChanged), this, &RemoteSinkGUI::on_nbTxBytes_currentIndexChanged); } + +void RemoteSinkGUI::updateAbsoluteCenterFrequency() +{ + int shift = m_shiftFrequencyFactor * m_basebandSampleRate; + setStatusFrequency(m_deviceCenterFrequency + shift); +} diff --git a/plugins/channelrx/remotesink/remotesinkgui.h b/plugins/channelrx/remotesink/remotesinkgui.h index 10695448c..84332a6fe 100644 --- a/plugins/channelrx/remotesink/remotesinkgui.h +++ b/plugins/channelrx/remotesink/remotesinkgui.h @@ -84,6 +84,7 @@ private: void displayRateAndShift(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp index 5f1bb3828..ffe624604 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp +++ b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp @@ -170,10 +170,8 @@ bool SigMFFileSink::handleMessage(const Message& cmd) DSPSignalNotification *notif = new DSPSignalNotification(cfg); m_basebandSink->getInputMessageQueue()->push(notif); - if (getMessageQueueToGUI()) - { - DSPSignalNotification *notifToGUI = new DSPSignalNotification(cfg); - getMessageQueueToGUI()->push(notifToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(cfg)); } return true; diff --git a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp index f7fda943b..f94e3b221 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp +++ b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.cpp @@ -75,7 +75,10 @@ bool SigMFFileSinkGUI::handleMessage(const Message& message) if (DSPSignalNotification::match(message)) { DSPSignalNotification notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); displayRate(); if (m_fixedPosition) @@ -165,6 +168,7 @@ SigMFFileSinkGUI::SigMFFileSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISe m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_running(false), m_fixedShiftIndex(0), m_basebandSampleRate(0), @@ -277,6 +281,7 @@ void SigMFFileSinkGUI::displaySettings() setPosFromFrequency(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -403,6 +408,7 @@ void SigMFFileSinkGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); setPosFromFrequency(); applySettings(); } @@ -537,6 +543,7 @@ void SigMFFileSinkGUI::setFrequencyFromPos() m_channelMarker.setCenterFrequency(inputFrequencyOffset); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); } void SigMFFileSinkGUI::setPosFromFrequency() @@ -604,3 +611,8 @@ void SigMFFileSinkGUI::makeUIConnections() QObject::connect(ui->record, &ButtonSwitch::toggled, this, &SigMFFileSinkGUI::on_record_toggled); QObject::connect(ui->showFileDialog, &QPushButton::clicked, this, &SigMFFileSinkGUI::on_showFileDialog_clicked); } + +void SigMFFileSinkGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.h b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.h index 687dc3bf2..2813e6f44 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesinkgui.h +++ b/plugins/channelrx/sigmffilesink/sigmffilesinkgui.h @@ -69,6 +69,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; SigMFFileSinkSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_running; int m_fixedShiftIndex; int m_basebandSampleRate; @@ -97,6 +98,7 @@ private: QString displayScaled(uint64_t value, int precision); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channelrx/udpsink/udpsink.cpp b/plugins/channelrx/udpsink/udpsink.cpp index 223e9b6e4..4db88391c 100644 --- a/plugins/channelrx/udpsink/udpsink.cpp +++ b/plugins/channelrx/udpsink/udpsink.cpp @@ -141,6 +141,10 @@ bool UDPSink::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "UDPSink::handleMessage: DSPSignalNotification"; m_basebandSink->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channelrx/udpsink/udpsinkgui.cpp b/plugins/channelrx/udpsink/udpsinkgui.cpp index 8010b2d41..c2c9baaf4 100644 --- a/plugins/channelrx/udpsink/udpsinkgui.cpp +++ b/plugins/channelrx/udpsink/udpsinkgui.cpp @@ -20,6 +20,7 @@ #include "plugin/pluginapi.h" #include "dsp/spectrumvis.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingsdialog.h" @@ -81,6 +82,16 @@ bool UDPSinkGUI::handleMessage(const Message& message ) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -139,7 +150,9 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS ui(new Ui::UDPSinkGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), - m_udpSink(0), + m_udpSink(nullptr), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_channelMarker(this), m_channelPowerAvg(4, 1e-10), m_inPowerAvg(4, 1e-10), @@ -262,6 +275,7 @@ void UDPSinkGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); ui->glSpectrum->setSampleRate(m_settings.m_outputSampleRate); @@ -399,6 +413,7 @@ void UDPSinkGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -611,7 +626,6 @@ void UDPSinkGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -673,3 +687,8 @@ void UDPSinkGUI::makeUIConnections() QObject::connect(ui->squelchGate, &QDial::valueChanged, this, &UDPSinkGUI::on_squelchGate_valueChanged); QObject::connect(ui->agc, &ButtonSwitch::toggled, this, &UDPSinkGUI::on_agc_toggled); } + +void UDPSinkGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channelrx/udpsink/udpsinkgui.h b/plugins/channelrx/udpsink/udpsinkgui.h index 8c58d6dd7..cce4e24be 100644 --- a/plugins/channelrx/udpsink/udpsinkgui.h +++ b/plugins/channelrx/udpsink/udpsinkgui.h @@ -68,6 +68,8 @@ private: DeviceUISet* m_deviceUISet; UDPSink* m_udpSink; UDPSinkSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; ChannelMarker m_channelMarker; RollupState m_rollupState; MovingAverage m_channelPowerAvg; @@ -94,6 +96,7 @@ private: void setSampleFormatIndex(const UDPSinkSettings::SampleFormat& sampleFormat); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/filesource/filesource.cpp b/plugins/channeltx/filesource/filesource.cpp index c2035b8e7..2bb39a9b0 100644 --- a/plugins/channeltx/filesource/filesource.cpp +++ b/plugins/channeltx/filesource/filesource.cpp @@ -40,7 +40,6 @@ #include "filesourcebaseband.h" -MESSAGE_CLASS_DEFINITION(FileSource::MsgSampleRateNotification, Message) MESSAGE_CLASS_DEFINITION(FileSource::MsgConfigureFileSource, Message) MESSAGE_CLASS_DEFINITION(FileSource::MsgConfigureFileSourceWork, Message) MESSAGE_CLASS_DEFINITION(FileSource::MsgConfigureFileSourceStreamTiming, Message) @@ -134,8 +133,7 @@ bool FileSource::handleMessage(const Message& cmd) if (m_guiMessageQueue) { qDebug() << "FileSource::handleMessage: DSPSignalNotification: push to GUI"; - MsgSampleRateNotification *msg = MsgSampleRateNotification::create(notif.getSampleRate()); - m_guiMessageQueue->push(msg); + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channeltx/filesource/filesource.h b/plugins/channeltx/filesource/filesource.h index 0695b3af4..9b7db6307 100644 --- a/plugins/channeltx/filesource/filesource.h +++ b/plugins/channeltx/filesource/filesource.h @@ -67,26 +67,6 @@ public: { } }; - class MsgSampleRateNotification : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgSampleRateNotification* create(int sampleRate) { - return new MsgSampleRateNotification(sampleRate); - } - - int getSampleRate() const { return m_sampleRate; } - - private: - - MsgSampleRateNotification(int sampleRate) : - Message(), - m_sampleRate(sampleRate) - { } - - int m_sampleRate; - }; - class MsgConfigureFileSourceWork : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channeltx/filesource/filesourcegui.cpp b/plugins/channeltx/filesource/filesourcegui.cpp index 06e0217d1..4fa0fcc23 100644 --- a/plugins/channeltx/filesource/filesourcegui.cpp +++ b/plugins/channeltx/filesource/filesourcegui.cpp @@ -22,6 +22,7 @@ #include "device/deviceapi.h" #include "device/deviceuiset.h" #include "dsp/hbfilterchainconverter.h" +#include "dsp/dspcommands.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" #include "util/db.h" @@ -70,10 +71,12 @@ bool FileSourceGUI::deserialize(const QByteArray& data) bool FileSourceGUI::handleMessage(const Message& message) { - if (FileSource::MsgSampleRateNotification::match(message)) + if (DSPSignalNotification::match(message)) { - FileSource::MsgSampleRateNotification& notif = (FileSource::MsgSampleRateNotification&) message; + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_sampleRate = notif.getSampleRate(); + updateAbsoluteCenterFrequency(); displayRateAndShift(); return true; } @@ -165,6 +168,7 @@ FileSourceGUI::FileSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas ui(new Ui::FileSourceGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), + m_deviceCenterFrequency(0), m_sampleRate(0), m_shiftFrequencyFactor(0.0), m_fileSampleRate(0), @@ -315,6 +319,7 @@ void FileSourceGUI::displaySettings() ui->interpolationFactor->setCurrentIndex(m_settings.m_log2Interp); applyInterpolation(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -497,6 +502,7 @@ void FileSourceGUI::applyPosition() m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Interp, m_settings.m_filterChainHash, s); ui->filterChainText->setText(s); + updateAbsoluteCenterFrequency(); displayRateAndShift(); applySettings(); } @@ -540,3 +546,9 @@ void FileSourceGUI::makeUIConnections() QObject::connect(ui->play, &ButtonSwitch::toggled, this, &FileSourceGUI::on_play_toggled); QObject::connect(ui->navTime, &QSlider::valueChanged, this, &FileSourceGUI::on_navTime_valueChanged); } + +void FileSourceGUI::updateAbsoluteCenterFrequency() +{ + int shift = m_shiftFrequencyFactor * m_sampleRate; + setStatusFrequency(m_deviceCenterFrequency + shift); +} diff --git a/plugins/channeltx/filesource/filesourcegui.h b/plugins/channeltx/filesource/filesourcegui.h index a270bdbae..7f5c227c7 100644 --- a/plugins/channeltx/filesource/filesourcegui.h +++ b/plugins/channeltx/filesource/filesourcegui.h @@ -64,6 +64,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; FileSourceSettings m_settings; + qint64 m_deviceCenterFrequency; int m_sampleRate; double m_shiftFrequencyFactor; //!< Channel frequency shift factor int m_fileSampleRate; @@ -94,6 +95,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/localsource/localsource.cpp b/plugins/channeltx/localsource/localsource.cpp index 99898a739..7e1bef605 100644 --- a/plugins/channeltx/localsource/localsource.cpp +++ b/plugins/channeltx/localsource/localsource.cpp @@ -38,7 +38,6 @@ #include "localsourcebaseband.h" MESSAGE_CLASS_DEFINITION(LocalSource::MsgConfigureLocalSource, Message) -MESSAGE_CLASS_DEFINITION(LocalSource::MsgBasebandSampleRateNotification, Message) const char* const LocalSource::m_channelIdURI = "sdrangel.channel.localsource"; const char* const LocalSource::m_channelId = "LocalSource"; @@ -122,10 +121,8 @@ bool LocalSource::handleMessage(const Message& cmd) DSPSignalNotification *msg = new DSPSignalNotification(cfg.getSampleRate(), cfg.getCenterFrequency()); m_basebandSource->getInputMessageQueue()->push(msg); - if (m_guiMessageQueue) - { - MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(cfg.getSampleRate()); - m_guiMessageQueue->push(msg); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(cfg)); } return true; diff --git a/plugins/channeltx/localsource/localsource.h b/plugins/channeltx/localsource/localsource.h index 76639d3ea..889ebc125 100644 --- a/plugins/channeltx/localsource/localsource.h +++ b/plugins/channeltx/localsource/localsource.h @@ -60,26 +60,6 @@ public: { } }; - class MsgBasebandSampleRateNotification : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgBasebandSampleRateNotification* create(int sampleRate) { - return new MsgBasebandSampleRateNotification(sampleRate); - } - - int getBasebandSampleRate() const { return m_sampleRate; } - - private: - - MsgBasebandSampleRateNotification(int sampleRate) : - Message(), - m_sampleRate(sampleRate) - { } - - int m_sampleRate; - }; - LocalSource(DeviceAPI *deviceAPI); virtual ~LocalSource(); virtual void destroy() { delete this; } diff --git a/plugins/channeltx/localsource/localsourcegui.cpp b/plugins/channeltx/localsource/localsourcegui.cpp index 00866ccea..d16375d26 100644 --- a/plugins/channeltx/localsource/localsourcegui.cpp +++ b/plugins/channeltx/localsource/localsourcegui.cpp @@ -21,6 +21,7 @@ #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" #include "dsp/hbfilterchainconverter.h" +#include "dsp/dspcommands.h" #include "mainwindow.h" #include "localsourcegui.h" @@ -64,10 +65,12 @@ bool LocalSourceGUI::deserialize(const QByteArray& data) bool LocalSourceGUI::handleMessage(const Message& message) { - if (LocalSource::MsgBasebandSampleRateNotification::match(message)) + if (DSPSignalNotification::match(message)) { - LocalSource::MsgBasebandSampleRateNotification& notif = (LocalSource::MsgBasebandSampleRateNotification&) message; - m_basebandSampleRate = notif.getBasebandSampleRate(); + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + updateAbsoluteCenterFrequency(); displayRateAndShift(); return true; } @@ -93,6 +96,7 @@ LocalSourceGUI::LocalSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_basebandSampleRate(0), + m_deviceCenterFrequency(0), m_tickCount(0) { ui->setupUi(getRollupContents()); @@ -168,6 +172,7 @@ void LocalSourceGUI::displaySettings() ui->localDevicePlay->setChecked(m_settings.m_play); applyInterpolation(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -332,6 +337,7 @@ void LocalSourceGUI::applyPosition() m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Interp, m_settings.m_filterChainHash, s); ui->filterChainText->setText(s); + updateAbsoluteCenterFrequency(); displayRateAndShift(); applySettings(); } @@ -351,3 +357,9 @@ void LocalSourceGUI::makeUIConnections() QObject::connect(ui->localDevicesRefresh, &QPushButton::clicked, this, &LocalSourceGUI::on_localDevicesRefresh_clicked); QObject::connect(ui->localDevicePlay, &ButtonSwitch::toggled, this, &LocalSourceGUI::on_localDevicePlay_toggled); } + +void LocalSourceGUI::updateAbsoluteCenterFrequency() +{ + int shift = m_shiftFrequencyFactor * m_basebandSampleRate; + setStatusFrequency(m_deviceCenterFrequency + shift); +} diff --git a/plugins/channeltx/localsource/localsourcegui.h b/plugins/channeltx/localsource/localsourcegui.h index 5ae429b53..3dc9b8908 100644 --- a/plugins/channeltx/localsource/localsourcegui.h +++ b/plugins/channeltx/localsource/localsourcegui.h @@ -85,6 +85,7 @@ private: void updateLocalDevices(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp index 8138c9078..029063a44 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp @@ -145,10 +145,8 @@ bool IEEE_802_15_4_Mod::handleMessage(const Message& cmd) m_basebandSource->getInputMessageQueue()->push(rep); // Forward to GUI - if (getMessageQueueToGUI()) - { - DSPSignalNotification *notifToGUI = new DSPSignalNotification(notif); - getMessageQueueToGUI()->push(notifToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.cpp b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.cpp index b97f63e6f..bf811a207 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.cpp +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.cpp @@ -104,7 +104,11 @@ bool IEEE_802_15_4_ModGUI::handleMessage(const Message& message) if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); m_scopeVis->setLiveRate(m_basebandSampleRate); checkSampleRate(); return true; @@ -172,6 +176,7 @@ void IEEE_802_15_4_ModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -332,7 +337,6 @@ void IEEE_802_15_4_ModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -371,6 +375,7 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_doApplySettings(true), m_basebandSampleRate(12000000) { @@ -566,6 +571,7 @@ void IEEE_802_15_4_ModGUI::displaySettings() ui->udpPort->setText(QString::number(m_settings.m_udpPort)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -639,3 +645,8 @@ void IEEE_802_15_4_ModGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &IEEE_802_15_4_ModGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &IEEE_802_15_4_ModGUI::on_udpPort_editingFinished); } + +void IEEE_802_15_4_ModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.h index 59df48f6d..a7f9266d6 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_modgui.h @@ -74,6 +74,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; IEEE_802_15_4_ModSettings m_settings; + qint64 m_deviceCenterFrequency; bool m_doApplySettings; SpectrumVis* m_spectrumVis; ScopeVis* m_scopeVis; @@ -98,6 +99,7 @@ private: QString getDisplayValueWithMultiplier(int value); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modais/aismod.cpp b/plugins/channeltx/modais/aismod.cpp index 22f71d38f..40eccd9a4 100644 --- a/plugins/channeltx/modais/aismod.cpp +++ b/plugins/channeltx/modais/aismod.cpp @@ -164,6 +164,10 @@ bool AISMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "AISMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } else if (MainCore::MsgChannelDemodQuery::match(cmd)) diff --git a/plugins/channeltx/modais/aismodgui.cpp b/plugins/channeltx/modais/aismodgui.cpp index 3c21a40fa..7a1fec6cd 100644 --- a/plugins/channeltx/modais/aismodgui.cpp +++ b/plugins/channeltx/modais/aismodgui.cpp @@ -25,6 +25,7 @@ #include "dsp/spectrumvis.h" #include "dsp/scopevis.h" #include "dsp/glscopesettings.h" +#include "dsp/dspcommands.h" #include "device/deviceuiset.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" @@ -96,6 +97,16 @@ bool AISModGUI::handleMessage(const Message& message) ui->message->setText(m_settings.m_data); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -127,6 +138,7 @@ void AISModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -348,7 +360,6 @@ void AISModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -387,6 +398,8 @@ AISModGUI::AISModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true) { ui->setupUi(getRollupContents()); @@ -557,6 +570,7 @@ void AISModGUI::displaySettings() ui->message->setText(m_settings.m_data); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -613,3 +627,8 @@ void AISModGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &AISModGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &AISModGUI::on_udpPort_editingFinished); } + +void AISModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modais/aismodgui.h b/plugins/channeltx/modais/aismodgui.h index 3ceea99bb..502d5eb0b 100644 --- a/plugins/channeltx/modais/aismodgui.h +++ b/plugins/channeltx/modais/aismodgui.h @@ -68,6 +68,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; AISModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; SpectrumVis* m_spectrumVis; ScopeVis* m_scopeVis; @@ -87,6 +89,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index d1f80abfd..e50093b66 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -196,6 +196,10 @@ bool AMMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "AMMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modam/ammodgui.cpp b/plugins/channeltx/modam/ammodgui.cpp index f80e21bfb..e73ee98ef 100644 --- a/plugins/channeltx/modam/ammodgui.cpp +++ b/plugins/channeltx/modam/ammodgui.cpp @@ -28,6 +28,7 @@ #include "util/db.h" #include "dsp/dspengine.h" #include "dsp/cwkeyer.h" +#include "dsp/dspcommands.h" #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "gui/basicchannelsettingsdialog.h" @@ -105,6 +106,16 @@ bool AMModGUI::handleMessage(const Message& message) ui->cwKeyerGUI->displaySettings(); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -135,6 +146,7 @@ void AMModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = value; + updateAbsoluteCenterFrequency(); applySettings(); } @@ -288,7 +300,6 @@ void AMModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -327,6 +338,8 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_recordLength(0), m_recordSampleRate(48000), @@ -462,6 +475,7 @@ void AMModGUI::displaySettings() displayStreamIndex(); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -601,3 +615,8 @@ void AMModGUI::makeUIConnections() QObject::connect(ui->feedbackEnable, &QToolButton::toggled, this, &AMModGUI::on_feedbackEnable_toggled); QObject::connect(ui->feedbackVolume, &QDial::valueChanged, this, &AMModGUI::on_feedbackVolume_valueChanged); } + +void AMModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modam/ammodgui.h b/plugins/channeltx/modam/ammodgui.h index 5577ab9ec..c9ec32652 100644 --- a/plugins/channeltx/modam/ammodgui.h +++ b/plugins/channeltx/modam/ammodgui.h @@ -67,6 +67,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; AMModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; AMMod* m_amMod; @@ -93,6 +95,7 @@ private: void updateWithStreamTime(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 5377e20a6..c39f1723c 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -161,6 +161,10 @@ bool ATVMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "ATVMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modatv/atvmodgui.cpp b/plugins/channeltx/modatv/atvmodgui.cpp index 460d68cad..ec5e1ea7a 100644 --- a/plugins/channeltx/modatv/atvmodgui.cpp +++ b/plugins/channeltx/modatv/atvmodgui.cpp @@ -28,6 +28,7 @@ #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "util/db.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" @@ -54,6 +55,8 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_videoLength(0), m_videoFrameRate(48000), @@ -228,6 +231,16 @@ bool ATVModGUI::handleMessage(const Message& message) ui->videoFileText->setText(cfg.getFileName()); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -435,6 +448,7 @@ void ATVModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = value; + updateAbsoluteCenterFrequency(); applySettings(); } @@ -691,7 +705,6 @@ void ATVModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -801,6 +814,7 @@ void ATVModGUI::displaySettings() ui->playLoop->setChecked(m_settings.m_videoPlayLoop); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -899,3 +913,8 @@ void ATVModGUI::makeUIConnections() QObject::connect(ui->overlayTextShow, &ButtonSwitch::toggled, this, &ATVModGUI::on_overlayTextShow_toggled); QObject::connect(ui->overlayText, &QLineEdit::textEdited, this, &ATVModGUI::on_overlayText_textEdited); } + +void ATVModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modatv/atvmodgui.h b/plugins/channeltx/modatv/atvmodgui.h index 2c6c90604..b6fbd5af3 100644 --- a/plugins/channeltx/modatv/atvmodgui.h +++ b/plugins/channeltx/modatv/atvmodgui.h @@ -66,6 +66,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ATVModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; ATVMod* m_atvMod; @@ -99,6 +101,7 @@ private: int getFPSIndex(int fps); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modchirpchat/chirpchatmod.cpp b/plugins/channeltx/modchirpchat/chirpchatmod.cpp index dc849b71b..4ed11d89b 100644 --- a/plugins/channeltx/modchirpchat/chirpchatmod.cpp +++ b/plugins/channeltx/modchirpchat/chirpchatmod.cpp @@ -132,10 +132,8 @@ bool ChirpChatMod::handleMessage(const Message& cmd) m_basebandSource->getInputMessageQueue()->push(rep); // Forward to the GUI - if (getMessageQueueToGUI()) - { - DSPSignalNotification* repToGUI = new DSPSignalNotification(notif); // make a copy - getMessageQueueToGUI()->push(repToGUI); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channeltx/modchirpchat/chirpchatmodgui.cpp b/plugins/channeltx/modchirpchat/chirpchatmodgui.cpp index 6390a39ec..a7623d984 100644 --- a/plugins/channeltx/modchirpchat/chirpchatmodgui.cpp +++ b/plugins/channeltx/modchirpchat/chirpchatmodgui.cpp @@ -102,6 +102,7 @@ bool ChirpChatModGUI::handleMessage(const Message& message) else if (DSPSignalNotification::match(message)) { DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); int basebandSampleRate = notif.getSampleRate(); qDebug() << "ChirpChatModGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: " << basebandSampleRate; @@ -111,6 +112,10 @@ bool ChirpChatModGUI::handleMessage(const Message& message) setBandwidths(); } + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; } else @@ -143,6 +148,7 @@ void ChirpChatModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -374,7 +380,6 @@ void ChirpChatModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -413,6 +418,7 @@ ChirpChatModGUI::ChirpChatModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), m_basebandSampleRate(125000), m_doApplySettings(true), m_tickCount(0) @@ -530,6 +536,7 @@ void ChirpChatModGUI::displaySettings() ui->udpAddress->setText(m_settings.m_udpAddress); ui->udpPort->setText(QString::number(m_settings.m_udpPort)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -653,3 +660,8 @@ void ChirpChatModGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &ChirpChatModGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &ChirpChatModGUI::on_udpPort_editingFinished); } + +void ChirpChatModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modchirpchat/chirpchatmodgui.h b/plugins/channeltx/modchirpchat/chirpchatmodgui.h index 78fd53653..ce012587b 100644 --- a/plugins/channeltx/modchirpchat/chirpchatmodgui.h +++ b/plugins/channeltx/modchirpchat/chirpchatmodgui.h @@ -65,6 +65,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ChirpChatModSettings m_settings; + qint64 m_deviceCenterFrequency; int m_basebandSampleRate; bool m_doApplySettings; @@ -86,6 +87,7 @@ private: void setBandwidths(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/moddatv/datvmod.cpp b/plugins/channeltx/moddatv/datvmod.cpp index 2cbe26e06..796ebd9b9 100644 --- a/plugins/channeltx/moddatv/datvmod.cpp +++ b/plugins/channeltx/moddatv/datvmod.cpp @@ -164,6 +164,10 @@ bool DATVMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); qDebug() << "DATVMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/moddatv/datvmodgui.cpp b/plugins/channeltx/moddatv/datvmodgui.cpp index 3d83a96b6..837452b17 100644 --- a/plugins/channeltx/moddatv/datvmodgui.cpp +++ b/plugins/channeltx/moddatv/datvmodgui.cpp @@ -29,6 +29,7 @@ #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "util/db.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" @@ -55,6 +56,8 @@ DATVModGUI::DATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_tickMsgOutstanding(false), m_streamLength(0), @@ -208,6 +211,17 @@ bool DATVModGUI::handleMessage(const Message& message) ui->tsFileText->setText(m_settings.m_tsFileName); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + + } else { return false; @@ -238,6 +252,7 @@ void DATVModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = value; + updateAbsoluteCenterFrequency(); applySettings(); } @@ -493,7 +508,6 @@ void DATVModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -586,6 +600,7 @@ void DATVModGUI::displaySettings() ui->udpPort->setValue(m_settings.m_udpPort); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -684,3 +699,8 @@ void DATVModGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &DATVModGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, QOverload::of(&QSpinBox::valueChanged), this, &DATVModGUI::on_udpPort_valueChanged); } + +void DATVModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/moddatv/datvmodgui.h b/plugins/channeltx/moddatv/datvmodgui.h index ea24d775f..f0aba1bb8 100644 --- a/plugins/channeltx/moddatv/datvmodgui.h +++ b/plugins/channeltx/moddatv/datvmodgui.h @@ -67,6 +67,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; DATVModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; bool m_tickMsgOutstanding; @@ -95,6 +97,7 @@ private: void setChannelMarkerBandwidth(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void updateFEC(); diff --git a/plugins/channeltx/modfreedv/freedvmod.cpp b/plugins/channeltx/modfreedv/freedvmod.cpp index dd3d4a004..bee8aa146 100644 --- a/plugins/channeltx/modfreedv/freedvmod.cpp +++ b/plugins/channeltx/modfreedv/freedvmod.cpp @@ -196,6 +196,10 @@ bool FreeDVMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "FreeDVMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modfreedv/freedvmodgui.cpp b/plugins/channeltx/modfreedv/freedvmodgui.cpp index be987aa4b..55fa8dcdf 100644 --- a/plugins/channeltx/modfreedv/freedvmodgui.cpp +++ b/plugins/channeltx/modfreedv/freedvmodgui.cpp @@ -99,6 +99,16 @@ bool FreeDVModGUI::handleMessage(const Message& message) applyBandwidths(5 - ui->spanLog2->value()); // will update spectrum details with new sample rate return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else if (FreeDVMod::MsgConfigureFreeDVMod::match(message)) { const FreeDVMod::MsgConfigureFreeDVMod& cfg = (FreeDVMod::MsgConfigureFreeDVMod&) message; @@ -154,6 +164,7 @@ void FreeDVModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -302,7 +313,6 @@ void FreeDVModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -341,6 +351,8 @@ FreeDVModGUI::FreeDVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_spectrumRate(6000), m_recordLength(0), @@ -506,6 +518,7 @@ void FreeDVModGUI::displaySettings() ui->morseKeyer->setChecked(m_settings.m_modAFInput == FreeDVModSettings::FreeDVModInputAF::FreeDVModInputCWTone); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -617,3 +630,8 @@ void FreeDVModGUI::makeUIConnections() QObject::connect(ui->navTimeSlider, &QSlider::valueChanged, this, &FreeDVModGUI::on_navTimeSlider_valueChanged); QObject::connect(ui->showFileDialog, &QPushButton::clicked, this, &FreeDVModGUI::on_showFileDialog_clicked); } + +void FreeDVModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modfreedv/freedvmodgui.h b/plugins/channeltx/modfreedv/freedvmodgui.h index 30494d4c4..ad79495de 100644 --- a/plugins/channeltx/modfreedv/freedvmodgui.h +++ b/plugins/channeltx/modfreedv/freedvmodgui.h @@ -68,6 +68,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; FreeDVModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; int m_spectrumRate; @@ -98,6 +100,7 @@ private: void channelMarkerUpdate(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 70ddfbe57..0f5457afc 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -228,6 +228,10 @@ bool NFMMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "NFMMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modnfm/nfmmodgui.cpp b/plugins/channeltx/modnfm/nfmmodgui.cpp index 9aacf2b30..2fe399f89 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.cpp +++ b/plugins/channeltx/modnfm/nfmmodgui.cpp @@ -28,6 +28,7 @@ #include "util/db.h" #include "dsp/dspengine.h" #include "dsp/cwkeyer.h" +#include "dsp/dspcommands.h" #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "gui/basicchannelsettingsdialog.h" @@ -106,6 +107,16 @@ bool NFMModGUI::handleMessage(const Message& message) ui->cwKeyerGUI->displaySettings(); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -136,6 +147,7 @@ void NFMModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -360,7 +372,6 @@ void NFMModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -399,6 +410,8 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_recordLength(0), m_recordSampleRate(48000), @@ -561,6 +574,7 @@ void NFMModGUI::displaySettings() ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -707,3 +721,8 @@ void NFMModGUI::makeUIConnections() QObject::connect(ui->feedbackEnable, &QToolButton::toggled, this, &NFMModGUI::on_feedbackEnable_toggled); QObject::connect(ui->feedbackVolume, &QDial::valueChanged, this, &NFMModGUI::on_feedbackVolume_valueChanged); } + +void NFMModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modnfm/nfmmodgui.h b/plugins/channeltx/modnfm/nfmmodgui.h index 10af4b8c0..2343874b4 100644 --- a/plugins/channeltx/modnfm/nfmmodgui.h +++ b/plugins/channeltx/modnfm/nfmmodgui.h @@ -67,6 +67,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; NFMModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; NFMMod* m_nfmMod; @@ -95,6 +97,7 @@ private: void updateWithStreamTime(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modpacket/packetmod.cpp b/plugins/channeltx/modpacket/packetmod.cpp index 73c1e2dc3..c08f28d3c 100644 --- a/plugins/channeltx/modpacket/packetmod.cpp +++ b/plugins/channeltx/modpacket/packetmod.cpp @@ -147,6 +147,10 @@ bool PacketMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "PacketMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modpacket/packetmodgui.cpp b/plugins/channeltx/modpacket/packetmodgui.cpp index 2c309a80f..a647320c4 100644 --- a/plugins/channeltx/modpacket/packetmodgui.cpp +++ b/plugins/channeltx/modpacket/packetmodgui.cpp @@ -23,11 +23,12 @@ #include #include "dsp/spectrumvis.h" +#include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "device/deviceuiset.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" -#include "dsp/dspengine.h" #include "gui/glspectrum.h" #include "gui/crightclickenabler.h" #include "gui/basicchannelsettingsdialog.h" @@ -95,6 +96,16 @@ bool PacketModGUI::handleMessage(const Message& message) ui->transmittedText->appendPlainText(str); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -125,6 +136,7 @@ void PacketModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -385,7 +397,6 @@ void PacketModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -424,6 +435,8 @@ PacketModGUI::PacketModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true) { ui->setupUi(getRollupContents()); @@ -577,6 +590,7 @@ void PacketModGUI::displaySettings() ui->packet->setText(m_settings.m_data); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -628,3 +642,8 @@ void PacketModGUI::makeUIConnections() QObject::connect(ui->udpAddress, &QLineEdit::editingFinished, this, &PacketModGUI::on_udpAddress_editingFinished); QObject::connect(ui->udpPort, &QLineEdit::editingFinished, this, &PacketModGUI::on_udpPort_editingFinished); } + +void PacketModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modpacket/packetmodgui.h b/plugins/channeltx/modpacket/packetmodgui.h index dbc2c1779..4c5fba36d 100644 --- a/plugins/channeltx/modpacket/packetmodgui.h +++ b/plugins/channeltx/modpacket/packetmodgui.h @@ -67,6 +67,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; PacketModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; SpectrumVis* m_spectrumVis; @@ -85,6 +87,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index b833c0562..44ad84076 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -193,6 +193,10 @@ bool SSBMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "SSBMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modssb/ssbmodgui.cpp b/plugins/channeltx/modssb/ssbmodgui.cpp index eb1dc3cb7..6150d3928 100644 --- a/plugins/channeltx/modssb/ssbmodgui.cpp +++ b/plugins/channeltx/modssb/ssbmodgui.cpp @@ -99,6 +99,16 @@ bool SSBModGUI::handleMessage(const Message& message) applyBandwidths(5 - ui->spanLog2->value()); // will update spectrum details with new sample rate return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else if (SSBMod::MsgConfigureSSBMod::match(message)) { SSBModSettings mod_settings; // different USB/LSB convention between modulator and GUI @@ -160,6 +170,7 @@ void SSBModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -366,7 +377,6 @@ void SSBModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -405,6 +415,8 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_spectrumRate(6000), m_recordLength(0), @@ -720,6 +732,7 @@ void SSBModGUI::displaySettings() ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -866,3 +879,8 @@ void SSBModGUI::makeUIConnections() QObject::connect(ui->feedbackEnable, &QToolButton::toggled, this, &SSBModGUI::on_feedbackEnable_toggled); QObject::connect(ui->feedbackVolume, &QDial::valueChanged, this, &SSBModGUI::on_feedbackVolume_valueChanged); } + +void SSBModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modssb/ssbmodgui.h b/plugins/channeltx/modssb/ssbmodgui.h index 8ac6de0bd..74e95c05a 100644 --- a/plugins/channeltx/modssb/ssbmodgui.h +++ b/plugins/channeltx/modssb/ssbmodgui.h @@ -68,6 +68,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; SSBModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; int m_spectrumRate; @@ -101,6 +103,7 @@ private: void channelMarkerUpdate(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 2aceef3e2..ae83b93a3 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -189,6 +189,10 @@ bool WFMMod::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "WFMMod::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/modwfm/wfmmodgui.cpp b/plugins/channeltx/modwfm/wfmmodgui.cpp index 0ecca32d1..991aaec65 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.cpp +++ b/plugins/channeltx/modwfm/wfmmodgui.cpp @@ -28,6 +28,7 @@ #include "util/db.h" #include "dsp/dspengine.h" #include "dsp/cwkeyer.h" +#include "dsp/dspcommands.h" #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "gui/basicchannelsettingsdialog.h" @@ -105,6 +106,16 @@ bool WFMModGUI::handleMessage(const Message& message) ui->cwKeyerGUI->displaySettings(); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -135,6 +146,7 @@ void WFMModGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -295,7 +307,6 @@ void WFMModGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_title = m_channelMarker.getTitle(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); @@ -334,6 +345,8 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_doApplySettings(true), m_recordLength(0), m_recordSampleRate(48000), @@ -480,6 +493,7 @@ void WFMModGUI::displaySettings() ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -620,3 +634,8 @@ void WFMModGUI::makeUIConnections() QObject::connect(ui->feedbackEnable, &QToolButton::toggled, this, &WFMModGUI::on_feedbackEnable_toggled); QObject::connect(ui->feedbackVolume, &QDial::valueChanged, this, &WFMModGUI::on_feedbackVolume_valueChanged); } + +void WFMModGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/modwfm/wfmmodgui.h b/plugins/channeltx/modwfm/wfmmodgui.h index 928173855..3c14d722e 100644 --- a/plugins/channeltx/modwfm/wfmmodgui.h +++ b/plugins/channeltx/modwfm/wfmmodgui.h @@ -65,6 +65,8 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; WFMModSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_doApplySettings; WFMMod* m_wfmMod; @@ -91,6 +93,7 @@ private: void updateWithStreamTime(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/remotesource/remotesource.cpp b/plugins/channeltx/remotesource/remotesource.cpp index 3512b7c35..89af2e0db 100644 --- a/plugins/channeltx/remotesource/remotesource.cpp +++ b/plugins/channeltx/remotesource/remotesource.cpp @@ -42,7 +42,6 @@ MESSAGE_CLASS_DEFINITION(RemoteSource::MsgConfigureRemoteSource, Message) MESSAGE_CLASS_DEFINITION(RemoteSource::MsgQueryStreamData, Message) MESSAGE_CLASS_DEFINITION(RemoteSource::MsgReportStreamData, Message) -MESSAGE_CLASS_DEFINITION(RemoteSource::MsgBasebandSampleRateNotification, Message) const char* const RemoteSource::m_channelIdURI = "sdrangel.channeltx.remotesource"; const char* const RemoteSource::m_channelId ="RemoteSource"; @@ -124,10 +123,8 @@ bool RemoteSource::handleMessage(const Message& cmd) calculateFrequencyOffset(m_settings.m_log2Interp, m_settings.m_filterChainHash); // This is when device sample rate changes m_centerFrequency = notif.getCenterFrequency(); - if (m_guiMessageQueue) - { - MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(notif.getSampleRate()); - m_guiMessageQueue->push(msg); + if (m_guiMessageQueue) { + m_guiMessageQueue->push(new DSPSignalNotification(notif)); } return true; diff --git a/plugins/channeltx/remotesource/remotesource.h b/plugins/channeltx/remotesource/remotesource.h index b86a7ca21..ec9f27a11 100644 --- a/plugins/channeltx/remotesource/remotesource.h +++ b/plugins/channeltx/remotesource/remotesource.h @@ -153,27 +153,6 @@ public: { } }; - - class MsgBasebandSampleRateNotification : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgBasebandSampleRateNotification* create(int sampleRate) { - return new MsgBasebandSampleRateNotification(sampleRate); - } - - int getBasebandSampleRate() const { return m_sampleRate; } - - private: - - MsgBasebandSampleRateNotification(int sampleRate) : - Message(), - m_sampleRate(sampleRate) - { } - - int m_sampleRate; - }; - RemoteSource(DeviceAPI *deviceAPI); virtual ~RemoteSource(); diff --git a/plugins/channeltx/remotesource/remotesourcegui.cpp b/plugins/channeltx/remotesource/remotesourcegui.cpp index a8e5a0461..aecba396e 100644 --- a/plugins/channeltx/remotesource/remotesourcegui.cpp +++ b/plugins/channeltx/remotesource/remotesourcegui.cpp @@ -20,6 +20,7 @@ #include "device/deviceapi.h" #include "device/deviceuiset.h" #include "dsp/hbfilterchainconverter.h" +#include "dsp/dspcommands.h" #include "gui/basicchannelsettingsdialog.h" #include "gui/devicestreamselectiondialog.h" #include "mainwindow.h" @@ -66,10 +67,12 @@ bool RemoteSourceGUI::deserialize(const QByteArray& data) bool RemoteSourceGUI::handleMessage(const Message& message) { - if (RemoteSource::MsgBasebandSampleRateNotification::match(message)) + if (DSPSignalNotification::match(message)) { - RemoteSource::MsgBasebandSampleRateNotification& notif = (RemoteSource::MsgBasebandSampleRateNotification&) message; - m_basebandSampleRate = notif.getBasebandSampleRate(); + DSPSignalNotification& notif = (DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + updateAbsoluteCenterFrequency(); displayRateAndShift(); return true; } @@ -156,6 +159,7 @@ RemoteSourceGUI::RemoteSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, ui(new Ui::RemoteSourceGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), + m_deviceCenterFrequency(0), m_remoteSampleRate(48000), m_basebandSampleRate(48000), m_shiftFrequencyFactor(0.0), @@ -245,6 +249,7 @@ void RemoteSourceGUI::displaySettings() ui->dataAddress->setText(m_settings.m_dataAddress); ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort)); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -432,6 +437,7 @@ void RemoteSourceGUI::applyPosition() m_shiftFrequencyFactor = HBFilterChainConverter::convertToString(m_settings.m_log2Interp, m_settings.m_filterChainHash, s); ui->filterChainText->setText(s); + updateAbsoluteCenterFrequency(); displayRateAndShift(); applySettings(); } @@ -496,3 +502,10 @@ void RemoteSourceGUI::makeUIConnections() QObject::connect(ui->dataApplyButton, &QPushButton::clicked, this, &RemoteSourceGUI::on_dataApplyButton_clicked); QObject::connect(ui->eventCountsReset, &QPushButton::clicked, this, &RemoteSourceGUI::on_eventCountsReset_clicked); } + +void RemoteSourceGUI::updateAbsoluteCenterFrequency() +{ + int shift = m_shiftFrequencyFactor * m_basebandSampleRate; + setStatusFrequency(m_deviceCenterFrequency + shift); +} + diff --git a/plugins/channeltx/remotesource/remotesourcegui.h b/plugins/channeltx/remotesource/remotesourcegui.h index 630204fb7..6a095e0ee 100644 --- a/plugins/channeltx/remotesource/remotesourcegui.h +++ b/plugins/channeltx/remotesource/remotesourcegui.h @@ -66,6 +66,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; RemoteSourceSettings m_settings; + qint64 m_deviceCenterFrequency; int m_remoteSampleRate; int m_basebandSampleRate; bool m_doApplySettings; @@ -95,6 +96,7 @@ private: void displayStreamIndex(); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/udpsource/udpsource.cpp b/plugins/channeltx/udpsource/udpsource.cpp index f455801c4..68f9e9b91 100644 --- a/plugins/channeltx/udpsource/udpsource.cpp +++ b/plugins/channeltx/udpsource/udpsource.cpp @@ -145,6 +145,10 @@ bool UDPSource::handleMessage(const Message& cmd) DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy qDebug() << "UDPSource::handleMessage: DSPSignalNotification"; m_basebandSource->getInputMessageQueue()->push(rep); + // Forward to GUI if any + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); + } return true; } diff --git a/plugins/channeltx/udpsource/udpsourcegui.cpp b/plugins/channeltx/udpsource/udpsourcegui.cpp index 500c51e50..8e41b5402 100644 --- a/plugins/channeltx/udpsource/udpsourcegui.cpp +++ b/plugins/channeltx/udpsource/udpsourcegui.cpp @@ -20,6 +20,7 @@ #include "device/deviceuiset.h" #include "dsp/spectrumvis.h" #include "dsp/dspengine.h" +#include "dsp/dspcommands.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingsdialog.h" @@ -78,6 +79,16 @@ bool UDPSourceGUI::handleMessage(const Message& message) blockApplySettings(false); return true; } + else if (DSPSignalNotification::match(message)) + { + const DSPSignalNotification& notif = (const DSPSignalNotification&) message; + m_deviceCenterFrequency = notif.getCenterFrequency(); + m_basebandSampleRate = notif.getSampleRate(); + ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate/2, m_basebandSampleRate/2); + ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2)); + updateAbsoluteCenterFrequency(); + return true; + } else { return false; @@ -104,6 +115,8 @@ UDPSourceGUI::UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb m_deviceUISet(deviceUISet), m_tickCount(0), m_channelMarker(this), + m_deviceCenterFrequency(0), + m_basebandSampleRate(1), m_rfBandwidthChanged(false), m_doApplySettings(true) { @@ -240,6 +253,7 @@ void UDPSourceGUI::displaySettings() ui->applyBtn->setStyleSheet("QPushButton { background:rgb(79,79,79); }"); getRollupContents()->restoreState(m_rollupState); + updateAbsoluteCenterFrequency(); blockApplySettings(false); } @@ -263,6 +277,7 @@ void UDPSourceGUI::on_deltaFrequency_changed(qint64 value) { m_settings.m_inputFrequencyOffset = value; m_channelMarker.setCenterFrequency(value); + updateAbsoluteCenterFrequency(); applySettings(); } @@ -493,7 +508,6 @@ void UDPSourceGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); dialog.exec(); - m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); m_settings.m_useReverseAPI = dialog.useReverseAPI(); m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); @@ -663,3 +677,8 @@ void UDPSourceGUI::makeUIConnections() QObject::connect(ui->autoRWBalance, &ButtonSwitch::toggled, this, &UDPSourceGUI::on_autoRWBalance_toggled); QObject::connect(ui->stereoInput, &QToolButton::toggled, this, &UDPSourceGUI::on_stereoInput_toggled); } + +void UDPSourceGUI::updateAbsoluteCenterFrequency() +{ + setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); +} diff --git a/plugins/channeltx/udpsource/udpsourcegui.h b/plugins/channeltx/udpsource/udpsourcegui.h index a009ee03a..f9cfdecf0 100644 --- a/plugins/channeltx/udpsource/udpsourcegui.h +++ b/plugins/channeltx/udpsource/udpsourcegui.h @@ -75,6 +75,8 @@ private: // settings UDPSourceSettings m_settings; + qint64 m_deviceCenterFrequency; + int m_basebandSampleRate; bool m_rfBandwidthChanged; bool m_doApplySettings; MessageQueue m_inputMessageQueue; @@ -90,6 +92,7 @@ private: void setSampleFormatIndex(const UDPSourceSettings::SampleFormat& sampleFormat); bool handleMessage(const Message& message); void makeUIConnections(); + void updateAbsoluteCenterFrequency(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/sdrgui/channel/channelgui.cpp b/sdrgui/channel/channelgui.cpp index 78673e2b1..383ec3828 100644 --- a/sdrgui/channel/channelgui.cpp +++ b/sdrgui/channel/channelgui.cpp @@ -90,6 +90,17 @@ ChannelGUI::ChannelGUI(QWidget *parent) : m_closeButton->setIcon(closeIcon); m_closeButton->setToolTip("Close channel"); + m_statusFrequency = new QLabel(); + // QFont font = m_statusFrequency->font(); + // font.setPointSize(8); + // m_statusFrequency->setFont(font); + m_statusFrequency->setAlignment(Qt::AlignRight |Qt::AlignVCenter); + m_statusFrequency->setFixedHeight(20); + m_statusFrequency->setFixedWidth(90); + m_statusFrequency->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + m_statusFrequency->setText(tr("%L1").arg(0)); + m_statusFrequency->setToolTip("Channel absolute frequency (Hz)"); + m_statusLabel = new QLabel(); // m_statusLabel->setText("OK"); // for future use m_statusLabel->setFixedHeight(20); @@ -122,6 +133,7 @@ ChannelGUI::ChannelGUI(QWidget *parent) : m_bottomLayout = new QHBoxLayout(); m_bottomLayout->setContentsMargins(0, 0, 0, 0); + m_bottomLayout->addWidget(m_statusFrequency ); m_bottomLayout->addWidget(m_statusLabel); m_sizeGripBottomRight = new QSizeGrip(this); m_sizeGripBottomRight->setStyleSheet("QSizeGrip { background-color: rgb(128, 128, 128); width: 10px; height: 10px; }"); @@ -162,6 +174,7 @@ ChannelGUI::~ChannelGUI() delete m_topLayout; delete m_layouts; delete m_statusLabel; + delete m_statusFrequency; delete m_closeButton; delete m_hideButton; delete m_shrinkButton; @@ -297,6 +310,16 @@ void ChannelGUI::setDeviceSetIndex(int index) updateIndexLabel(); } +void ChannelGUI::setStatusFrequency(qint64 frequency) +{ + m_statusFrequency->setText(tr("%L1").arg(frequency)); +} + +void ChannelGUI::setStatusText(const QString& text) +{ + m_statusLabel->setText(text); +} + void ChannelGUI::updateIndexLabel() { m_indexLabel->setText(tr("%1%2:%3").arg(getDeviceTypeTag()).arg(m_deviceSetIndex).arg(m_channelIndex)); @@ -304,7 +327,7 @@ void ChannelGUI::updateIndexLabel() bool ChannelGUI::isOnMovingPad() { - return m_indexLabel->underMouse() || m_titleLabel->underMouse() || m_statusLabel->underMouse(); + return m_indexLabel->underMouse() || m_titleLabel->underMouse() || m_statusFrequency->underMouse() || m_statusLabel->underMouse(); } QString ChannelGUI::getDeviceTypeTag() diff --git a/sdrgui/channel/channelgui.h b/sdrgui/channel/channelgui.h index c305b0aa5..326384e64 100644 --- a/sdrgui/channel/channelgui.h +++ b/sdrgui/channel/channelgui.h @@ -79,6 +79,8 @@ public: int getIndex() const { return m_channelIndex; } void setDeviceSetIndex(int index); int getDeviceSetIndex() const { return m_channelIndex; } + void setStatusFrequency(qint64 frequency); + void setStatusText(const QString& text); protected: void closeEvent(QCloseEvent *event); @@ -111,6 +113,7 @@ private: QPushButton *m_shrinkButton; QPushButton *m_hideButton; QPushButton *m_closeButton; + QLabel *m_statusFrequency; QLabel *m_statusLabel; QVBoxLayout *m_layouts; QHBoxLayout *m_topLayout;