From 5131fb86b13dbc7366d6ac7bc7a983c479cc2999 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 6 Nov 2017 23:04:23 +0100 Subject: [PATCH] ATV demod: GUI and demod separation (1) --- plugins/channelrx/demodatv/atvdemod.cpp | 1 + plugins/channelrx/demodatv/atvdemod.h | 20 ++++++++++++++++++++ plugins/channelrx/demodatv/atvdemodgui.cpp | 7 +++++-- plugins/channelrx/demodatv/atvdemodgui.h | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 93e8192cb..9625a9dbf 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -28,6 +28,7 @@ MESSAGE_CLASS_DEFINITION(ATVDemod::MsgConfigureATVDemod, Message) MESSAGE_CLASS_DEFINITION(ATVDemod::MsgConfigureRFATVDemod, Message) MESSAGE_CLASS_DEFINITION(ATVDemod::MsgReportEffectiveSampleRate, Message) +MESSAGE_CLASS_DEFINITION(ATVDemod::MsgReportChannelSampleRateChanged, Message) const int ATVDemod::m_ssbFftLen = 1024; diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index a561d834e..3c5f87d4b 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -147,6 +147,26 @@ public: { } }; + class MsgReportChannelSampleRateChanged : public Message { + MESSAGE_CLASS_DECLARATION + + public: + int getSampleRate() const { return m_sampleRate; } + + static MsgReportChannelSampleRateChanged* create(int sampleRate) + { + return new MsgReportChannelSampleRateChanged(sampleRate); + } + + private: + int m_sampleRate; + + MsgReportChannelSampleRateChanged(int sampleRate) : + Message(), + m_sampleRate(sampleRate) + { } + }; + ATVDemod(DeviceSourceAPI *deviceAPI); ~ATVDemod(); void setScopeSink(BasebandSampleSink* scopeSink) { m_scopeSink = scopeSink; } diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index 0b08215d4..6e5fb15e1 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -235,6 +235,7 @@ void ATVDemodGUI::viewChanged() void ATVDemodGUI::channelSampleRateChanged() { qDebug("ATVDemodGUI::channelSampleRateChanged"); + m_inputSampleRate = m_channelizer->getInputSampleRate(); applySettings(); applyRFSettings(); } @@ -277,7 +278,8 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, m_blnBasicSettingsShown(false), m_blnDoApplySettings(true), m_objMagSqAverage(40, 0), - m_intTickCount(0) + m_intTickCount(0), + m_inputSampleRate(48000) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); @@ -429,7 +431,8 @@ void ATVDemodGUI::setChannelMarkerBandwidth() if (ui->decimatorEnable->isChecked()) { m_channelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor); } else { - m_channelMarker.setBandwidth(m_channelizer->getInputSampleRate()); +// m_channelMarker.setBandwidth(m_channelizer->getInputSampleRate()); + m_channelMarker.setBandwidth(m_inputSampleRate); } m_channelMarker.setSidebands(ChannelMarker::dsb); diff --git a/plugins/channelrx/demodatv/atvdemodgui.h b/plugins/channelrx/demodatv/atvdemodgui.h index c33d135c0..5ac322d9f 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.h +++ b/plugins/channelrx/demodatv/atvdemodgui.h @@ -107,6 +107,7 @@ private: float m_fltLineTimeMultiplier; float m_fltTopTimeMultiplier; int m_rfSliderDivisor; + int m_inputSampleRate; MessageQueue m_inputMessageQueue; explicit ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, QWidget* objParent = 0);