1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

GLScope redesign: ScopeVis is not created in the GUI anymore

This commit is contained in:
f4exb 2021-05-30 13:12:00 +02:00
parent 5ab495a3fb
commit 3908599463
30 changed files with 86 additions and 91 deletions

View File

@ -43,7 +43,6 @@ Interferometer::Interferometer(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamMIMO), ChannelAPI(m_channelIdURI, ChannelAPI::StreamMIMO),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_spectrumVis(SDR_RX_SCALEF), m_spectrumVis(SDR_RX_SCALEF),
m_scopeSink(nullptr),
m_guiMessageQueue(nullptr), m_guiMessageQueue(nullptr),
m_frequencyOffset(0), m_frequencyOffset(0),
m_deviceSampleRate(48000) m_deviceSampleRate(48000)
@ -73,12 +72,6 @@ Interferometer::~Interferometer()
delete m_thread; delete m_thread;
} }
void Interferometer::setScopeSink(ScopeVis *scopeSink)
{
m_scopeSink = scopeSink;
m_basebandSink->setScopeSink(scopeSink);
}
void Interferometer::startSinks() void Interferometer::startSinks()
{ {
if (m_deviceSampleRate != 0) { if (m_deviceSampleRate != 0) {

View File

@ -23,6 +23,7 @@
#include "dsp/mimochannel.h" #include "dsp/mimochannel.h"
#include "dsp/spectrumvis.h" #include "dsp/spectrumvis.h"
#include "dsp/scopevis.h"
#include "channel/channelapi.h" #include "channel/channelapi.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
#include "util/message.h" #include "util/message.h"
@ -34,7 +35,6 @@ class DeviceAPI;
class InterferometerBaseband; class InterferometerBaseband;
class QNetworkReply; class QNetworkReply;
class QNetworkAccessManager; class QNetworkAccessManager;
class ScopeVis;
class Interferometer: public MIMOChannel, public ChannelAPI class Interferometer: public MIMOChannel, public ChannelAPI
{ {
@ -121,7 +121,7 @@ public:
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; } MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
void setScopeSink(ScopeVis *scopeSink); ScopeVis *getScopeVis() { return &m_scopeSink; }
void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash); void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash);
virtual int webapiSettingsGet( virtual int webapiSettingsGet(
@ -151,8 +151,8 @@ private:
DeviceAPI *m_deviceAPI; DeviceAPI *m_deviceAPI;
QThread *m_thread; QThread *m_thread;
SpectrumVis m_spectrumVis; SpectrumVis m_spectrumVis;
ScopeVis m_scopeSink;
InterferometerBaseband* m_basebandSink; InterferometerBaseband* m_basebandSink;
ScopeVis* m_scopeSink;
InterferometerSettings m_settings; InterferometerSettings m_settings;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI

View File

@ -110,11 +110,11 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
m_scopeVis = new ScopeVis(ui->glScope);
m_interferometer = (Interferometer*) channelMIMO; m_interferometer = (Interferometer*) channelMIMO;
m_spectrumVis = m_interferometer->getSpectrumVis(); m_spectrumVis = m_interferometer->getSpectrumVis();
m_interferometer->setScopeSink(m_scopeVis); m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_scopeVis = m_interferometer->getScopeVis();
m_scopeVis->setGLScope(ui->glScope);
m_interferometer->setMessageQueueToGUI(getInputMessageQueue()); m_interferometer->setMessageQueueToGUI(getInputMessageQueue());
m_sampleRate = m_interferometer->getDeviceSampleRate(); m_sampleRate = m_interferometer->getDeviceSampleRate();
@ -159,7 +159,6 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
InterferometerGUI::~InterferometerGUI() InterferometerGUI::~InterferometerGUI()
{ {
delete m_scopeVis;
delete ui; delete ui;
} }

View File

@ -24,6 +24,7 @@
#include "dsp/basebandsamplesink.h" #include "dsp/basebandsamplesink.h"
#include "dsp/spectrumvis.h" #include "dsp/spectrumvis.h"
#include "dsp/scopevis.h"
#include "channel/channelapi.h" #include "channel/channelapi.h"
#include "util/message.h" #include "util/message.h"
#include "util/movingaverage.h" #include "util/movingaverage.h"
@ -60,6 +61,7 @@ public:
virtual ~ChannelAnalyzer(); virtual ~ChannelAnalyzer();
virtual void destroy() { delete this; } virtual void destroy() { delete this; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
ScopeVis *getScopeVis() { return &m_scopeVis; }
void setSampleSink(BasebandSampleSink *sink) { m_basebandSink->setSampleSink(sink); } void setSampleSink(BasebandSampleSink *sink) { m_basebandSink->setSampleSink(sink); }
int getChannelSampleRate() const { return m_basebandSink->getChannelSampleRate(); } int getChannelSampleRate() const { return m_basebandSink->getChannelSampleRate(); }
@ -103,6 +105,7 @@ private:
ChannelAnalyzerBaseband *m_basebandSink; ChannelAnalyzerBaseband *m_basebandSink;
ChannelAnalyzerSettings m_settings; ChannelAnalyzerSettings m_settings;
SpectrumVis m_spectrumVis; SpectrumVis m_spectrumVis;
ScopeVis m_scopeVis;
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
qint64 m_centerFrequency; //!< stored from device message used when starting baseband sink qint64 m_centerFrequency; //!< stored from device message used when starting baseband sink

View File

@ -467,13 +467,14 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
m_scopeVis = new ScopeVis(ui->glScope);
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
m_channelAnalyzer = (ChannelAnalyzer*) rxChannel; m_channelAnalyzer = (ChannelAnalyzer*) rxChannel;
m_spectrumVis = m_channelAnalyzer->getSpectrumVis(); m_spectrumVis = m_channelAnalyzer->getSpectrumVis();
m_spectrumVis->setGLSpectrum(ui->glSpectrum); m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_scopeVis = m_channelAnalyzer->getScopeVis();
m_scopeVis->setGLScope(ui->glScope);
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis); m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
m_basebandSampleRate = m_channelAnalyzer->getChannelSampleRate(); m_basebandSampleRate = m_channelAnalyzer->getChannelSampleRate();
m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis); m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis);
@ -529,7 +530,6 @@ ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
ui->glScope->disconnectTimer(); ui->glScope->disconnectTimer();
delete ui; delete ui;
delete m_spectrumScopeComboVis; delete m_spectrumScopeComboVis;
delete m_scopeVis;
qDebug("ChannelAnalyzerGUI::~ChannelAnalyzerGUI: done"); qDebug("ChannelAnalyzerGUI::~ChannelAnalyzerGUI: done");
} }

View File

@ -186,9 +186,9 @@ bool AISDemod::handleMessage(const Message& cmd)
} }
} }
void AISDemod::setScopeSink(ScopeVis* scopeSink) ScopeVis *AISDemod::getScopeSink()
{ {
m_basebandSink->setScopeSink(scopeSink); return m_basebandSink->getScopeSink();
} }
void AISDemod::applySettings(const AISDemodSettings& settings, bool force) void AISDemod::applySettings(const AISDemodSettings& settings, bool force)

