mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-29 21:42:26 -04:00
Local Sink: added spectrum monitor
This commit is contained in:
parent
551f7cbcd3
commit
2754e3ea5e
@ -54,6 +54,7 @@ LocalSink::LocalSink(DeviceAPI *deviceAPI) :
|
|||||||
m_thread(nullptr),
|
m_thread(nullptr),
|
||||||
m_basebandSink(nullptr),
|
m_basebandSink(nullptr),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
|
m_spectrumVis(SDR_RX_SCALEF),
|
||||||
m_centerFrequency(0),
|
m_centerFrequency(0),
|
||||||
m_frequencyOffset(0),
|
m_frequencyOffset(0),
|
||||||
m_basebandSampleRate(48000)
|
m_basebandSampleRate(48000)
|
||||||
@ -147,6 +148,7 @@ void LocalSink::startProcessing()
|
|||||||
qDebug("LocalSink::startProcessing");
|
qDebug("LocalSink::startProcessing");
|
||||||
m_thread = new QThread(this);
|
m_thread = new QThread(this);
|
||||||
m_basebandSink = new LocalSinkBaseband();
|
m_basebandSink = new LocalSinkBaseband();
|
||||||
|
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||||
m_basebandSink->moveToThread(m_thread);
|
m_basebandSink->moveToThread(m_thread);
|
||||||
|
|
||||||
QObject::connect(m_thread, &QThread::finished, m_basebandSink, &QObject::deleteLater);
|
QObject::connect(m_thread, &QThread::finished, m_basebandSink, &QObject::deleteLater);
|
||||||
@ -163,6 +165,12 @@ void LocalSink::startProcessing()
|
|||||||
LocalSinkBaseband::MsgConfigureLocalSinkBaseband *msgConfig = LocalSinkBaseband::MsgConfigureLocalSinkBaseband::create(m_settings, true);
|
LocalSinkBaseband::MsgConfigureLocalSinkBaseband *msgConfig = LocalSinkBaseband::MsgConfigureLocalSinkBaseband::create(m_settings, true);
|
||||||
m_basebandSink->getInputMessageQueue()->push(msgConfig);
|
m_basebandSink->getInputMessageQueue()->push(msgConfig);
|
||||||
|
|
||||||
|
LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency *msgSpectrum = LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency::create(
|
||||||
|
m_basebandSampleRate / (1 << m_settings.m_log2Decim),
|
||||||
|
m_centerFrequency + m_frequencyOffset
|
||||||
|
);
|
||||||
|
m_basebandSink->getInputMessageQueue()->push(msgSpectrum);
|
||||||
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +206,12 @@ bool LocalSink::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency());
|
DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency());
|
||||||
m_basebandSink->getInputMessageQueue()->push(msg);
|
m_basebandSink->getInputMessageQueue()->push(msg);
|
||||||
|
LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency *msgSpectrum =
|
||||||
|
LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency::create(
|
||||||
|
m_basebandSampleRate / (1 << m_settings.m_log2Decim),
|
||||||
|
m_centerFrequency + m_frequencyOffset
|
||||||
|
);
|
||||||
|
m_basebandSink->getInputMessageQueue()->push(msgSpectrum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMessageQueueToGUI()) {
|
if (getMessageQueueToGUI()) {
|
||||||
@ -336,6 +350,16 @@ void LocalSink::applySettings(const LocalSinkSettings& settings, bool force)
|
|||||||
{
|
{
|
||||||
calculateFrequencyOffset(settings.m_log2Decim, settings.m_filterChainHash);
|
calculateFrequencyOffset(settings.m_log2Decim, settings.m_filterChainHash);
|
||||||
propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, settings.m_log2Decim);
|
propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, settings.m_log2Decim);
|
||||||
|
|
||||||
|
if (m_running)
|
||||||
|
{
|
||||||
|
LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency *msgSpectrum =
|
||||||
|
LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency::create(
|
||||||
|
m_basebandSampleRate / (1 << m_settings.m_log2Decim),
|
||||||
|
m_centerFrequency + m_frequencyOffset
|
||||||
|
);
|
||||||
|
m_basebandSink->getInputMessageQueue()->push(msgSpectrum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_play != m_settings.m_play) || force)
|
if ((settings.m_play != m_settings.m_play) || force)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
|
||||||
#include "dsp/basebandsamplesink.h"
|
#include "dsp/basebandsamplesink.h"
|
||||||
|
#include "dsp/spectrumvis.h"
|
||||||
#include "channel/channelapi.h"
|
#include "channel/channelapi.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ public:
|
|||||||
virtual void destroy() { delete this; }
|
virtual void destroy() { delete this; }
|
||||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
||||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
||||||
|
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
||||||
|
|
||||||
using BasebandSampleSink::feed;
|
using BasebandSampleSink::feed;
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
@ -146,6 +148,7 @@ private:
|
|||||||
bool m_running;
|
bool m_running;
|
||||||
LocalSinkSettings m_settings;
|
LocalSinkSettings m_settings;
|
||||||
QList<int> m_localInputDeviceIndexes;
|
QList<int> m_localInputDeviceIndexes;
|
||||||
|
SpectrumVis m_spectrumVis;
|
||||||
|
|
||||||
uint64_t m_centerFrequency;
|
uint64_t m_centerFrequency;
|
||||||
int64_t m_frequencyOffset;
|
int64_t m_frequencyOffset;
|
||||||
|
@ -20,14 +20,17 @@
|
|||||||
#include "dsp/downchannelizer.h"
|
#include "dsp/downchannelizer.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
|
#include "dsp/spectrumvis.h"
|
||||||
|
|
||||||
#include "localsinkbaseband.h"
|
#include "localsinkbaseband.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message)
|
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message)
|
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgSetSpectrumSampleRateAndFrequency, Message)
|
||||||
|
|
||||||
LocalSinkBaseband::LocalSinkBaseband() :
|
LocalSinkBaseband::LocalSinkBaseband() :
|
||||||
m_localSampleSource(nullptr)
|
m_localSampleSource(nullptr),
|
||||||
|
m_spectrumVis(nullptr)
|
||||||
{
|
{
|
||||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
|
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
|
||||||
m_channelizer = new DownChannelizer(&m_sink);
|
m_channelizer = new DownChannelizer(&m_sink);
|
||||||
@ -137,6 +140,18 @@ bool LocalSinkBaseband::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgSetSpectrumSampleRateAndFrequency::match(cmd))
|
||||||
|
{
|
||||||
|
MsgSetSpectrumSampleRateAndFrequency& notif = (MsgSetSpectrumSampleRateAndFrequency&) cmd;
|
||||||
|
|
||||||
|
if (m_spectrumVis)
|
||||||
|
{
|
||||||
|
DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency());
|
||||||
|
m_spectrumVis->getInputMessageQueue()->push(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,6 +77,28 @@ public:
|
|||||||
DeviceSampleSource *m_deviceSampleSource;
|
DeviceSampleSource *m_deviceSampleSource;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgSetSpectrumSampleRateAndFrequency : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
static MsgSetSpectrumSampleRateAndFrequency* create(int sampleRate, qint64 centerFrequency) {
|
||||||
|
return new MsgSetSpectrumSampleRateAndFrequency(sampleRate, centerFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSampleRate() const { return m_sampleRate; }
|
||||||
|
qint64 getCenterFrequency() const { return m_centerFrequency; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
MsgSetSpectrumSampleRateAndFrequency(int sampleRate, qint64 centerFrequency) :
|
||||||
|
Message(),
|
||||||
|
m_sampleRate(sampleRate),
|
||||||
|
m_centerFrequency(centerFrequency)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
int m_sampleRate;
|
||||||
|
qint64 m_centerFrequency;
|
||||||
|
};
|
||||||
|
|
||||||
LocalSinkBaseband();
|
LocalSinkBaseband();
|
||||||
~LocalSinkBaseband();
|
~LocalSinkBaseband();
|
||||||
void reset();
|
void reset();
|
||||||
@ -86,6 +108,7 @@ public:
|
|||||||
void startSource() { m_sink.start(m_localSampleSource); }
|
void startSource() { m_sink.start(m_localSampleSource); }
|
||||||
void stopSource() { m_sink.stop(); }
|
void stopSource() { m_sink.stop(); }
|
||||||
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); }
|
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); }
|
||||||
|
void setSpectrumSink(SpectrumVis* spectrumSink) { m_spectrumVis = spectrumSink; m_sink.setSpectrumSink(spectrumSink); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SampleSinkFifo m_sampleFifo;
|
SampleSinkFifo m_sampleFifo;
|
||||||
@ -94,6 +117,7 @@ private:
|
|||||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||||
LocalSinkSettings m_settings;
|
LocalSinkSettings m_settings;
|
||||||
DeviceSampleSource *m_localSampleSource;
|
DeviceSampleSource *m_localSampleSource;
|
||||||
|
SpectrumVis *m_spectrumVis;
|
||||||
QRecursiveMutex m_mutex;
|
QRecursiveMutex m_mutex;
|
||||||
|
|
||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
@ -83,6 +83,7 @@ bool LocalSinkGUI::handleMessage(const Message& message)
|
|||||||
const LocalSink::MsgConfigureLocalSink& cfg = (LocalSink::MsgConfigureLocalSink&) message;
|
const LocalSink::MsgConfigureLocalSink& cfg = (LocalSink::MsgConfigureLocalSink&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
|
ui->spectrumGUI->updateSettings();
|
||||||
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -119,8 +120,13 @@ LocalSinkGUI::LocalSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
|||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||||
|
|
||||||
m_localSink = (LocalSink*) channelrx;
|
m_localSink = (LocalSink*) channelrx;
|
||||||
|
m_spectrumVis = m_localSink->getSpectrumVis();
|
||||||
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||||
m_localSink->setMessageQueueToGUI(getInputMessageQueue());
|
m_localSink->setMessageQueueToGUI(getInputMessageQueue());
|
||||||
|
|
||||||
|
ui->glSpectrum->setCenterFrequency(m_deviceCenterFrequency);
|
||||||
|
ui->glSpectrum->setSampleRate(m_basebandSampleRate);
|
||||||
|
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
m_channelMarker.setColor(m_settings.m_rgbColor);
|
m_channelMarker.setColor(m_settings.m_rgbColor);
|
||||||
m_channelMarker.setCenterFrequency(0);
|
m_channelMarker.setCenterFrequency(0);
|
||||||
@ -129,11 +135,13 @@ LocalSinkGUI::LocalSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
|||||||
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
m_channelMarker.setVisible(true); // activate signal on the last setting only
|
||||||
|
|
||||||
m_settings.setChannelMarker(&m_channelMarker);
|
m_settings.setChannelMarker(&m_channelMarker);
|
||||||
|
m_settings.setSpectrumGUI(ui->spectrumGUI);
|
||||||
m_settings.setRollupState(&m_rollupState);
|
m_settings.setRollupState(&m_rollupState);
|
||||||
|
|
||||||
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||||
|
|
||||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
|
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
||||||
|
|
||||||
updateDeviceSetList(m_localSink->getDeviceSetList());
|
updateDeviceSetList(m_localSink->getDeviceSetList());
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -199,6 +207,8 @@ void LocalSinkGUI::displayRateAndShift()
|
|||||||
QLocale loc;
|
QLocale loc;
|
||||||
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
|
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
|
||||||
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
|
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
|
||||||
|
ui->glSpectrum->setSampleRate(channelSampleRate);
|
||||||
|
ui->glSpectrum->setCenterFrequency(m_deviceCenterFrequency + shift);
|
||||||
m_channelMarker.setCenterFrequency(shift);
|
m_channelMarker.setCenterFrequency(shift);
|
||||||
m_channelMarker.setBandwidth(channelSampleRate);
|
m_channelMarker.setBandwidth(channelSampleRate);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class PluginAPI;
|
|||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
class LocalSink;
|
class LocalSink;
|
||||||
class BasebandSampleSink;
|
class BasebandSampleSink;
|
||||||
|
class SpectrumVis;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class LocalSinkGUI;
|
class LocalSinkGUI;
|
||||||
@ -73,6 +74,7 @@ private:
|
|||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
LocalSink* m_localSink;
|
LocalSink* m_localSink;
|
||||||
|
SpectrumVis* m_spectrumVis;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
uint32_t m_tickCount;
|
uint32_t m_tickCount;
|
||||||
|
@ -6,26 +6,20 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>320</width>
|
<width>414</width>
|
||||||
<height>110</height>
|
<height>406</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>320</width>
|
<width>414</width>
|
||||||
<height>100</height>
|
<height>0</height>
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>560</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -42,7 +36,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>302</width>
|
<width>401</width>
|
||||||
<height>91</height>
|
<height>91</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -313,6 +307,80 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="spectrumContainer" native="true">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>218</width>
|
||||||
|
<height>284</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Channel Spectrum</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="GLSpectrum" name="glSpectrum" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>250</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
<pointsize>8</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
@ -326,6 +394,18 @@
|
|||||||
<header>gui/rollupcontents.h</header>
|
<header>gui/rollupcontents.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>GLSpectrum</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/glspectrum.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>GLSpectrumGUI</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/glspectrumgui.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||||
|
@ -41,11 +41,13 @@ struct LocalSinkSettings
|
|||||||
QByteArray m_geometryBytes;
|
QByteArray m_geometryBytes;
|
||||||
bool m_hidden;
|
bool m_hidden;
|
||||||
|
|
||||||
|
Serializable *m_spectrumGUI;
|
||||||
Serializable *m_channelMarker;
|
Serializable *m_channelMarker;
|
||||||
Serializable *m_rollupState;
|
Serializable *m_rollupState;
|
||||||
|
|
||||||
LocalSinkSettings();
|
LocalSinkSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
|
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
||||||
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#include "dsp/devicesamplesource.h"
|
#include "dsp/devicesamplesource.h"
|
||||||
#include "dsp/hbfilterchainconverter.h"
|
#include "dsp/hbfilterchainconverter.h"
|
||||||
|
#include "dsp/spectrumvis.h"
|
||||||
|
|
||||||
#include "localsinkworker.h"
|
#include "localsinkworker.h"
|
||||||
#include "localsinksink.h"
|
#include "localsinksink.h"
|
||||||
@ -28,6 +29,7 @@
|
|||||||
LocalSinkSink::LocalSinkSink() :
|
LocalSinkSink::LocalSinkSink() :
|
||||||
m_deviceSource(nullptr),
|
m_deviceSource(nullptr),
|
||||||
m_sinkWorker(nullptr),
|
m_sinkWorker(nullptr),
|
||||||
|
m_spectrumSink(nullptr),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_centerFrequency(0),
|
m_centerFrequency(0),
|
||||||
m_frequencyOffset(0),
|
m_frequencyOffset(0),
|
||||||
@ -47,6 +49,10 @@ void LocalSinkSink::feed(const SampleVector::const_iterator& begin, const Sample
|
|||||||
if (m_running && m_deviceSource) {
|
if (m_running && m_deviceSource) {
|
||||||
m_deviceSource->getSampleFifo()->write(begin, end);
|
m_deviceSource->getSampleFifo()->write(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_spectrumSink) {
|
||||||
|
m_spectrumSink->feed(begin, end, false);
|
||||||
|
}
|
||||||
// m_sampleFifo.write(begin, end);
|
// m_sampleFifo.write(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
class DeviceSampleSource;
|
class DeviceSampleSource;
|
||||||
class LocalSinkWorker;
|
class LocalSinkWorker;
|
||||||
|
class SpectrumVis;
|
||||||
|
|
||||||
class LocalSinkSink : public QObject, public ChannelSampleSink {
|
class LocalSinkSink : public QObject, public ChannelSampleSink {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -36,6 +37,7 @@ public:
|
|||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
|
||||||
|
|
||||||
|
void setSpectrumSink(SpectrumVis* spectrumSink) { m_spectrumSink = spectrumSink; }
|
||||||
void applySettings(const LocalSinkSettings& settings, bool force = false);
|
void applySettings(const LocalSinkSettings& settings, bool force = false);
|
||||||
void start(DeviceSampleSource *deviceSource);
|
void start(DeviceSampleSource *deviceSource);
|
||||||
void stop();
|
void stop();
|
||||||
@ -48,6 +50,8 @@ private:
|
|||||||
LocalSinkSettings m_settings;
|
LocalSinkSettings m_settings;
|
||||||
LocalSinkWorker *m_sinkWorker;
|
LocalSinkWorker *m_sinkWorker;
|
||||||
QThread m_sinkWorkerThread;
|
QThread m_sinkWorkerThread;
|
||||||
|
SpectrumVis* m_spectrumSink;
|
||||||
|
SampleVector m_spectrumBuffer;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
uint64_t m_centerFrequency;
|
uint64_t m_centerFrequency;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user