From cdf51b99e9f7cf18d929ac3466f9ab513a07eede Mon Sep 17 00:00:00 2001 From: Edouard Griffiths Date: Tue, 8 Dec 2015 13:10:02 +0100 Subject: [PATCH] BFM demod: update spectrum setting with rate information upon channelizer change rate signal --- plugins/channel/bfm/bfmdemodgui.cpp | 16 +++++++++------- plugins/channel/bfm/bfmdemodgui.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/channel/bfm/bfmdemodgui.cpp b/plugins/channel/bfm/bfmdemodgui.cpp index 827f4774f..c4ae07fd9 100644 --- a/plugins/channel/bfm/bfmdemodgui.cpp +++ b/plugins/channel/bfm/bfmdemodgui.cpp @@ -267,6 +267,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_bfmDemod = new BFMDemod(m_spectrumVis); m_channelizer = new Channelizer(m_bfmDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); + connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); ui->glSpectrum->setCenterFrequency(m_rate / 4); @@ -363,12 +364,13 @@ void BFMDemodGUI::tick() } } - if ((m_bfmDemod) && (m_rate != m_bfmDemod->getSampleRate())) - { - m_rate = m_bfmDemod->getSampleRate(); - ui->glSpectrum->setCenterFrequency(m_rate / 4); - ui->glSpectrum->setSampleRate(m_rate / 2); - } - //qDebug() << "Pilot lock: " << m_bfmDemod->getPilotLock() << ":" << m_bfmDemod->getPilotLevel(); TODO: update a GUI item with status } + +void BFMDemodGUI::channelSampleRateChanged() +{ + m_rate = m_bfmDemod->getSampleRate(); + ui->glSpectrum->setCenterFrequency(m_rate / 4); + ui->glSpectrum->setSampleRate(m_rate / 2); +} + diff --git a/plugins/channel/bfm/bfmdemodgui.h b/plugins/channel/bfm/bfmdemodgui.h index 29d7d561f..3162aa7b0 100644 --- a/plugins/channel/bfm/bfmdemodgui.h +++ b/plugins/channel/bfm/bfmdemodgui.h @@ -54,6 +54,7 @@ public: private slots: void viewChanged(); + void channelSampleRateChanged(); void on_deltaFrequency_changed(quint64 value); void on_deltaMinus_toggled(bool minus); void on_rfBW_valueChanged(int value);