View File

@ -136,7 +136,7 @@ public:
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
void setScopeSink(ScopeVis* scopeSink); ScopeVis *getScopeSink();
double getMagSq() const { return m_basebandSink->getMagSq(); } double getMagSq() const { return m_basebandSink->getMagSq(); }
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {

View File

@ -33,6 +33,7 @@ AISDemodBaseband::AISDemodBaseband(AISDemod *aisDemod) :
{ {
qDebug("AISDemodBaseband::AISDemodBaseband"); qDebug("AISDemodBaseband::AISDemodBaseband");
m_sink.setScopeSink(&m_scopeSink);
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
m_channelizer = new DownChannelizer(&m_sink); m_channelizer = new DownChannelizer(&m_sink);
} }

View File

@ -23,6 +23,7 @@
#include <QMutex> #include <QMutex>
#include "dsp/samplesinkfifo.h" #include "dsp/samplesinkfifo.h"
#include "dsp/scopevis.h"
#include "util/message.h" #include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
@ -72,7 +73,7 @@ public:
} }
void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); } void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); }
void setBasebandSampleRate(int sampleRate); void setBasebandSampleRate(int sampleRate);
void setScopeSink(ScopeVis* scopeSink) { m_sink.setScopeSink(scopeSink); } ScopeVis *getScopeSink() { return &m_scopeSink; }
void setChannel(ChannelAPI *channel); void setChannel(ChannelAPI *channel);
double getMagSq() const { return m_sink.getMagSq(); } double getMagSq() const { return m_sink.getMagSq(); }
bool isRunning() const { return m_running; } bool isRunning() const { return m_running; }
@ -83,6 +84,7 @@ private:
AISDemodSink m_sink; AISDemodSink m_sink;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
AISDemodSettings m_settings; AISDemodSettings m_settings;
ScopeVis m_scopeSink;
bool m_running; bool m_running;
QMutex m_mutex; QMutex m_mutex;

