mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
UDP sink: separate GUI and sink (2)
This commit is contained in:
parent
b281a63f08
commit
294c39097b
@ -16,8 +16,11 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "dsp/upchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesource.h"
|
||||
#include "util/db.h"
|
||||
|
||||
#include "udpsinkmsg.h"
|
||||
#include "udpsink.h"
|
||||
|
||||
@ -51,6 +54,11 @@ UDPSink::UDPSink(DeviceSinkAPI *deviceAPI, BasebandSampleSink* spectrum) :
|
||||
m_settingsMutex(QMutex::Recursive)
|
||||
{
|
||||
setObjectName("UDPSink");
|
||||
|
||||
m_channelizer = new UpChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||
|
||||
m_udpHandler.setFeedbackMessageQueue(&m_inputMessageQueue);
|
||||
m_SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_settings.m_inputSampleRate, m_settings.m_rfBandwidth / m_settings.m_inputSampleRate, m_ssbFftLen);
|
||||
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
|
||||
@ -61,6 +69,9 @@ UDPSink::~UDPSink()
|
||||
{
|
||||
delete[] m_SSBFilterBuffer;
|
||||
delete m_SSBFilter;
|
||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
}
|
||||
|
||||
void UDPSink::start()
|
||||
@ -315,9 +326,9 @@ bool UDPSink::handleMessage(const Message& cmd)
|
||||
{
|
||||
MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd;
|
||||
|
||||
// m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||
// cfg.getSampleRate(),
|
||||
// cfg.getCenterFrequency());
|
||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||
cfg.getSampleRate(),
|
||||
cfg.getCenterFrequency());
|
||||
|
||||
qDebug() << "UDPSink::handleMessage: MsgConfigureChannelizer:"
|
||||
<< " sampleRate: " << cfg.getSampleRate()
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "udpsinksettings.h"
|
||||
|
||||
class DeviceSinkAPI;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class UpChannelizer;
|
||||
|
||||
class UDPSink : public BasebandSampleSource {
|
||||
Q_OBJECT
|
||||
@ -147,6 +149,8 @@ private:
|
||||
};
|
||||
|
||||
DeviceSinkAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||
UpChannelizer* m_channelizer;
|
||||
|
||||
UDPSinkSettings m_settings;
|
||||
Real m_squelch;
|
||||
|
@ -15,8 +15,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "dsp/upchannelizer.h"
|
||||
#include "dsp/threadedbasebandsamplesource.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "util/simpleserializer.h"
|
||||
@ -124,9 +122,6 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget*
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_udpSink = new UDPSink(m_deviceAPI, m_spectrumVis);
|
||||
m_udpSink->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_channelizer = new UpChannelizer(m_udpSink);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSource(m_threadedChannelizer);
|
||||
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||
@ -167,9 +162,6 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget*
|
||||
UDPSinkGUI::~UDPSinkGUI()
|
||||
{
|
||||
m_deviceAPI->removeChannelInstance(this);
|
||||
m_deviceAPI->removeThreadedSource(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
delete m_udpSink;
|
||||
delete m_spectrumVis;
|
||||
delete ui;
|
||||
@ -184,9 +176,10 @@ void UDPSinkGUI::applySettings(bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||
UDPSink::MsgConfigureChannelizer *msgChan = UDPSink::MsgConfigureChannelizer::create(
|
||||
m_settings.m_inputSampleRate,
|
||||
m_settings.m_inputFrequencyOffset);
|
||||
m_udpSink->getInputMessageQueue()->push(msgChan);
|
||||
|
||||
UDPSink::MsgConfigureUDPSink* message = UDPSink::MsgConfigureUDPSink::create( m_settings, force);
|
||||
m_udpSink->getInputMessageQueue()->push(message);
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceSinkAPI;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class UpChannelizer;
|
||||
class UDPSink;
|
||||
class SpectrumVis;
|
||||
|
||||
@ -83,8 +81,6 @@ private:
|
||||
Ui::UDPSinkGUI* ui;
|
||||
PluginAPI* m_pluginAPI;
|
||||
DeviceSinkAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSource* m_threadedChannelizer;
|
||||
UpChannelizer* m_channelizer;
|
||||
SpectrumVis* m_spectrumVis;
|
||||
UDPSink* m_udpSink;
|
||||
MovingAverage<double> m_channelPowerAvg;
|
||||
|
Loading…
Reference in New Issue
Block a user