From 4ca7379e7cb0270c2ecee6986e0e394fd1f69f1b Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 28 Sep 2026 14:03:25 +0100 Subject: [PATCH] ChannelAPI: Add getChannelSampleRate and getAudioSampleRate. Set m_basebandSink to nullptr when stopped, to avoid dangling pointer. --- plugins/channelmimo/doa2/doa2.cpp | 5 +++++ plugins/channelmimo/doa2/doa2.h | 1 + plugins/channelrx/chanalyzer/chanalyzer.cpp | 9 +++++++-- plugins/channelrx/chanalyzer/chanalyzer.h | 3 ++- plugins/channelrx/chanalyzer/chanalyzergui.cpp | 6 +++--- plugins/channelrx/channelpower/channelpower.cpp | 4 ++++ plugins/channelrx/channelpower/channelpower.h | 1 + plugins/channelrx/demodadsb/adsbdemod.cpp | 5 +++++ plugins/channelrx/demodadsb/adsbdemod.h | 1 + plugins/channelrx/demodais/aisdemod.cpp | 10 ++++++++++ plugins/channelrx/demodais/aisdemod.h | 2 ++ plugins/channelrx/demodam/amdemod.cpp | 6 ++++++ plugins/channelrx/demodam/amdemod.h | 3 ++- plugins/channelrx/demodatv/atvdemod.cpp | 5 +++++ plugins/channelrx/demodatv/atvdemod.h | 1 + plugins/channelrx/demodbfm/bfmdemod.cpp | 6 ++++++ plugins/channelrx/demodbfm/bfmdemod.h | 3 ++- plugins/channelrx/demodchirpchat/chirpchatdemod.cpp | 6 ++++++ plugins/channelrx/demodchirpchat/chirpchatdemod.h | 1 + plugins/channelrx/demoddab/dabdemod.cpp | 5 +++++ plugins/channelrx/demoddab/dabdemod.h | 3 ++- plugins/channelrx/demoddatv/datvdemod.cpp | 5 +++++ plugins/channelrx/demoddatv/datvdemod.h | 1 + plugins/channelrx/demoddsc/dscdemod.cpp | 10 ++++++++++ plugins/channelrx/demoddsc/dscdemod.h | 2 ++ plugins/channelrx/demoddsd/dsddemod.cpp | 7 +++++++ plugins/channelrx/demoddsd/dsddemod.h | 3 ++- plugins/channelrx/demodendoftrain/endoftraindemod.cpp | 10 ++++++++++ plugins/channelrx/demodendoftrain/endoftraindemod.h | 2 ++ plugins/channelrx/demodfreedv/freedvdemod.cpp | 5 +++++ plugins/channelrx/demodfreedv/freedvdemod.h | 3 ++- plugins/channelrx/demodft8/ft8demod.cpp | 7 +++++++ plugins/channelrx/demodft8/ft8demod.h | 3 ++- plugins/channelrx/demodils/ilsdemod.cpp | 5 +++++ plugins/channelrx/demodils/ilsdemod.h | 3 ++- plugins/channelrx/demodinmarsat/inmarsatdemod.cpp | 10 ++++++++++ plugins/channelrx/demodinmarsat/inmarsatdemod.h | 2 ++ plugins/channelrx/demodm17/m17demod.cpp | 6 ++++++ plugins/channelrx/demodm17/m17demod.h | 3 ++- plugins/channelrx/demodmeshcore/meshcoredemod.cpp | 5 +++++ plugins/channelrx/demodmeshcore/meshcoredemod.h | 1 + plugins/channelrx/demodmeshtastic/meshtasticdemod.cpp | 5 +++++ plugins/channelrx/demodmeshtastic/meshtasticdemod.h | 1 + plugins/channelrx/demodnavtex/navtexdemod.cpp | 10 ++++++++++ plugins/channelrx/demodnavtex/navtexdemod.h | 2 ++ plugins/channelrx/demodnfm/nfmdemod.cpp | 6 ++++++ plugins/channelrx/demodnfm/nfmdemod.h | 3 ++- plugins/channelrx/demodpacket/packetdemod.cpp | 10 ++++++++++ plugins/channelrx/demodpacket/packetdemod.h | 2 ++ plugins/channelrx/demodpager/pagerdemod.cpp | 10 ++++++++++ plugins/channelrx/demodpager/pagerdemod.h | 2 ++ plugins/channelrx/demodradiosonde/radiosondedemod.cpp | 10 ++++++++++ plugins/channelrx/demodradiosonde/radiosondedemod.h | 2 ++ plugins/channelrx/demodrtty/rttydemod.cpp | 10 ++++++++++ plugins/channelrx/demodrtty/rttydemod.h | 2 ++ plugins/channelrx/demodssb/ssbdemod.cpp | 1 + plugins/channelrx/demodssb/ssbdemod.h | 4 ++-- plugins/channelrx/demodvor/vordemod.cpp | 1 + plugins/channelrx/demodvor/vordemod.h | 2 +- plugins/channelrx/demodvormc/vordemodmc.h | 2 +- plugins/channelrx/demodwfm/wfmdemod.cpp | 6 ++++++ plugins/channelrx/demodwfm/wfmdemod.h | 3 ++- plugins/channelrx/filesink/filesink.cpp | 7 +++++++ plugins/channelrx/filesink/filesink.h | 1 + plugins/channelrx/freqscanner/freqscanner.cpp | 6 ++++++ plugins/channelrx/freqscanner/freqscanner.h | 1 + plugins/channelrx/freqtracker/freqtracker.cpp | 6 ++++++ plugins/channelrx/freqtracker/freqtracker.h | 1 + plugins/channelrx/heatmap/heatmap.cpp | 5 +++++ plugins/channelrx/heatmap/heatmap.h | 1 + plugins/channelrx/localsink/localsink.cpp | 6 ++++++ plugins/channelrx/localsink/localsink.h | 1 + plugins/channelrx/noisefigure/noisefigure.cpp | 5 +++++ plugins/channelrx/noisefigure/noisefigure.h | 1 + plugins/channelrx/radioastronomy/radioastronomy.cpp | 5 +++++ plugins/channelrx/radioastronomy/radioastronomy.h | 1 + plugins/channelrx/radioclock/radioclock.cpp | 5 +++++ plugins/channelrx/radioclock/radioclock.h | 1 + plugins/channelrx/remotesink/remotesink.cpp | 6 ++++++ plugins/channelrx/remotesink/remotesink.h | 1 + plugins/channelrx/remotetcpsink/remotetcpsink.cpp | 5 +++++ plugins/channelrx/remotetcpsink/remotetcpsink.h | 1 + plugins/channelrx/sigmffilesink/sigmffilesink.cpp | 7 +++++++ plugins/channelrx/sigmffilesink/sigmffilesink.h | 1 + plugins/channelrx/udpsink/udpsink.cpp | 5 +++++ plugins/channelrx/udpsink/udpsink.h | 1 + plugins/channelrx/wdsprx/wdsprx.cpp | 1 + plugins/channelrx/wdsprx/wdsprx.h | 4 ++-- plugins/channeltx/filesource/filesource.cpp | 5 +++++ plugins/channeltx/filesource/filesource.h | 1 + plugins/channeltx/localsource/localsource.cpp | 5 +++++ plugins/channeltx/localsource/localsource.h | 1 + plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.cpp | 5 +++++ plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h | 1 + plugins/channeltx/modais/aismod.cpp | 10 ++++++++++ plugins/channeltx/modais/aismod.h | 2 ++ plugins/channeltx/modam/ammod.cpp | 6 ++++++ plugins/channeltx/modam/ammod.h | 3 ++- plugins/channeltx/modatv/atvmod.cpp | 5 +++++ plugins/channeltx/modatv/atvmod.h | 1 + plugins/channeltx/modchirpchat/chirpchatmod.cpp | 5 +++++ plugins/channeltx/modchirpchat/chirpchatmod.h | 1 + plugins/channeltx/moddatv/datvmod.cpp | 5 +++++ plugins/channeltx/moddatv/datvmod.h | 1 + plugins/channeltx/modfreedv/freedvmod.cpp | 5 +++++ plugins/channeltx/modfreedv/freedvmod.h | 3 ++- plugins/channeltx/modm17/m17mod.cpp | 5 +++++ plugins/channeltx/modm17/m17mod.h | 3 ++- plugins/channeltx/modmeshcore/meshcoremod.cpp | 5 +++++ plugins/channeltx/modmeshcore/meshcoremod.h | 1 + plugins/channeltx/modmeshtastic/meshtasticmod.cpp | 5 +++++ plugins/channeltx/modmeshtastic/meshtasticmod.h | 1 + plugins/channeltx/modnfm/nfmmod.cpp | 6 ++++++ plugins/channeltx/modnfm/nfmmod.h | 3 ++- plugins/channeltx/modpacket/packetmod.cpp | 10 ++++++++++ plugins/channeltx/modpacket/packetmod.h | 2 ++ plugins/channeltx/modpsk31/psk31mod.cpp | 10 ++++++++++ plugins/channeltx/modpsk31/psk31mod.h | 2 ++ plugins/channeltx/modrtty/rttymod.cpp | 10 ++++++++++ plugins/channeltx/modrtty/rttymod.h | 2 ++ plugins/channeltx/modssb/ssbmod.cpp | 5 +++++ plugins/channeltx/modssb/ssbmod.h | 3 ++- plugins/channeltx/modwfm/wfmmod.cpp | 5 +++++ plugins/channeltx/modwfm/wfmmod.h | 3 ++- plugins/channeltx/remotesource/remotesource.cpp | 5 +++++ plugins/channeltx/remotesource/remotesource.h | 1 + plugins/channeltx/udpsource/udpsource.cpp | 5 +++++ plugins/channeltx/udpsource/udpsource.h | 1 + sdrbase/channel/channelapi.h | 2 ++ 129 files changed, 490 insertions(+), 28 deletions(-) diff --git a/plugins/channelmimo/doa2/doa2.cpp b/plugins/channelmimo/doa2/doa2.cpp index 87e9e9bdc..d26643304 100644 --- a/plugins/channelmimo/doa2/doa2.cpp +++ b/plugins/channelmimo/doa2/doa2.cpp @@ -694,3 +694,8 @@ double DOA2::normalizeAngle(double angle, double max) if (angle > max) { return angle - max; } return angle; } + +int DOA2::getChannelSampleRate() const +{ + return static_cast(m_deviceSampleRate / (1 << m_settings.m_log2Decim)); +} diff --git a/plugins/channelmimo/doa2/doa2.h b/plugins/channelmimo/doa2/doa2.h index 4685cf328..bdb40add5 100644 --- a/plugins/channelmimo/doa2/doa2.h +++ b/plugins/channelmimo/doa2/doa2.h @@ -108,6 +108,7 @@ public: QString getIdentifier() const final { return objectName(); } void getTitle(QString& title) final { title = "DOA 2 sources"; } qint64 getCenterFrequency() const final { return m_frequencyOffset; } + int getChannelSampleRate() const override; void setCenterFrequency(qint64) final { /* Not for MIMO */ } uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; } diff --git a/plugins/channelrx/chanalyzer/chanalyzer.cpp b/plugins/channelrx/chanalyzer/chanalyzer.cpp index ba4d7da43..0cf5f0c7c 100644 --- a/plugins/channelrx/chanalyzer/chanalyzer.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzer.cpp @@ -53,7 +53,7 @@ ChannelAnalyzer::ChannelAnalyzer(DeviceAPI *deviceAPI) : { qDebug("ChannelAnalyzer::ChannelAnalyzer"); setObjectName(m_channelId); - getChannelSampleRate(); + getBasebandSampleRate(); m_basebandSink = new ChannelAnalyzerBaseband(); m_basebandSink->moveToThread(&m_thread); @@ -116,7 +116,7 @@ uint32_t ChannelAnalyzer::getNumberOfDeviceStreams() const return m_deviceAPI->getNbSourceStreams(); } -int ChannelAnalyzer::getChannelSampleRate() +int ChannelAnalyzer::getBasebandSampleRate() { DeviceSampleSource *source = m_deviceAPI->getSampleSource(); @@ -724,3 +724,8 @@ void ChannelAnalyzer::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int ChannelAnalyzer::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/chanalyzer/chanalyzer.h b/plugins/channelrx/chanalyzer/chanalyzer.h index 831ec78cc..77b6ba94d 100644 --- a/plugins/channelrx/chanalyzer/chanalyzer.h +++ b/plugins/channelrx/chanalyzer/chanalyzer.h @@ -75,7 +75,7 @@ public: SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } ScopeVis *getScopeVis() { return &m_scopeVis; } void setScopeVis(ScopeVis *scopeVis) { m_basebandSink->setScopeVis(scopeVis); } - int getChannelSampleRate(); + int getBasebandSampleRate(); //!< Updates and returns the device (baseband) sample rate int getDecimation() const { return 1<getMagSq(); } double getMagSqAvg() const { return m_basebandSink->getMagSqAvg(); } @@ -95,6 +95,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = objectName(); } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const { return QByteArray(); } diff --git a/plugins/channelrx/chanalyzer/chanalyzergui.cpp b/plugins/channelrx/chanalyzer/chanalyzergui.cpp index 6c95dce83..45a7044ce 100644 --- a/plugins/channelrx/chanalyzer/chanalyzergui.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzergui.cpp @@ -313,7 +313,7 @@ void ChannelAnalyzerGUI::tick() if (ui->pll->isChecked()) { - double sampleRate = (double) m_channelAnalyzer->getChannelSampleRate(); + double sampleRate = (double) m_channelAnalyzer->getBasebandSampleRate(); int freq = (m_channelAnalyzer->getPllFrequency() * sampleRate) / (2.0*M_PI); ui->pll->setToolTip(tr("PLL lock. Freq = %1 Hz").arg(freq)); ui->pllLockFrequency->setText(tr("%1 Hz").arg(freq)); @@ -548,13 +548,13 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); m_channelAnalyzer = (ChannelAnalyzer*) rxChannel; - m_basebandSampleRate = m_channelAnalyzer->getChannelSampleRate(); + m_basebandSampleRate = m_channelAnalyzer->getBasebandSampleRate(); qDebug("ChannelAnalyzerGUI::ChannelAnalyzerGUI: m_basebandSampleRate: %d", m_basebandSampleRate); m_spectrumVis = m_channelAnalyzer->getSpectrumVis(); m_spectrumVis->setGLSpectrum(ui->glSpectrum); m_scopeVis = m_channelAnalyzer->getScopeVis(); m_scopeVis->setGLScope(ui->glScope); - m_basebandSampleRate = m_channelAnalyzer->getChannelSampleRate(); + m_basebandSampleRate = m_channelAnalyzer->getBasebandSampleRate(); m_scopeVis->setSpectrumVis(m_spectrumVis); m_channelAnalyzer->setScopeVis(m_scopeVis); m_channelAnalyzer->setMessageQueueToGUI(getInputMessageQueue()); diff --git a/plugins/channelrx/channelpower/channelpower.cpp b/plugins/channelrx/channelpower/channelpower.cpp index 5d4f724d8..398309cde 100644 --- a/plugins/channelrx/channelpower/channelpower.cpp +++ b/plugins/channelrx/channelpower/channelpower.cpp @@ -563,3 +563,7 @@ void ChannelPower::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); } +int ChannelPower::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/channelpower/channelpower.h b/plugins/channelrx/channelpower/channelpower.h index 07ab73e4d..b2e7307c5 100644 --- a/plugins/channelrx/channelpower/channelpower.h +++ b/plugins/channelrx/channelpower/channelpower.h @@ -86,6 +86,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodadsb/adsbdemod.cpp b/plugins/channelrx/demodadsb/adsbdemod.cpp index d03bfcd0c..fdd49ea81 100644 --- a/plugins/channelrx/demodadsb/adsbdemod.cpp +++ b/plugins/channelrx/demodadsb/adsbdemod.cpp @@ -807,3 +807,8 @@ void ADSBDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int ADSBDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodadsb/adsbdemod.h b/plugins/channelrx/demodadsb/adsbdemod.h index 7820c341d..dcffce39c 100644 --- a/plugins/channelrx/demodadsb/adsbdemod.h +++ b/plugins/channelrx/demodadsb/adsbdemod.h @@ -129,6 +129,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodais/aisdemod.cpp b/plugins/channelrx/demodais/aisdemod.cpp index 3c745e8e1..788bcb984 100644 --- a/plugins/channelrx/demodais/aisdemod.cpp +++ b/plugins/channelrx/demodais/aisdemod.cpp @@ -751,3 +751,13 @@ void AISDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int AISDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int AISDemod::getAudioSampleRate() const +{ + return AISDemodSettings::AISDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodais/aisdemod.h b/plugins/channelrx/demodais/aisdemod.h index d92829531..6afdcb6c9 100644 --- a/plugins/channelrx/demodais/aisdemod.h +++ b/plugins/channelrx/demodais/aisdemod.h @@ -121,6 +121,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index f66b6a004..e155331bd 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -157,6 +157,7 @@ void AMDemod::stop() m_running = false; m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool AMDemod::handleMessage(const Message& cmd) @@ -717,3 +718,8 @@ void AMDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int AMDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodam/amdemod.h b/plugins/channelrx/demodam/amdemod.h index 99e97fd2e..c6b849535 100644 --- a/plugins/channelrx/demodam/amdemod.h +++ b/plugins/channelrx/demodam/amdemod.h @@ -84,6 +84,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -127,7 +128,7 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } bool getSquelchOpen() const { return m_running ? m_basebandSink->getSquelchOpen() : false; } bool getPllLocked() const { return m_settings.m_pll && m_running && m_basebandSink->getPllLocked(); } diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 27d20ce5a..078845d7e 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -209,3 +209,8 @@ void ATVDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int ATVDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index 2f2b82aec..a2612fbb4 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -80,6 +80,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = objectName(); } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const { return QByteArray(); } diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 71ab4520b..a75a0be1c 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -163,6 +163,7 @@ void BFMDemod::stop() m_running = false; m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool BFMDemod::handleMessage(const Message& cmd) @@ -761,3 +762,8 @@ void BFMDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int BFMDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h index c1e0f1b7f..9efccb38f 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.h +++ b/plugins/channelrx/demodbfm/bfmdemod.h @@ -91,6 +91,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -117,7 +118,7 @@ public: Real getDemodAcc() const { return m_running ? m_basebandSink->getDemodAcc() : 0.0f; } Real getDemodQua() const { return m_running ? m_basebandSink->getDemodQua() : 0.0f; } Real getDemodFclk() const { return m_running ? m_basebandSink->getDemodFclk() : 0.0f; } - int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { if (m_running) { diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp index bddc7f512..285204884 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp @@ -183,6 +183,7 @@ void ChirpChatDemod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished m_decoderThread->exit(); m_decoderThread->wait(); m_decoderThread = nullptr; @@ -1094,3 +1095,8 @@ void ChirpChatDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int ChirpChatDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.h b/plugins/channelrx/demodchirpchat/chirpchatdemod.h index cf97446e8..8020f0345 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.h +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.h @@ -86,6 +86,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demoddab/dabdemod.cpp b/plugins/channelrx/demoddab/dabdemod.cpp index b0daca5d6..c7546dc4b 100644 --- a/plugins/channelrx/demoddab/dabdemod.cpp +++ b/plugins/channelrx/demoddab/dabdemod.cpp @@ -917,3 +917,8 @@ void DABDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int DABDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demoddab/dabdemod.h b/plugins/channelrx/demoddab/dabdemod.h index 370656760..cb18acc9d 100644 --- a/plugins/channelrx/demoddab/dabdemod.h +++ b/plugins/channelrx/demoddab/dabdemod.h @@ -353,6 +353,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -403,7 +404,7 @@ public: } uint32_t getNumberOfDeviceStreams() const; - int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); } + int getAudioSampleRate() const override { return m_basebandSink->getAudioSampleRate(); } static const char * const m_channelIdURI; static const char * const m_channelId; diff --git a/plugins/channelrx/demoddatv/datvdemod.cpp b/plugins/channelrx/demoddatv/datvdemod.cpp index 54bda4c82..8bf34b029 100644 --- a/plugins/channelrx/demoddatv/datvdemod.cpp +++ b/plugins/channelrx/demoddatv/datvdemod.cpp @@ -723,3 +723,8 @@ void DATVDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int DATVDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demoddatv/datvdemod.h b/plugins/channelrx/demoddatv/datvdemod.h index dbe46e2b8..0b73ddaf7 100644 --- a/plugins/channelrx/demoddatv/datvdemod.h +++ b/plugins/channelrx/demoddatv/datvdemod.h @@ -51,6 +51,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = objectName(); } virtual qint64 getCenterFrequency() const { return m_settings.m_centerFrequency; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const { return QByteArray(); } diff --git a/plugins/channelrx/demoddsc/dscdemod.cpp b/plugins/channelrx/demoddsc/dscdemod.cpp index 36f2aa49b..5abbacb32 100644 --- a/plugins/channelrx/demoddsc/dscdemod.cpp +++ b/plugins/channelrx/demoddsc/dscdemod.cpp @@ -760,3 +760,13 @@ void DSCDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int DSCDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int DSCDemod::getAudioSampleRate() const +{ + return DSCDemodSettings::DSCDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demoddsc/dscdemod.h b/plugins/channelrx/demoddsc/dscdemod.h index b374aa66c..56439c526 100644 --- a/plugins/channelrx/demoddsc/dscdemod.h +++ b/plugins/channelrx/demoddsc/dscdemod.h @@ -117,6 +117,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp index 11c6d1998..cba3835d8 100644 --- a/plugins/channelrx/demoddsd/dsddemod.cpp +++ b/plugins/channelrx/demoddsd/dsddemod.cpp @@ -61,6 +61,7 @@ const int DSDDemod::m_udpBlockSize = 512; DSDDemod::DSDDemod(DeviceAPI *deviceAPI) : ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), + m_basebandSink(nullptr), m_running(false), m_basebandSampleRate(0), m_centerFrequency(0), @@ -202,6 +203,7 @@ void DSDDemod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } void DSDDemod::setScopeXYSink(BasebandSampleSink* sampleSink) @@ -920,3 +922,8 @@ void DSDDemod::handleFeatureRemoved(int featureSetIndex, Feature *feature) notifyUpdateAMBEFeatures(); } } + +int DSDDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demoddsd/dsddemod.h b/plugins/channelrx/demoddsd/dsddemod.h index a9973445e..ce995627f 100644 --- a/plugins/channelrx/demoddsd/dsddemod.h +++ b/plugins/channelrx/demoddsd/dsddemod.h @@ -117,6 +117,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -177,7 +178,7 @@ public: } const char *updateAndGetStatusText() { return m_running ? m_basebandSink->updateAndGetStatusText() : nullptr; } - int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } bool isRunning() { return m_running; } static const char* const m_channelIdURI; diff --git a/plugins/channelrx/demodendoftrain/endoftraindemod.cpp b/plugins/channelrx/demodendoftrain/endoftraindemod.cpp index 997ca1301..e4a58f2dd 100644 --- a/plugins/channelrx/demodendoftrain/endoftraindemod.cpp +++ b/plugins/channelrx/demodendoftrain/endoftraindemod.cpp @@ -699,3 +699,13 @@ void EndOfTrainDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int EndOfTrainDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int EndOfTrainDemod::getAudioSampleRate() const +{ + return EndOfTrainDemodSettings::CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodendoftrain/endoftraindemod.h b/plugins/channelrx/demodendoftrain/endoftraindemod.h index 88f2b2278..4ed9e04d2 100644 --- a/plugins/channelrx/demodendoftrain/endoftraindemod.h +++ b/plugins/channelrx/demodendoftrain/endoftraindemod.h @@ -88,6 +88,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index e0687f46a..d5c94e74b 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -655,3 +655,8 @@ void FreeDVDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int FreeDVDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodfreedv/freedvdemod.h b/plugins/channelrx/demodfreedv/freedvdemod.h index c5678d318..e5d3299fe 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.h +++ b/plugins/channelrx/demodfreedv/freedvdemod.h @@ -98,6 +98,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -114,7 +115,7 @@ public: return m_settings.m_inputFrequencyOffset; } - int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); } + int getAudioSampleRate() const override { return m_basebandSink->getAudioSampleRate(); } uint32_t getModemSampleRate() const { return m_basebandSink->getModemSampleRate(); } double getMagSq() const { return m_basebandSink->getMagSq(); } bool getAudioActive() const { return m_basebandSink->getAudioActive(); } diff --git a/plugins/channelrx/demodft8/ft8demod.cpp b/plugins/channelrx/demodft8/ft8demod.cpp index 377c787e0..507e31eab 100644 --- a/plugins/channelrx/demodft8/ft8demod.cpp +++ b/plugins/channelrx/demodft8/ft8demod.cpp @@ -56,6 +56,7 @@ const char* const FT8Demod::m_channelId = "FT8Demod"; FT8Demod::FT8Demod(DeviceAPI *deviceAPI) : ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), + m_basebandSink(nullptr), m_running(false), m_spectrumVis(SDR_RX_SCALEF), m_basebandSampleRate(0), @@ -205,6 +206,7 @@ void FT8Demod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool FT8Demod::handleMessage(const Message& cmd) @@ -859,3 +861,8 @@ void FT8Demod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int FT8Demod::getAudioSampleRate() const +{ + return FT8DemodSettings::m_ft8SampleRate; +} diff --git a/plugins/channelrx/demodft8/ft8demod.h b/plugins/channelrx/demodft8/ft8demod.h index af1e27263..3079e924f 100644 --- a/plugins/channelrx/demodft8/ft8demod.h +++ b/plugins/channelrx/demodft8/ft8demod.h @@ -88,6 +88,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -106,7 +107,7 @@ public: void setDeviceCenterFrequency(qint64 centerFrequency, int index); void setMessageQueueToGUI(MessageQueue* queue) final; - uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } + int getChannelSampleRate() const override { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) diff --git a/plugins/channelrx/demodils/ilsdemod.cpp b/plugins/channelrx/demodils/ilsdemod.cpp index 111ccc463..8879d1574 100644 --- a/plugins/channelrx/demodils/ilsdemod.cpp +++ b/plugins/channelrx/demodils/ilsdemod.cpp @@ -918,3 +918,8 @@ void ILSDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int ILSDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodils/ilsdemod.h b/plugins/channelrx/demodils/ilsdemod.h index 686a2dc9b..e32b418e9 100644 --- a/plugins/channelrx/demodils/ilsdemod.h +++ b/plugins/channelrx/demodils/ilsdemod.h @@ -130,6 +130,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -175,7 +176,7 @@ public: SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } ScopeVis *getScopeSink(); - uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } bool getSquelchOpen() const { return m_running ? m_basebandSink->getSquelchOpen() : false; } double getMagSq() const { return m_basebandSink->getMagSq(); } diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemod.cpp b/plugins/channelrx/demodinmarsat/inmarsatdemod.cpp index 1e5865d8c..f91c32824 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemod.cpp +++ b/plugins/channelrx/demodinmarsat/inmarsatdemod.cpp @@ -693,3 +693,13 @@ void InmarsatDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int InmarsatDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int InmarsatDemod::getAudioSampleRate() const +{ + return InmarsatDemodSettings::CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodinmarsat/inmarsatdemod.h b/plugins/channelrx/demodinmarsat/inmarsatdemod.h index 6e934edec..35c2c8933 100644 --- a/plugins/channelrx/demodinmarsat/inmarsatdemod.h +++ b/plugins/channelrx/demodinmarsat/inmarsatdemod.h @@ -86,6 +86,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodm17/m17demod.cpp b/plugins/channelrx/demodm17/m17demod.cpp index 46285c615..ba3254399 100644 --- a/plugins/channelrx/demodm17/m17demod.cpp +++ b/plugins/channelrx/demodm17/m17demod.cpp @@ -165,6 +165,7 @@ void M17Demod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool M17Demod::handleMessage(const Message& cmd) @@ -761,3 +762,8 @@ void M17Demod::setScopeXYSink(BasebandSampleSink* sampleSink) m_basebandSink->setScopeXYSink(sampleSink); } } + +int M17Demod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodm17/m17demod.h b/plugins/channelrx/demodm17/m17demod.h index 7225c1791..354c5a841 100644 --- a/plugins/channelrx/demodm17/m17demod.h +++ b/plugins/channelrx/demodm17/m17demod.h @@ -170,6 +170,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -228,7 +229,7 @@ public: } } - int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } bool isRunning() { return m_running; } void getDiagnostics( diff --git a/plugins/channelrx/demodmeshcore/meshcoredemod.cpp b/plugins/channelrx/demodmeshcore/meshcoredemod.cpp index 4825a20b7..c301e3cc4 100644 --- a/plugins/channelrx/demodmeshcore/meshcoredemod.cpp +++ b/plugins/channelrx/demodmeshcore/meshcoredemod.cpp @@ -1753,3 +1753,8 @@ void MeshcoreDemod::handleIndexInDeviceSetChanged(int index) runtime.basebandSink->setFifoLabel(fifoLabel); } } + +int MeshcoreDemod::getChannelSampleRate() const +{ + return m_pipelines.empty() || !m_pipelines[0].basebandSink ? 0 : m_pipelines[0].basebandSink->getChannelSampleRate(); +} diff --git a/plugins/channelrx/demodmeshcore/meshcoredemod.h b/plugins/channelrx/demodmeshcore/meshcoredemod.h index 9d64280ed..45633b368 100644 --- a/plugins/channelrx/demodmeshcore/meshcoredemod.h +++ b/plugins/channelrx/demodmeshcore/meshcoredemod.h @@ -106,6 +106,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodmeshtastic/meshtasticdemod.cpp b/plugins/channelrx/demodmeshtastic/meshtasticdemod.cpp index 245d4c979..74afae893 100644 --- a/plugins/channelrx/demodmeshtastic/meshtasticdemod.cpp +++ b/plugins/channelrx/demodmeshtastic/meshtasticdemod.cpp @@ -1683,3 +1683,8 @@ void MeshtasticDemod::handleIndexInDeviceSetChanged(int index) runtime.basebandSink->setFifoLabel(fifoLabel); } } + +int MeshtasticDemod::getChannelSampleRate() const +{ + return m_pipelines.empty() || !m_pipelines[0].basebandSink ? 0 : m_pipelines[0].basebandSink->getChannelSampleRate(); +} diff --git a/plugins/channelrx/demodmeshtastic/meshtasticdemod.h b/plugins/channelrx/demodmeshtastic/meshtasticdemod.h index 919a9b59d..1cb83e0b4 100644 --- a/plugins/channelrx/demodmeshtastic/meshtasticdemod.h +++ b/plugins/channelrx/demodmeshtastic/meshtasticdemod.h @@ -106,6 +106,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodnavtex/navtexdemod.cpp b/plugins/channelrx/demodnavtex/navtexdemod.cpp index 265eacb7c..42c86a4fe 100644 --- a/plugins/channelrx/demodnavtex/navtexdemod.cpp +++ b/plugins/channelrx/demodnavtex/navtexdemod.cpp @@ -749,3 +749,13 @@ void NavtexDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int NavtexDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int NavtexDemod::getAudioSampleRate() const +{ + return NavtexDemodSettings::NAVTEXDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodnavtex/navtexdemod.h b/plugins/channelrx/demodnavtex/navtexdemod.h index 20956f09a..cba280306 100644 --- a/plugins/channelrx/demodnavtex/navtexdemod.h +++ b/plugins/channelrx/demodnavtex/navtexdemod.h @@ -137,6 +137,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index 92c4fc289..2991f9422 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -173,6 +173,7 @@ void NFMDemod::stop() m_running = false; m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool NFMDemod::handleMessage(const Message& cmd) @@ -721,3 +722,8 @@ void NFMDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int NFMDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodnfm/nfmdemod.h b/plugins/channelrx/demodnfm/nfmdemod.h index a88576759..7de9aa670 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.h +++ b/plugins/channelrx/demodnfm/nfmdemod.h @@ -84,6 +84,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -138,7 +139,7 @@ public: } } - int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } uint32_t getNumberOfDeviceStreams() const; diff --git a/plugins/channelrx/demodpacket/packetdemod.cpp b/plugins/channelrx/demodpacket/packetdemod.cpp index bc8b70f11..9ba17d67f 100644 --- a/plugins/channelrx/demodpacket/packetdemod.cpp +++ b/plugins/channelrx/demodpacket/packetdemod.cpp @@ -715,3 +715,13 @@ void PacketDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int PacketDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int PacketDemod::getAudioSampleRate() const +{ + return PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodpacket/packetdemod.h b/plugins/channelrx/demodpacket/packetdemod.h index 043d78da4..e078e524c 100644 --- a/plugins/channelrx/demodpacket/packetdemod.h +++ b/plugins/channelrx/demodpacket/packetdemod.h @@ -89,6 +89,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodpager/pagerdemod.cpp b/plugins/channelrx/demodpager/pagerdemod.cpp index 9f01a7ea2..cc3666cba 100644 --- a/plugins/channelrx/demodpager/pagerdemod.cpp +++ b/plugins/channelrx/demodpager/pagerdemod.cpp @@ -723,3 +723,13 @@ void PagerDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int PagerDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int PagerDemod::getAudioSampleRate() const +{ + return PagerDemodSettings::m_channelSampleRate; +} diff --git a/plugins/channelrx/demodpager/pagerdemod.h b/plugins/channelrx/demodpager/pagerdemod.h index 0f55c4cc2..9bd410b77 100644 --- a/plugins/channelrx/demodpager/pagerdemod.h +++ b/plugins/channelrx/demodpager/pagerdemod.h @@ -149,6 +149,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp index 65758e3d8..2553f2a9c 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp @@ -767,3 +767,13 @@ void RadiosondeDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int RadiosondeDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int RadiosondeDemod::getAudioSampleRate() const +{ + return RadiosondeDemodSettings::RADIOSONDEDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodradiosonde/radiosondedemod.h b/plugins/channelrx/demodradiosonde/radiosondedemod.h index 90daacce7..a23431d08 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemod.h +++ b/plugins/channelrx/demodradiosonde/radiosondedemod.h @@ -124,6 +124,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodrtty/rttydemod.cpp b/plugins/channelrx/demodrtty/rttydemod.cpp index f50637209..b21062cac 100644 --- a/plugins/channelrx/demodrtty/rttydemod.cpp +++ b/plugins/channelrx/demodrtty/rttydemod.cpp @@ -794,3 +794,13 @@ void RttyDemod::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int RttyDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} + +int RttyDemod::getAudioSampleRate() const +{ + return RttyDemodSettings::RTTYDEMOD_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/demodrtty/rttydemod.h b/plugins/channelrx/demodrtty/rttydemod.h index 518566392..9ab1b0de0 100644 --- a/plugins/channelrx/demodrtty/rttydemod.h +++ b/plugins/channelrx/demodrtty/rttydemod.h @@ -131,6 +131,8 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 4c5378f96..d4cb23202 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -190,6 +190,7 @@ void SSBDemod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool SSBDemod::handleMessage(const Message& cmd) diff --git a/plugins/channelrx/demodssb/ssbdemod.h b/plugins/channelrx/demodssb/ssbdemod.h index 5da17ba36..d535d9e8c 100644 --- a/plugins/channelrx/demodssb/ssbdemod.h +++ b/plugins/channelrx/demodssb/ssbdemod.h @@ -105,8 +105,8 @@ public: } void setMessageQueueToGUI(MessageQueue* queue) final; - uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } - uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getChannelSampleRate() const override { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } bool getAudioActive() const { return m_running && m_basebandSink->getAudioActive(); } diff --git a/plugins/channelrx/demodvor/vordemod.cpp b/plugins/channelrx/demodvor/vordemod.cpp index a09de93f5..3740b5a26 100644 --- a/plugins/channelrx/demodvor/vordemod.cpp +++ b/plugins/channelrx/demodvor/vordemod.cpp @@ -164,6 +164,7 @@ void VORDemod::stop() m_basebandSink->stopWork(); m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool VORDemod::handleMessage(const Message& cmd) diff --git a/plugins/channelrx/demodvor/vordemod.h b/plugins/channelrx/demodvor/vordemod.h index d94774bfa..9b36fdbe2 100644 --- a/plugins/channelrx/demodvor/vordemod.h +++ b/plugins/channelrx/demodvor/vordemod.h @@ -129,7 +129,7 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } bool getSquelchOpen() const { return m_running ? m_basebandSink->getSquelchOpen() : false; } diff --git a/plugins/channelrx/demodvormc/vordemodmc.h b/plugins/channelrx/demodvormc/vordemodmc.h index febc6c95e..07088b67b 100644 --- a/plugins/channelrx/demodvormc/vordemodmc.h +++ b/plugins/channelrx/demodvormc/vordemodmc.h @@ -118,7 +118,7 @@ public: const QStringList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings& response); - uint32_t getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); } + int getAudioSampleRate() const override { return m_basebandSink->getAudioSampleRate(); } double getMagSq() const { return m_basebandSink->getMagSq(); } bool getSquelchOpen() const { return m_basebandSink->getSquelchOpen(); } diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index b2552c864..c60d72f2d 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -161,6 +161,7 @@ void WFMDemod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool WFMDemod::handleMessage(const Message& cmd) @@ -662,3 +663,8 @@ void WFMDemod::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int WFMDemod::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/demodwfm/wfmdemod.h b/plugins/channelrx/demodwfm/wfmdemod.h index 5176a0e98..029d8f0a1 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.h +++ b/plugins/channelrx/demodwfm/wfmdemod.h @@ -84,6 +84,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -102,7 +103,7 @@ public: double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } bool getSquelchOpen() const { return m_running && m_basebandSink->getSquelchOpen(); } - int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } QDateTime getAudioFifoErrorDateTime() const { return m_running ? m_basebandSink->getAudioFifoErrorDateTime() : QDateTime(); } void getMagSqLevels(double& avg, double& peak, int& nbSamples) diff --git a/plugins/channelrx/filesink/filesink.cpp b/plugins/channelrx/filesink/filesink.cpp index 33f8697dc..324a26fa1 100644 --- a/plugins/channelrx/filesink/filesink.cpp +++ b/plugins/channelrx/filesink/filesink.cpp @@ -54,6 +54,7 @@ const char* const FileSink::m_channelId = "FileSink"; FileSink::FileSink(DeviceAPI *deviceAPI) : ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), + m_basebandSink(nullptr), m_running(false), m_spectrumVis(SDR_RX_SCALEF), m_centerFrequency(0), @@ -206,6 +207,7 @@ void FileSink::stop() m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished if (getMessageQueueToGUI()) { @@ -833,3 +835,8 @@ void FileSink::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int FileSink::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/filesink/filesink.h b/plugins/channelrx/filesink/filesink.h index e1c4522cf..95712a242 100644 --- a/plugins/channelrx/filesink/filesink.h +++ b/plugins/channelrx/filesink/filesink.h @@ -103,6 +103,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "File Sink"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual QByteArray serialize() const; diff --git a/plugins/channelrx/freqscanner/freqscanner.cpp b/plugins/channelrx/freqscanner/freqscanner.cpp index b29957194..452639367 100644 --- a/plugins/channelrx/freqscanner/freqscanner.cpp +++ b/plugins/channelrx/freqscanner/freqscanner.cpp @@ -201,6 +201,7 @@ void FreqScanner::stop() m_thread->exit(); #ifndef __EMSCRIPTEN__ m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished #endif } @@ -1455,3 +1456,8 @@ void FreqScanner::notifyUpdateChannels(const QStringList& renameFrom, const QStr getMessageQueueToGUI()->push(msgToGUI); } } + +int FreqScanner::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/freqscanner/freqscanner.h b/plugins/channelrx/freqscanner/freqscanner.h index 3ec017bcb..2d21524ab 100644 --- a/plugins/channelrx/freqscanner/freqscanner.h +++ b/plugins/channelrx/freqscanner/freqscanner.h @@ -325,6 +325,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index 99f71a521..ac46b5095 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -160,6 +160,7 @@ void FreqTracker::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool FreqTracker::handleMessage(const Message& cmd) @@ -708,3 +709,8 @@ void FreqTracker::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int FreqTracker::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/freqtracker/freqtracker.h b/plugins/channelrx/freqtracker/freqtracker.h index 86ad77be3..61416d618 100644 --- a/plugins/channelrx/freqtracker/freqtracker.h +++ b/plugins/channelrx/freqtracker/freqtracker.h @@ -84,6 +84,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/heatmap/heatmap.cpp b/plugins/channelrx/heatmap/heatmap.cpp index 3d3d8b3bc..e068f321d 100644 --- a/plugins/channelrx/heatmap/heatmap.cpp +++ b/plugins/channelrx/heatmap/heatmap.cpp @@ -599,3 +599,8 @@ void HeatMap::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int HeatMap::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/heatmap/heatmap.h b/plugins/channelrx/heatmap/heatmap.h index a17dbfc32..9e5539437 100644 --- a/plugins/channelrx/heatmap/heatmap.h +++ b/plugins/channelrx/heatmap/heatmap.h @@ -91,6 +91,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index c96fc6575..fbd6a7b3f 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -185,6 +185,7 @@ void LocalSink::stopProcessing() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool LocalSink::handleMessage(const Message& cmd) @@ -861,3 +862,8 @@ void LocalSink::updateDeviceSetList() m_guiMessageQueue->push(msg); } } + +int LocalSink::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/localsink/localsink.h b/plugins/channelrx/localsink/localsink.h index 663d76687..51a8f7c5c 100644 --- a/plugins/channelrx/localsink/localsink.h +++ b/plugins/channelrx/localsink/localsink.h @@ -101,6 +101,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "Local Sink"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual QByteArray serialize() const; diff --git a/plugins/channelrx/noisefigure/noisefigure.cpp b/plugins/channelrx/noisefigure/noisefigure.cpp index 34a009ba2..3f586d624 100644 --- a/plugins/channelrx/noisefigure/noisefigure.cpp +++ b/plugins/channelrx/noisefigure/noisefigure.cpp @@ -977,3 +977,8 @@ void NoiseFigure::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int NoiseFigure::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/noisefigure/noisefigure.h b/plugins/channelrx/noisefigure/noisefigure.h index 5fa766fda..74e6f026a 100644 --- a/plugins/channelrx/noisefigure/noisefigure.h +++ b/plugins/channelrx/noisefigure/noisefigure.h @@ -194,6 +194,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/radioastronomy/radioastronomy.cpp b/plugins/channelrx/radioastronomy/radioastronomy.cpp index 7d3248609..1d767fc85 100644 --- a/plugins/channelrx/radioastronomy/radioastronomy.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomy.cpp @@ -1357,3 +1357,8 @@ void RadioAstronomy::handleFeatureMessageQueue(MessageQueue* messageQueue) } } } + +int RadioAstronomy::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/radioastronomy/radioastronomy.h b/plugins/channelrx/radioastronomy/radioastronomy.h index 01e3bd667..ae6945807 100644 --- a/plugins/channelrx/radioastronomy/radioastronomy.h +++ b/plugins/channelrx/radioastronomy/radioastronomy.h @@ -396,6 +396,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/radioclock/radioclock.cpp b/plugins/channelrx/radioclock/radioclock.cpp index 9401aed96..88b8da6ed 100644 --- a/plugins/channelrx/radioclock/radioclock.cpp +++ b/plugins/channelrx/radioclock/radioclock.cpp @@ -628,3 +628,8 @@ void RadioClock::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int RadioClock::getChannelSampleRate() const +{ + return RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE; +} diff --git a/plugins/channelrx/radioclock/radioclock.h b/plugins/channelrx/radioclock/radioclock.h index 5ac47d83e..7600d122d 100644 --- a/plugins/channelrx/radioclock/radioclock.h +++ b/plugins/channelrx/radioclock/radioclock.h @@ -134,6 +134,7 @@ public: virtual const QString& getURI() const { return getName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/remotesink/remotesink.cpp b/plugins/channelrx/remotesink/remotesink.cpp index 2956a6167..54500050e 100644 --- a/plugins/channelrx/remotesink/remotesink.cpp +++ b/plugins/channelrx/remotesink/remotesink.cpp @@ -162,6 +162,7 @@ void RemoteSink::stop() m_basebandSink->stopWork(); m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool RemoteSink::handleMessage(const Message& cmd) @@ -705,3 +706,8 @@ void RemoteSink::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int RemoteSink::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/remotesink/remotesink.h b/plugins/channelrx/remotesink/remotesink.h index 156634a2c..434f00543 100644 --- a/plugins/channelrx/remotesink/remotesink.h +++ b/plugins/channelrx/remotesink/remotesink.h @@ -83,6 +83,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "Remote Sink"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual QByteArray serialize() const; diff --git a/plugins/channelrx/remotetcpsink/remotetcpsink.cpp b/plugins/channelrx/remotetcpsink/remotetcpsink.cpp index 46ad2907d..75dd8e262 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsink.cpp +++ b/plugins/channelrx/remotetcpsink/remotetcpsink.cpp @@ -764,3 +764,8 @@ void RemoteTCPSink::updatePublicListing() m_networkManager->post(request, data); } + +int RemoteTCPSink::getChannelSampleRate() const +{ + return m_settings.m_channelSampleRate; +} diff --git a/plugins/channelrx/remotetcpsink/remotetcpsink.h b/plugins/channelrx/remotetcpsink/remotetcpsink.h index ab05b9d64..38a72ce1d 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsink.h +++ b/plugins/channelrx/remotetcpsink/remotetcpsink.h @@ -221,6 +221,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "Remote Sink"; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp index 5d826ea2d..99243915d 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesink.cpp +++ b/plugins/channelrx/sigmffilesink/sigmffilesink.cpp @@ -54,6 +54,7 @@ const char* const SigMFFileSink::m_channelId = "SigMFFileSink"; SigMFFileSink::SigMFFileSink(DeviceAPI *deviceAPI) : ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), + m_basebandSink(nullptr), m_running(false), m_spectrumVis(SDR_RX_SCALEF), m_centerFrequency(0), @@ -204,6 +205,7 @@ void SigMFFileSink::stop() m_running = false; m_thread->quit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished if (getMessageQueueToGUI()) { @@ -838,3 +840,8 @@ void SigMFFileSink::handleIndexInDeviceSetChanged(int index) .arg(index); m_basebandSink->setFifoLabel(fifoLabel); } + +int SigMFFileSink::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/sigmffilesink/sigmffilesink.h b/plugins/channelrx/sigmffilesink/sigmffilesink.h index a72111c30..28f5c8f11 100644 --- a/plugins/channelrx/sigmffilesink/sigmffilesink.h +++ b/plugins/channelrx/sigmffilesink/sigmffilesink.h @@ -103,6 +103,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "SigMF File Sink"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual QByteArray serialize() const; diff --git a/plugins/channelrx/udpsink/udpsink.cpp b/plugins/channelrx/udpsink/udpsink.cpp index 6480bdddf..5cf65450a 100644 --- a/plugins/channelrx/udpsink/udpsink.cpp +++ b/plugins/channelrx/udpsink/udpsink.cpp @@ -695,3 +695,8 @@ void UDPSink::handleIndexInDeviceSetChanged(int index) m_basebandSink->setFifoLabel(fifoLabel); m_basebandSink->setAudioFifoLabel(fifoLabel); } + +int UDPSink::getChannelSampleRate() const +{ + return m_basebandSink ? m_basebandSink->getChannelSampleRate() : 0; +} diff --git a/plugins/channelrx/udpsink/udpsink.h b/plugins/channelrx/udpsink/udpsink.h index 973466133..8dba1745f 100644 --- a/plugins/channelrx/udpsink/udpsink.h +++ b/plugins/channelrx/udpsink/udpsink.h @@ -90,6 +90,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channelrx/wdsprx/wdsprx.cpp b/plugins/channelrx/wdsprx/wdsprx.cpp index 079fa17ba..70642ab15 100644 --- a/plugins/channelrx/wdsprx/wdsprx.cpp +++ b/plugins/channelrx/wdsprx/wdsprx.cpp @@ -192,6 +192,7 @@ void WDSPRx::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSink = nullptr; // Freed by deleteLater when the thread finished } bool WDSPRx::handleMessage(const Message& cmd) diff --git a/plugins/channelrx/wdsprx/wdsprx.h b/plugins/channelrx/wdsprx/wdsprx.h index 4b7128d89..6421f90c7 100644 --- a/plugins/channelrx/wdsprx/wdsprx.h +++ b/plugins/channelrx/wdsprx/wdsprx.h @@ -105,8 +105,8 @@ public: } void setMessageQueueToGUI(MessageQueue* queue) final; - uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } - uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } + int getAudioSampleRate() const override { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + int getChannelSampleRate() const override { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } bool getAudioActive() const { return m_running && m_basebandSink->getAudioActive(); } diff --git a/plugins/channeltx/filesource/filesource.cpp b/plugins/channeltx/filesource/filesource.cpp index 551e90ea9..61cafe420 100644 --- a/plugins/channeltx/filesource/filesource.cpp +++ b/plugins/channeltx/filesource/filesource.cpp @@ -701,3 +701,8 @@ uint32_t FileSource::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int FileSource::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/filesource/filesource.h b/plugins/channeltx/filesource/filesource.h index 2d5186b2f..989bf6ed0 100644 --- a/plugins/channeltx/filesource/filesource.h +++ b/plugins/channeltx/filesource/filesource.h @@ -166,6 +166,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return 0; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual int getNbSinkStreams() const { return 0; } diff --git a/plugins/channeltx/localsource/localsource.cpp b/plugins/channeltx/localsource/localsource.cpp index da3ca869d..2d0ba2d71 100644 --- a/plugins/channeltx/localsource/localsource.cpp +++ b/plugins/channeltx/localsource/localsource.cpp @@ -627,3 +627,8 @@ uint32_t LocalSource::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int LocalSource::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/localsource/localsource.h b/plugins/channeltx/localsource/localsource.h index c77b05315..bdf27ef14 100644 --- a/plugins/channeltx/localsource/localsource.h +++ b/plugins/channeltx/localsource/localsource.h @@ -80,6 +80,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = "Local Sink"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual QByteArray serialize() const; 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 4a96860d2..d6fddf69b 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 @@ -813,3 +813,8 @@ ScopeVis *IEEE_802_15_4_Mod::getScopeSink() { return m_basebandSource->getScopeSink(); } + +int IEEE_802_15_4_Mod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h index 1ceb0c261..8cde2f386 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_mod.h @@ -109,6 +109,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modais/aismod.cpp b/plugins/channeltx/modais/aismod.cpp index 27e3ab039..a4e36e233 100644 --- a/plugins/channeltx/modais/aismod.cpp +++ b/plugins/channeltx/modais/aismod.cpp @@ -996,3 +996,13 @@ void AISMod::udpRx() m_basebandSource->getInputMessageQueue()->push(msg); } } + +int AISMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} + +int AISMod::getAudioSampleRate() const +{ + return AISModSettings::AISMOD_SAMPLE_RATE; +} diff --git a/plugins/channeltx/modais/aismod.h b/plugins/channeltx/modais/aismod.h index 21e799035..143ed8a8e 100644 --- a/plugins/channeltx/modais/aismod.h +++ b/plugins/channeltx/modais/aismod.h @@ -170,6 +170,8 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index 1a2feba19..b1b2f2c32 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -161,6 +161,7 @@ void AMMod::stop() m_running = false; m_thread->exit(); m_thread->wait(); + m_basebandSource = nullptr; // Freed by deleteLater when the thread finished } void AMMod::pull(SampleVector::iterator& begin, unsigned int nbSamples) @@ -836,3 +837,8 @@ int AMMod::getFeedbackAudioSampleRate() const return 0; } + +int AMMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modam/ammod.h b/plugins/channeltx/modam/ammod.h index e980914d9..94f14ff08 100644 --- a/plugins/channeltx/modam/ammod.h +++ b/plugins/channeltx/modam/ammod.h @@ -193,6 +193,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -240,7 +241,7 @@ public: double getMagSq() const; CWKeyer *getCWKeyer(); void setLevelMeter(QObject *levelMeter) { m_levelMeter = levelMeter; } - int getAudioSampleRate() const; + int getAudioSampleRate() const override; int getFeedbackAudioSampleRate() const; static const char* const m_channelIdURI; diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 87ab166c8..57a9858a8 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -800,3 +800,8 @@ void ATVMod::setMessageQueueToGUI(MessageQueue* queue) { ChannelAPI::setMessageQueueToGUI(queue); m_basebandSource->setMessageQueueToGUI(queue); } + +int ATVMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index a96963d0c..1d0b0fe2d 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -263,6 +263,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modchirpchat/chirpchatmod.cpp b/plugins/channeltx/modchirpchat/chirpchatmod.cpp index 1b5165244..100ed308c 100644 --- a/plugins/channeltx/modchirpchat/chirpchatmod.cpp +++ b/plugins/channeltx/modchirpchat/chirpchatmod.cpp @@ -1154,3 +1154,8 @@ void ChirpChatMod::udpRx() } } } + +int ChirpChatMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modchirpchat/chirpchatmod.h b/plugins/channeltx/modchirpchat/chirpchatmod.h index 37a4615ce..42710f8fc 100644 --- a/plugins/channeltx/modchirpchat/chirpchatmod.h +++ b/plugins/channeltx/modchirpchat/chirpchatmod.h @@ -108,6 +108,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/moddatv/datvmod.cpp b/plugins/channeltx/moddatv/datvmod.cpp index 84c133720..9a6a8bb3b 100644 --- a/plugins/channeltx/moddatv/datvmod.cpp +++ b/plugins/channeltx/moddatv/datvmod.cpp @@ -790,3 +790,8 @@ void DATVMod::setMessageQueueToGUI(MessageQueue* queue) { ChannelAPI::setMessageQueueToGUI(queue); m_basebandSource->setMessageQueueToGUI(queue); } + +int DATVMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/moddatv/datvmod.h b/plugins/channeltx/moddatv/datvmod.h index e77eac989..ee0b53f43 100644 --- a/plugins/channeltx/moddatv/datvmod.h +++ b/plugins/channeltx/moddatv/datvmod.h @@ -218,6 +218,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modfreedv/freedvmod.cpp b/plugins/channeltx/modfreedv/freedvmod.cpp index 3a7a242c7..52cb50f25 100644 --- a/plugins/channeltx/modfreedv/freedvmod.cpp +++ b/plugins/channeltx/modfreedv/freedvmod.cpp @@ -810,3 +810,8 @@ uint32_t FreeDVMod::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int FreeDVMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modfreedv/freedvmod.h b/plugins/channeltx/modfreedv/freedvmod.h index 7350f8cdd..dc92630e1 100644 --- a/plugins/channeltx/modfreedv/freedvmod.h +++ b/plugins/channeltx/modfreedv/freedvmod.h @@ -195,6 +195,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -239,7 +240,7 @@ public: SWGSDRangel::SWGChannelSettings& response); SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } - int getAudioSampleRate() const; + int getAudioSampleRate() const override; uint32_t getModemSampleRate() const; Real getLowCutoff() const; Real getHiCutoff() const; diff --git a/plugins/channeltx/modm17/m17mod.cpp b/plugins/channeltx/modm17/m17mod.cpp index 141ebc3fe..2dd1d4974 100644 --- a/plugins/channeltx/modm17/m17mod.cpp +++ b/plugins/channeltx/modm17/m17mod.cpp @@ -955,3 +955,8 @@ void M17Mod::sendPacket() m_basebandSource->sendPacket(); } } + +int M17Mod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modm17/m17mod.h b/plugins/channeltx/modm17/m17mod.h index aa5e0657e..6de2d998a 100644 --- a/plugins/channeltx/modm17/m17mod.h +++ b/plugins/channeltx/modm17/m17mod.h @@ -193,6 +193,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -239,7 +240,7 @@ public: double getMagSq() const; void setLevelMeter(QObject *levelMeter); uint32_t getNumberOfDeviceStreams() const; - int getAudioSampleRate() const; + int getAudioSampleRate() const override; int getFeedbackAudioSampleRate() const; void sendPacket(); diff --git a/plugins/channeltx/modmeshcore/meshcoremod.cpp b/plugins/channeltx/modmeshcore/meshcoremod.cpp index 0a45a083e..99dea0c39 100644 --- a/plugins/channeltx/modmeshcore/meshcoremod.cpp +++ b/plugins/channeltx/modmeshcore/meshcoremod.cpp @@ -907,3 +907,8 @@ void MeshcoreMod::udpRx() } } } + +int MeshcoreMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modmeshcore/meshcoremod.h b/plugins/channeltx/modmeshcore/meshcoremod.h index a50b1e4c8..8e56fb714 100644 --- a/plugins/channeltx/modmeshcore/meshcoremod.h +++ b/plugins/channeltx/modmeshcore/meshcoremod.h @@ -123,6 +123,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modmeshtastic/meshtasticmod.cpp b/plugins/channeltx/modmeshtastic/meshtasticmod.cpp index 6840495d2..d3703fdff 100644 --- a/plugins/channeltx/modmeshtastic/meshtasticmod.cpp +++ b/plugins/channeltx/modmeshtastic/meshtasticmod.cpp @@ -870,3 +870,8 @@ void MeshtasticMod::udpRx() } } } + +int MeshtasticMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modmeshtastic/meshtasticmod.h b/plugins/channeltx/modmeshtastic/meshtasticmod.h index a6af59ed0..923f3af0d 100644 --- a/plugins/channeltx/modmeshtastic/meshtasticmod.h +++ b/plugins/channeltx/modmeshtastic/meshtasticmod.h @@ -123,6 +123,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index 6a1fbc261..d057b5257 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -158,6 +158,7 @@ void NFMMod::stop() m_running = false; m_thread->quit(); m_thread->wait(); + m_basebandSource = nullptr; // Freed by deleteLater when the thread finished } void NFMMod::pull(SampleVector::iterator& begin, unsigned int nbSamples) @@ -923,3 +924,8 @@ int NFMMod::getFeedbackAudioSampleRate() const return 0; } + +int NFMMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index c308e1a8b..659fd1c76 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -193,6 +193,7 @@ public: QString getIdentifier() const final { return objectName(); } void getTitle(QString& title) final { title = m_settings.m_title; } qint64 getCenterFrequency() const final { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; void setCenterFrequency(qint64 frequency) final; QByteArray serialize() const final; @@ -240,7 +241,7 @@ public: CWKeyer *getCWKeyer() { return &m_cwKeyer; } void setLevelMeter(QObject *levelMeter) { m_levelMeter = levelMeter; } uint32_t getNumberOfDeviceStreams() const; - int getAudioSampleRate() const; + int getAudioSampleRate() const override; int getFeedbackAudioSampleRate() const; static const char* const m_channelIdURI; diff --git a/plugins/channeltx/modpacket/packetmod.cpp b/plugins/channeltx/modpacket/packetmod.cpp index b1dc4a224..ea08d3e8a 100644 --- a/plugins/channeltx/modpacket/packetmod.cpp +++ b/plugins/channeltx/modpacket/packetmod.cpp @@ -1016,3 +1016,13 @@ void PacketMod::udpRx() m_basebandSource->getInputMessageQueue()->push(msg); } } + +int PacketMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} + +int PacketMod::getAudioSampleRate() const +{ + return getSourceChannelSampleRate(); +} diff --git a/plugins/channeltx/modpacket/packetmod.h b/plugins/channeltx/modpacket/packetmod.h index dda22ef8b..02d7b283b 100644 --- a/plugins/channeltx/modpacket/packetmod.h +++ b/plugins/channeltx/modpacket/packetmod.h @@ -160,6 +160,8 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modpsk31/psk31mod.cpp b/plugins/channeltx/modpsk31/psk31mod.cpp index 4fdae2cdf..830327102 100644 --- a/plugins/channeltx/modpsk31/psk31mod.cpp +++ b/plugins/channeltx/modpsk31/psk31mod.cpp @@ -798,3 +798,13 @@ void PSK31::setMessageQueueToGUI(MessageQueue* queue) { ChannelAPI::setMessageQueueToGUI(queue); m_basebandSource->setMessageQueueToGUI(queue); } + +int PSK31::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} + +int PSK31::getAudioSampleRate() const +{ + return getSourceChannelSampleRate(); +} diff --git a/plugins/channeltx/modpsk31/psk31mod.h b/plugins/channeltx/modpsk31/psk31mod.h index bdfa7d67f..53e87c207 100644 --- a/plugins/channeltx/modpsk31/psk31mod.h +++ b/plugins/channeltx/modpsk31/psk31mod.h @@ -144,6 +144,8 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modrtty/rttymod.cpp b/plugins/channeltx/modrtty/rttymod.cpp index 9197e83e7..90e06175c 100644 --- a/plugins/channeltx/modrtty/rttymod.cpp +++ b/plugins/channeltx/modrtty/rttymod.cpp @@ -841,3 +841,13 @@ void RttyMod::setMessageQueueToGUI(MessageQueue* queue) { ChannelAPI::setMessageQueueToGUI(queue); m_basebandSource->setMessageQueueToGUI(queue); } + +int RttyMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} + +int RttyMod::getAudioSampleRate() const +{ + return getSourceChannelSampleRate(); +} diff --git a/plugins/channeltx/modrtty/rttymod.h b/plugins/channeltx/modrtty/rttymod.h index b8a6c9ba9..8a0e40481 100644 --- a/plugins/channeltx/modrtty/rttymod.h +++ b/plugins/channeltx/modrtty/rttymod.h @@ -144,6 +144,8 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; + int getAudioSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 874acfa83..24fb6fd03 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -922,3 +922,8 @@ uint32_t SSBMod::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int SSBMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modssb/ssbmod.h b/plugins/channeltx/modssb/ssbmod.h index a0b8f1178..fcdc9a35e 100644 --- a/plugins/channeltx/modssb/ssbmod.h +++ b/plugins/channeltx/modssb/ssbmod.h @@ -194,6 +194,7 @@ public: QString getIdentifier() const final { return objectName(); } void getTitle(QString& title) final { title = m_settings.m_title; } qint64 getCenterFrequency() const final { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; void setCenterFrequency(qint64 frequency) final; QByteArray serialize() const final; @@ -241,7 +242,7 @@ public: double getMagSq() const; CWKeyer *getCWKeyer(); void setLevelMeter(QObject *levelMeter) { m_levelMeter = levelMeter; } - int getAudioSampleRate() const; + int getAudioSampleRate() const override; int getFeedbackAudioSampleRate() const; uint32_t getNumberOfDeviceStreams() const; diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 4c37b6d68..4183fea3f 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -782,3 +782,8 @@ int WFMMod::getFeedbackAudioSampleRate() const { return m_basebandSource->getFeedbackAudioSampleRate(); } + +int WFMMod::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/modwfm/wfmmod.h b/plugins/channeltx/modwfm/wfmmod.h index afb304638..259a06b58 100644 --- a/plugins/channeltx/modwfm/wfmmod.h +++ b/plugins/channeltx/modwfm/wfmmod.h @@ -192,6 +192,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; @@ -239,7 +240,7 @@ public: CWKeyer *getCWKeyer(); void setLevelMeter(QObject *levelMeter); uint32_t getNumberOfDeviceStreams() const; - int getAudioSampleRate() const; + int getAudioSampleRate() const override; int getFeedbackAudioSampleRate() const; static const char* const m_channelIdURI; diff --git a/plugins/channeltx/remotesource/remotesource.cpp b/plugins/channeltx/remotesource/remotesource.cpp index 7459bf27b..e64177c20 100644 --- a/plugins/channeltx/remotesource/remotesource.cpp +++ b/plugins/channeltx/remotesource/remotesource.cpp @@ -602,3 +602,8 @@ uint32_t RemoteSource::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int RemoteSource::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/remotesource/remotesource.h b/plugins/channeltx/remotesource/remotesource.h index 86423f162..79db41b6e 100644 --- a/plugins/channeltx/remotesource/remotesource.h +++ b/plugins/channeltx/remotesource/remotesource.h @@ -177,6 +177,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64) {} virtual int getNbSinkStreams() const { return 0; } diff --git a/plugins/channeltx/udpsource/udpsource.cpp b/plugins/channeltx/udpsource/udpsource.cpp index 656a483d9..b88d7ec95 100644 --- a/plugins/channeltx/udpsource/udpsource.cpp +++ b/plugins/channeltx/udpsource/udpsource.cpp @@ -741,3 +741,8 @@ uint32_t UDPSource::getNumberOfDeviceStreams() const { return m_deviceAPI->getNbSinkStreams(); } + +int UDPSource::getChannelSampleRate() const +{ + return m_basebandSource ? m_basebandSource->getChannelSampleRate() : 0; +} diff --git a/plugins/channeltx/udpsource/udpsource.h b/plugins/channeltx/udpsource/udpsource.h index 97d111a39..657e32f02 100644 --- a/plugins/channeltx/udpsource/udpsource.h +++ b/plugins/channeltx/udpsource/udpsource.h @@ -112,6 +112,7 @@ public: virtual QString getIdentifier() const { return objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } virtual qint64 getCenterFrequency() const { return m_settings.m_inputFrequencyOffset; } + int getChannelSampleRate() const override; virtual void setCenterFrequency(qint64 frequency); virtual QByteArray serialize() const; diff --git a/sdrbase/channel/channelapi.h b/sdrbase/channel/channelapi.h index 9be890076..ba25cfc38 100644 --- a/sdrbase/channel/channelapi.h +++ b/sdrbase/channel/channelapi.h @@ -68,6 +68,8 @@ public: virtual const QString& getName() const { return m_name; } virtual qint64 getCenterFrequency() const = 0; //!< Applies to a default stream virtual void setCenterFrequency(qint64 frequency) = 0; + virtual int getChannelSampleRate() const { return 0; } //!< Sample rate after channelization, 0 if unknown + virtual int getAudioSampleRate() const { return 0; } //!< Sample rate of the audio or demodulated output (e.g. "demod" pipe), 0 if none virtual QByteArray serialize() const = 0; virtual bool deserialize(const QByteArray& data) = 0;