View File

@ -415,8 +415,8 @@ AISDemodGUI::AISDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
m_scopeVis = new ScopeVis(ui->glScope); m_scopeVis = m_aisDemod->getScopeSink();
m_aisDemod->setScopeSink(m_scopeVis); m_scopeVis->setGLScope(ui->glScope);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);

View File

@ -88,7 +88,7 @@ public:
return m_settings.m_inputFrequencyOffset; return m_settings.m_inputFrequencyOffset;
} }
void setScopeSink(ScopeVis* scopeSink) { m_basebandSink->setScopeSink(scopeSink); } ScopeVis *getScopeSink() { return m_basebandSink->getScopeSink(); }
void setTVScreen(TVScreenAnalog *tvScreen) { m_basebandSink->setTVScreen(tvScreen); }; //!< set by the GUI void setTVScreen(TVScreenAnalog *tvScreen) { m_basebandSink->setTVScreen(tvScreen); }; //!< set by the GUI
double getMagSq() const { return m_basebandSink->getMagSq(); } //!< Beware this is scaled to 2^30 double getMagSq() const { return m_basebandSink->getMagSq(); } //!< Beware this is scaled to 2^30
bool getBFOLocked() { return m_basebandSink->getBFOLocked(); } bool getBFOLocked() { return m_basebandSink->getBFOLocked(); }

View File

@ -30,6 +30,7 @@ ATVDemodBaseband::ATVDemodBaseband() :
m_mutex(QMutex::Recursive) m_mutex(QMutex::Recursive)
{ {
qDebug("ATVDemodBaseband::ATVDemodBaseband"); qDebug("ATVDemodBaseband::ATVDemodBaseband");
m_sink.setScopeSink(&m_scopeSink);
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
m_channelizer = new DownChannelizer(&m_sink); m_channelizer = new DownChannelizer(&m_sink);
} }

View File

@ -22,6 +22,7 @@
#include <QMutex> #include <QMutex>
#include "dsp/samplesinkfifo.h" #include "dsp/samplesinkfifo.h"
#include "dsp/scopevis.h"
#include "util/message.h" #include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
@ -65,7 +66,7 @@ public:
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
int getChannelSampleRate() const; int getChannelSampleRate() const;
double getMagSq() const { return m_sink.getMagSq(); } double getMagSq() const { return m_sink.getMagSq(); }
void setScopeSink(ScopeVis* scopeSink) { m_sink.setScopeSink(scopeSink); } ScopeVis *getScopeSink() { return &m_scopeSink; }
void setTVScreen(TVScreenAnalog *tvScreen) { m_sink.setTVScreen(tvScreen); } void setTVScreen(TVScreenAnalog *tvScreen) { m_sink.setTVScreen(tvScreen); }
bool getBFOLocked() { return m_sink.getBFOLocked(); } bool getBFOLocked() { return m_sink.getBFOLocked(); }
void setVideoTabIndex(int videoTabIndex) { m_sink.setVideoTabIndex(videoTabIndex); } void setVideoTabIndex(int videoTabIndex) { m_sink.setVideoTabIndex(videoTabIndex); }
@ -78,6 +79,7 @@ private:
ATVDemodSink m_sink; ATVDemodSink m_sink;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
ATVDemodSettings m_settings; ATVDemodSettings m_settings;
ScopeVis m_scopeSink;
bool m_running; bool m_running;
QMutex m_mutex; QMutex m_mutex;

