From 60a8946ce49c801e91cf8645974d80ca3f565cf0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 19 Aug 2015 22:12:08 +0200 Subject: [PATCH] Deep redesign: Init sequence review phase #5: fixed source message forwarding for other sample sources --- plugins/samplesource/bladerf/bladerfinput.cpp | 1 - plugins/samplesource/fcd/fcdinput.cpp | 9 ++++++++- .../filesource/filesourceinput.cpp | 4 ++++ plugins/samplesource/rtlsdr/rtlsdrinput.cpp | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/plugins/samplesource/bladerf/bladerfinput.cpp b/plugins/samplesource/bladerf/bladerfinput.cpp index 3c9755066..e726aae54 100644 --- a/plugins/samplesource/bladerf/bladerfinput.cpp +++ b/plugins/samplesource/bladerf/bladerfinput.cpp @@ -19,7 +19,6 @@ #include #include "util/simpleserializer.h" -#include "dsp/dspengine.h" #include "dsp/dspcommands.h" #include "bladerfgui.h" #include "bladerfinput.h" diff --git a/plugins/samplesource/fcd/fcdinput.cpp b/plugins/samplesource/fcd/fcdinput.cpp index ff1f89059..52ed3abb2 100644 --- a/plugins/samplesource/fcd/fcdinput.cpp +++ b/plugins/samplesource/fcd/fcdinput.cpp @@ -21,6 +21,7 @@ #include "fcdthread.h" #include "fcdgui.h" #include "qthid.h" +#include "dsp/dspcommands.h" #include "util/simpleserializer.h" MESSAGE_CLASS_DEFINITION(FCDInput::MsgConfigureFCD, Message) @@ -178,7 +179,13 @@ void FCDInput::applySettings(const Settings& settings, bool force) { set_lna_gain(settings.gain > 0); set_bias_t(settings.bias > 0); - } + } + + if (sampleSourcChange) + { + DSPSignalNotification *notif = new DSPSignalNotification(960000, m_settings.centerFrequency); + getOutputMessageQueue()->push(notif); + } } void FCDInput::set_center_freq(double freq) diff --git a/plugins/samplesource/filesource/filesourceinput.cpp b/plugins/samplesource/filesource/filesourceinput.cpp index a2ecb0fa9..7506d77a9 100644 --- a/plugins/samplesource/filesource/filesourceinput.cpp +++ b/plugins/samplesource/filesource/filesourceinput.cpp @@ -19,6 +19,7 @@ #include #include "util/simpleserializer.h" +#include "dsp/dspcommands.h" #include "dsp/filesink.h" #include "filesourcegui.h" @@ -272,6 +273,9 @@ bool FileSourceInput::applySettings(const Settings& settings, bool force) m_fileSourceThread->startWork(); } } + + DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency); + getOutputMessageQueue()->push(notif); qDebug() << "FileSourceInput::applySettings:" << " file name: " << settings.m_fileName.toStdString().c_str() diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index c1c23bbed..869926add 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -20,6 +20,7 @@ #include "rtlsdrinput.h" #include "rtlsdrthread.h" #include "rtlsdrgui.h" +#include "dsp/dspcommands.h" #include "util/simpleserializer.h" MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgConfigureRTLSDR, Message) @@ -259,6 +260,7 @@ bool RTLSDRInput::handleMessage(const Message& message) bool RTLSDRInput::applySettings(const Settings& settings, bool force) { QMutexLocker mutexLocker(&m_mutex); + bool forwardChange = false; if ((m_settings.m_gain != settings.m_gain) || force) { @@ -275,6 +277,8 @@ bool RTLSDRInput::applySettings(const Settings& settings, bool force) if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) { + forwardChange = true; + if(m_dev != 0) { if( rtlsdr_set_sample_rate(m_dev, settings.m_devSampleRate) < 0) @@ -306,6 +310,8 @@ bool RTLSDRInput::applySettings(const Settings& settings, bool force) if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) { + forwardChange = true; + if(m_dev != 0) { m_settings.m_log2Decim = settings.m_log2Decim; @@ -313,6 +319,11 @@ bool RTLSDRInput::applySettings(const Settings& settings, bool force) } } + if (m_settings.m_centerFrequency != settings.m_centerFrequency) + { + forwardChange = true; + } + m_settings.m_centerFrequency = settings.m_centerFrequency; if(m_dev != 0) @@ -333,6 +344,13 @@ bool RTLSDRInput::applySettings(const Settings& settings, bool force) qDebug("rtlsdr_set_center_freq(%lld) failed", m_settings.m_centerFrequency); } } + + if (forwardChange) + { + int sampleRate = m_settings.m_devSampleRate/(1<push(notif); + } return true; }