View File

@ -222,10 +222,10 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
m_scopeVis = new ScopeVis(ui->glScope);
m_atvDemod = (ATVDemod*) rxChannel; m_atvDemod = (ATVDemod*) rxChannel;
m_atvDemod->setMessageQueueToGUI(getInputMessageQueue()); m_atvDemod->setMessageQueueToGUI(getInputMessageQueue());
m_atvDemod->setScopeSink(m_scopeVis); m_scopeVis = m_atvDemod->getScopeSink();
m_scopeVis->setGLScope(ui->glScope);
m_atvDemod->setTVScreen(ui->screenTV); m_atvDemod->setTVScreen(ui->screenTV);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
@ -276,7 +276,6 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base
ATVDemodGUI::~ATVDemodGUI() ATVDemodGUI::~ATVDemodGUI()
{ {
delete m_scopeVis;
delete ui; delete ui;
} }

View File

@ -33,7 +33,6 @@
class PluginAPI; class PluginAPI;
class DeviceUISet; class DeviceUISet;
class BasebandSampleSink; class BasebandSampleSink;
class ScopeVis;
class ScopeVisXY; class ScopeVisXY;
class DSDDemod; class DSDDemod;

View File

@ -607,9 +607,9 @@ uint32_t IEEE_802_15_4_Mod::getNumberOfDeviceStreams() const
return m_deviceAPI->getNbSinkStreams(); return m_deviceAPI->getNbSinkStreams();
} }
void IEEE_802_15_4_Mod::setScopeSink(ScopeVis* scopeSink) ScopeVis *IEEE_802_15_4_Mod::getScopeSink()
{ {
m_basebandSource->setScopeSink(scopeSink); return m_basebandSource->getScopeSink();
} }
void IEEE_802_15_4_Mod::openUDP(const IEEE_802_15_4_ModSettings& settings) void IEEE_802_15_4_Mod::openUDP(const IEEE_802_15_4_ModSettings& settings)

View File

@ -144,7 +144,7 @@ public:
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
void setScopeSink(ScopeVis* scopeSink); ScopeVis *getScopeSink();
double getMagSq() const; double getMagSq() const;
void setLevelMeter(QObject *levelMeter); void setLevelMeter(QObject *levelMeter);
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -32,6 +32,7 @@ IEEE_802_15_4_ModBaseband::IEEE_802_15_4_ModBaseband() :
{ {
m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(48000)); m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(48000));
m_channelizer = new UpChannelizer(&m_source); m_channelizer = new UpChannelizer(&m_source);
m_source.setScopeSink(&m_scopeSink);
qDebug("IEEE_802_15_4_ModBaseband::IEEE_802_15_4_ModBaseband"); qDebug("IEEE_802_15_4_ModBaseband::IEEE_802_15_4_ModBaseband");
QObject::connect( QObject::connect(

View File

@ -23,6 +23,7 @@
#include <QMutex> #include <QMutex>
#include "dsp/samplesourcefifo.h" #include "dsp/samplesourcefifo.h"
#include "dsp/scopevis.h"
#include "util/message.h" #include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
@ -66,7 +67,7 @@ public:
double getMagSq() const { return m_source.getMagSq(); } double getMagSq() const { return m_source.getMagSq(); }
int getChannelSampleRate() const; int getChannelSampleRate() const;
void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); } void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); }
void setScopeSink(ScopeVis* scopeSink) { m_source.setScopeSink(scopeSink); } ScopeVis *getScopeSink() { return &m_scopeSink; }
signals: signals:
@ -84,6 +85,7 @@ private:
IEEE_802_15_4_ModSource m_source; IEEE_802_15_4_ModSource m_source;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
IEEE_802_15_4_ModSettings m_settings; IEEE_802_15_4_ModSettings m_settings;
ScopeVis m_scopeSink;
QMutex m_mutex; QMutex m_mutex;
void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd); void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd);

View File

@ -359,8 +359,8 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_scopeVis = new ScopeVis(ui->glScope); m_scopeVis = m_IEEE_802_15_4_Mod->getScopeSink();
m_IEEE_802_15_4_Mod->setScopeSink(m_scopeVis); m_scopeVis->setGLScope(ui->glScope);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
@ -442,7 +442,6 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de
IEEE_802_15_4_ModGUI::~IEEE_802_15_4_ModGUI() IEEE_802_15_4_ModGUI::~IEEE_802_15_4_ModGUI()
{ {
delete m_scopeVis;
delete ui; delete ui;
} }

View File

@ -140,9 +140,9 @@ bool AISMod::handleMessage(const Message& cmd)
} }
} }
void AISMod::setScopeSink(ScopeVis* scopeSink) ScopeVis *AISMod::getScopeSink()
{ {
m_basebandSource->setScopeSink(scopeSink); return m_basebandSource->getScopeSink();
} }
void AISMod::applySettings(const AISModSettings& settings, bool force) void AISMod::applySettings(const AISModSettings& settings, bool force)

View File

@ -161,7 +161,7 @@ public:
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
void setScopeSink(ScopeVis* scopeSink); ScopeVis *getScopeSink();
double getMagSq() const; double getMagSq() const;
void setLevelMeter(QObject *levelMeter); void setLevelMeter(QObject *levelMeter);
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -32,6 +32,7 @@ AISModBaseband::AISModBaseband() :
{ {
m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(48000)); m_sampleFifo.resize(SampleSourceFifo::getSizePolicy(48000));
m_channelizer = new UpChannelizer(&m_source); m_channelizer = new UpChannelizer(&m_source);
m_source.setScopeSink(&m_scopeSink);
qDebug("AISModBaseband::AISModBaseband"); qDebug("AISModBaseband::AISModBaseband");
QObject::connect( QObject::connect(

View File

@ -23,6 +23,7 @@
#include <QMutex> #include <QMutex>
#include "dsp/samplesourcefifo.h" #include "dsp/samplesourcefifo.h"
#include "dsp/scopevis.h"
#include "util/message.h" #include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
@ -67,7 +68,7 @@ public:
double getMagSq() const { return m_source.getMagSq(); } double getMagSq() const { return m_source.getMagSq(); }
int getChannelSampleRate() const; int getChannelSampleRate() const;
void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); } void setSpectrumSampleSink(BasebandSampleSink* sampleSink) { m_source.setSpectrumSink(sampleSink); }
void setScopeSink(ScopeVis* scopeSink) { m_source.setScopeSink(scopeSink); } ScopeVis *getScopeSink() { return &m_scopeSink; }
void setChannel(ChannelAPI *channel); void setChannel(ChannelAPI *channel);
signals: signals:
@ -85,6 +86,7 @@ private:
AISModSource m_source; AISModSource m_source;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
AISModSettings m_settings; AISModSettings m_settings;
ScopeVis m_scopeSink;
QMutex m_mutex; QMutex m_mutex;
void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd); void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd);

View File

@ -490,8 +490,8 @@ AISModGUI::AISModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
m_scopeVis = new ScopeVis(ui->glScope); m_scopeVis = m_aisMod->getScopeSink();
m_aisMod->setScopeSink(m_scopeVis); m_scopeVis->setGLScope(ui->glScope);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);

View File

@ -25,6 +25,7 @@
#include "feature/feature.h" #include "feature/feature.h"
#include "util/message.h" #include "util/message.h"
#include "dsp/spectrumvis.h" #include "dsp/spectrumvis.h"
#include "dsp/scopevis.h"
#include "demodanalyzersettings.h" #include "demodanalyzersettings.h"
@ -156,6 +157,7 @@ public:
virtual ~DemodAnalyzer(); virtual ~DemodAnalyzer();
virtual void destroy() { delete this; } virtual void destroy() { delete this; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
ScopeVis *getScopeVis() { return &m_scopeVis; }
void setSampleSink(BasebandSampleSink *sink); void setSampleSink(BasebandSampleSink *sink);
double getMagSqAvg() const; double getMagSqAvg() const;
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
@ -197,6 +199,7 @@ private:
DemodAnalyzerWorker *m_worker; DemodAnalyzerWorker *m_worker;
DemodAnalyzerSettings m_settings; DemodAnalyzerSettings m_settings;
SpectrumVis m_spectrumVis; SpectrumVis m_spectrumVis;
ScopeVis m_scopeVis;
QHash<ChannelAPI*, DemodAnalyzerSettings::AvailableChannel> m_availableChannels; QHash<ChannelAPI*, DemodAnalyzerSettings::AvailableChannel> m_availableChannels;
ChannelAPI *m_selectedChannel; ChannelAPI *m_selectedChannel;
DataFifo *m_dataFifo; DataFifo *m_dataFifo;

View File

@ -139,10 +139,11 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
setChannelWidget(false); setChannelWidget(false);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
m_scopeVis = new ScopeVis(ui->glScope);
m_demodAnalyzer = reinterpret_cast<DemodAnalyzer*>(feature); m_demodAnalyzer = reinterpret_cast<DemodAnalyzer*>(feature);
m_demodAnalyzer->setMessageQueueToGUI(&m_inputMessageQueue); m_demodAnalyzer->setMessageQueueToGUI(&m_inputMessageQueue);
m_scopeVis = m_demodAnalyzer->getScopeVis();
m_scopeVis->setGLScope(ui->glScope);
m_spectrumVis = m_demodAnalyzer->getSpectrumVis(); m_spectrumVis = m_demodAnalyzer->getSpectrumVis();
m_spectrumVis->setGLSpectrum(ui->glSpectrum); m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis); m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
@ -180,7 +181,6 @@ DemodAnalyzerGUI::~DemodAnalyzerGUI()
{ {
delete ui; delete ui;
delete m_spectrumScopeComboVis; delete m_spectrumScopeComboVis;
delete m_scopeVis;
} }
void DemodAnalyzerGUI::blockApplySettings(bool block) void DemodAnalyzerGUI::blockApplySettings(bool block)

View File

@ -1,38 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2021 Edouard Griffiths, F4EXB. //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_DSP_GLSCOPEINTERFACE_H_
#define SDRBASE_DSP_GLSCOPEINTERFACE_H_
#include "dsptypes.h"
#include "scopesettings.h"
#include "physicalunit.h"
class GLScopeInterface
{
public:
GLScopeInterface() {}
virtual ~GLScopeInterface() {}
virtual void setTracesData(std::vector<ScopeSettings::TraceData>* tracesData) = 0;
virtual void setTraces(std::vector<std::vector<float>>* traces) = 0;
virtual void newTraces(int traceIndex, int traceSize) = 0;
virtual void setTimeScale(float min, float max) = 0; //!< Linear horizontal scales
virtual void setXScale(Unit::Physical unit, float min, float max) = 0; //!< Set X Scale => X for polar, Y1 for linear
virtual void setYScale(Unit::Physical unit, float min, float max) = 0; //!< Set Y Scale => Y for polar, Y2 for linear
};
#endif // SDRBASE_DSP_GLSPECTRUMINTERFACE_H_

View File

@ -39,8 +39,8 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGOneShot, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message) MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
ScopeVis::ScopeVis(GLScopeInterface* glScope) : ScopeVis::ScopeVis() :
m_glScope(glScope), m_glScope(nullptr),
m_messageQueueToGUI(nullptr), m_messageQueueToGUI(nullptr),
m_preTriggerDelay(0), m_preTriggerDelay(0),
m_livePreTriggerDelay(0), m_livePreTriggerDelay(0),
@ -67,7 +67,6 @@ ScopeVis::ScopeVis(GLScopeInterface* glScope) :
{ {
setObjectName("ScopeVis"); setObjectName("ScopeVis");
m_traceDiscreteMemory.resize(GLScopeSettings::m_traceChunkDefaultSize); // arbitrary m_traceDiscreteMemory.resize(GLScopeSettings::m_traceChunkDefaultSize); // arbitrary
m_glScope->setTraces(&m_traces.m_tracesData, &m_traces.m_traces[0]);
for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) { for (int i = 0; i < (int) Projector::nbProjectionTypes; i++) {
m_projectorCache[i] = 0.0; m_projectorCache[i] = 0.0;
} }
@ -82,6 +81,12 @@ ScopeVis::~ScopeVis()
} }
} }
void ScopeVis::setGLScope(GLScopeInterface* glScope)
{
m_glScope = glScope;
m_glScope->setTraces(&m_traces.m_tracesData, &m_traces.m_traces[0]);
}
void ScopeVis::setLiveRate(int sampleRate) void ScopeVis::setLiveRate(int sampleRate)
{ {
m_liveSampleRate = sampleRate; m_liveSampleRate = sampleRate;
@ -617,11 +622,11 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
float traceTime = ((float) m_traceSize) / m_sampleRate; float traceTime = ((float) m_traceSize) / m_sampleRate;
if (traceTime >= 1.0f) { // display continuously if trace time is 1 second or more if (m_glScope && (traceTime >= 1.0f)) { // display continuously if trace time is 1 second or more
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes); m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes);
} }
if (m_nbSamples == 0) // finished if (m_glScope && (m_nbSamples == 0)) // finished
{ {
// display only at trace end if trace time is less than 1 second // display only at trace end if trace time is less than 1 second
if (traceTime < 1.0f) if (traceTime < 1.0f)
@ -756,7 +761,11 @@ bool ScopeVis::handleMessage(const Message& message)
if (triggerIndex == m_focusedTriggerIndex) if (triggerIndex == m_focusedTriggerIndex)
{ {
computeDisplayTriggerLevels(); computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData); m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay(); updateGLScopeDisplay();
} }
} }
@ -797,7 +806,11 @@ bool ScopeVis::handleMessage(const Message& message)
m_triggerConditions[triggerIndex] = nextTrigger; m_triggerConditions[triggerIndex] = nextTrigger;
computeDisplayTriggerLevels(); computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData); m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay(); updateGLScopeDisplay();
return true; return true;
@ -812,7 +825,11 @@ bool ScopeVis::handleMessage(const Message& message)
{ {
m_focusedTriggerIndex = triggerIndex; m_focusedTriggerIndex = triggerIndex;
computeDisplayTriggerLevels(); computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData); m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay(); updateGLScopeDisplay();
} }
@ -877,7 +894,11 @@ bool ScopeVis::handleMessage(const Message& message)
{ {
m_focusedTraceIndex = traceIndex; m_focusedTraceIndex = traceIndex;
computeDisplayTriggerLevels(); computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTraceIndex(m_focusedTraceIndex); m_glScope->setFocusedTraceIndex(m_focusedTraceIndex);
}
updateGLScopeDisplay(); updateGLScopeDisplay();
} }
@ -1044,6 +1065,10 @@ void ScopeVis::computeDisplayTriggerLevels()
void ScopeVis::updateGLScopeDisplay() void ScopeVis::updateGLScopeDisplay()
{ {
if (!m_glScope) {
return;
}
if (m_currentTraceMemoryIndex > 0) if (m_currentTraceMemoryIndex > 0)
{ {
m_glScope->setConfigChanged(); m_glScope->setConfigChanged();

View File

@ -43,9 +43,10 @@ class GLScopeInterface;
class SDRGUI_API ScopeVis : public QObject { class SDRGUI_API ScopeVis : public QObject {
Q_OBJECT Q_OBJECT
public: public:
ScopeVis(GLScopeInterface* glScope = nullptr); ScopeVis();
virtual ~ScopeVis(); virtual ~ScopeVis();
void setGLScope(GLScopeInterface* glScope);
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; } void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication