1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

GLScope redesign: removed SpectrumScopeComboVis

This commit is contained in:
f4exb 2021-06-05 19:26:26 +02:00
parent eb811c1e56
commit ccb7633154
17 changed files with 36 additions and 116 deletions

View File

@ -62,7 +62,7 @@ public:
virtual void destroy() { delete this; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
ScopeVis *getScopeVis() { return &m_scopeVis; }
void setSampleSink(BasebandSampleSink *sink) { m_basebandSink->setSampleSink(sink); }
void setScopeVis(ScopeVis *scopeVis) { m_basebandSink->setScopeVis(scopeVis); }
int getChannelSampleRate() const { return m_basebandSink->getChannelSampleRate(); }
int getDecimation() const { return 1<<m_settings.m_log2Decim; }

View File

@ -67,7 +67,7 @@ public:
int getChannelSampleRate() const;
double getMagSq() { return m_sink.getMagSq(); }
double getMagSqAvg() const { return (double) m_sink.getMagSqAvg(); }
void setSampleSink(BasebandSampleSink* sampleSink) { m_sink.setSampleSink(sampleSink); }
void setScopeVis(ScopeVis *scopeVis) { m_sink.setScopeVis(scopeVis); }
bool isPllLocked() const { return m_sink.isPllLocked(); }
Real getPllFrequency() const { return m_sink.getPllFrequency(); }
Real getPllDeltaPhase() const { return m_sink.getPllDeltaPhase(); }

View File

@ -19,7 +19,6 @@
#include <QMainWindow>
#include "device/deviceuiset.h"
#include "dsp/spectrumscopecombovis.h"
#include "dsp/spectrumvis.h"
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
@ -475,9 +474,9 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_scopeVis = m_channelAnalyzer->getScopeVis();
m_scopeVis->setGLScope(ui->glScope);
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
m_basebandSampleRate = m_channelAnalyzer->getChannelSampleRate();
m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis);
m_scopeVis->setSpectrumVis(m_spectrumVis);
m_channelAnalyzer->setScopeVis(m_scopeVis);
m_channelAnalyzer->setMessageQueueToGUI(getInputMessageQueue());
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
@ -529,7 +528,6 @@ ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
qDebug("ChannelAnalyzerGUI::~ChannelAnalyzerGUI");
ui->glScope->disconnectTimer();
delete ui;
delete m_spectrumScopeComboVis;
qDebug("ChannelAnalyzerGUI::~ChannelAnalyzerGUI: done");
}

View File

@ -30,7 +30,6 @@ class PluginAPI;
class DeviceUISet;
class BasebandSampleSink;
class ChannelAnalyzer;
class SpectrumScopeComboVis;
class SpectrumVis;
class ScopeVis;
@ -65,7 +64,6 @@ private:
MovingAverageUtil<double, double, 40> m_channelPowerAvg;
ChannelAnalyzer* m_channelAnalyzer;
SpectrumScopeComboVis* m_spectrumScopeComboVis;
SpectrumVis* m_spectrumVis;
ScopeVis* m_scopeVis;
MessageQueue m_inputMessageQueue;

View File

@ -21,7 +21,7 @@
#include <QDebug>
#include <stdio.h>
#include "dsp/basebandsamplesink.h"
#include "dsp/scopevis.h"
const unsigned int ChannelAnalyzerSink::m_ssbFftLen = 1024;
const unsigned int ChannelAnalyzerSink::m_corrFFTLen = 4*m_ssbFftLen;
@ -31,7 +31,7 @@ ChannelAnalyzerSink::ChannelAnalyzerSink() :
m_channelFrequencyOffset(0),
m_sinkSampleRate(48000),
m_costasLoop(0.002, 2),
m_sampleSink(nullptr)
m_scopeVis(nullptr)
{
m_usb = true;
m_magsq = 0;
@ -90,9 +90,12 @@ void ChannelAnalyzerSink::feed(const SampleVector::const_iterator& begin, const
}
}
if (m_sampleSink) {
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), m_settings.m_ssb); // m_ssb = positive only
}
if (m_scopeVis)
{
std::vector<SampleVector::const_iterator> vbegin;
vbegin.push_back(m_sampleBuffer.begin());
m_scopeVis->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin());
}
m_sampleBuffer.clear();
}

View File

@ -33,7 +33,7 @@
#include "chanalyzersettings.h"
class BasebandSampleSink;
class ScopeVis;
class ChannelAnalyzerSink : public ChannelSampleSink {
public:
@ -51,7 +51,7 @@ public:
Real getPllFrequency() const;
Real getPllDeltaPhase() const;
Real getPllPhase() const;
void setSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; }
void setScopeVis(ScopeVis* scopeVis) { m_scopeVis = scopeVis; }
static const unsigned int m_corrFFTLen;
static const unsigned int m_ssbFftLen;
@ -82,7 +82,7 @@ private:
SampleVector m_sampleBuffer;
MovingAverageUtil<double, double, 480> m_channelPowerAvg;
BasebandSampleSink* m_sampleSink;
ScopeVis* m_scopeVis;
void setFilters(int sampleRate, float bandwidth, float lowCutoff);
void processOneSample(Complex& c, fftfilt::cmplx *sideband);

View File

@ -54,6 +54,7 @@ DemodAnalyzer::DemodAnalyzer(WebAPIAdapterInterface *webAPIAdapterInterface) :
qDebug("DemodAnalyzer::DemodAnalyzer: webAPIAdapterInterface: %p", webAPIAdapterInterface);
setObjectName(m_featureId);
m_worker = new DemodAnalyzerWorker();
m_worker->setScopeVis(&m_scopeVis);
m_state = StIdle;
m_errorMessage = "DemodAnalyzer error";
m_networkManager = new QNetworkAccessManager();
@ -108,11 +109,6 @@ void DemodAnalyzer::stop()
m_thread.wait();
}
void DemodAnalyzer::setSampleSink(BasebandSampleSink *sink)
{
m_worker->setSampleSink(sink);
}
double DemodAnalyzer::getMagSqAvg() const
{
return m_worker->getMagSqAvg();

View File

@ -158,7 +158,6 @@ public:
virtual void destroy() { delete this; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
ScopeVis *getScopeVis() { return &m_scopeVis; }
void setSampleSink(BasebandSampleSink *sink);
double getMagSqAvg() const;
virtual bool handleMessage(const Message& cmd);

View File

@ -18,7 +18,6 @@
#include <QMessageBox>
#include "feature/featureuiset.h"
#include "dsp/spectrumscopecombovis.h"
#include "dsp/spectrumvis.h"
#include "gui/basicfeaturesettingsdialog.h"
#include "gui/glspectrum.h"
@ -146,8 +145,7 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
m_scopeVis->setGLScope(ui->glScope);
m_spectrumVis = m_demodAnalyzer->getSpectrumVis();
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
m_demodAnalyzer->setSampleSink(m_spectrumScopeComboVis);
m_scopeVis->setSpectrumVis(m_spectrumVis);
m_featureUISet->addRollupWidget(this);
@ -180,7 +178,6 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
DemodAnalyzerGUI::~DemodAnalyzerGUI()
{
delete ui;
delete m_spectrumScopeComboVis;
}
void DemodAnalyzerGUI::blockApplySettings(bool block)

View File

@ -30,7 +30,6 @@ class PluginAPI;
class FeatureUISet;
class DemodAnalyzer;
class Feature;
class SpectrumScopeComboVis;
class SpectrumVis;
class ScopeVis;
@ -58,7 +57,6 @@ private:
bool m_doApplySettings;
DemodAnalyzer* m_demodAnalyzer;
SpectrumScopeComboVis* m_spectrumScopeComboVis;
SpectrumVis* m_spectrumVis;
ScopeVis* m_scopeVis;
MessageQueue m_inputMessageQueue;

View File

@ -17,7 +17,7 @@
#include <QDebug>
#include "dsp/basebandsamplesink.h"
#include "dsp/scopevis.h"
#include "dsp/datafifo.h"
#include "demodanalyzerworker.h"
@ -95,8 +95,11 @@ void DemodAnalyzerWorker::feedPart(const QByteArray::const_iterator& begin, cons
}
}
if (m_sampleSink) {
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.begin() + countSamples/(1<<m_settings.m_log2Decim), false);
if (m_scopeVis)
{
std::vector<SampleVector::const_iterator> vbegin;
vbegin.push_back(m_sampleBuffer.begin());
m_scopeVis->feed(vbegin, countSamples/(1<<m_settings.m_log2Decim));
}
}

View File

@ -33,6 +33,7 @@
#include "demodanalyzersettings.h"
class BasebandSampleSink;
class ScopeVis;
class ChannelAPI;
class Feature;
class DataFifo;
@ -99,7 +100,7 @@ public:
double getMagSq() const { return m_magsq; }
double getMagSqAvg() const { return (double) m_channelPowerAvg; }
void setSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; }
void setScopeVis(ScopeVis* scopeVis) { m_scopeVis = scopeVis; }
static const unsigned int m_corrFFTLen;
static const unsigned int m_ssbFftLen;
@ -117,7 +118,7 @@ private:
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimators;
int m_sampleBufferSize;
MovingAverageUtil<double, double, 480> m_channelPowerAvg;
BasebandSampleSink* m_sampleSink;
ScopeVis* m_scopeVis;
bool m_running;
QMutex m_mutex;

View File

@ -21,6 +21,7 @@
#include <QMutexLocker>
#include "scopevis.h"
#include "spectrumvis.h"
#include "dsp/dspcommands.h"
#include "dsp/glscopeinterface.h"
@ -41,6 +42,7 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
ScopeVis::ScopeVis() :
m_glScope(nullptr),
m_spectrumVis(nullptr),
m_messageQueueToGUI(nullptr),
m_preTriggerDelay(0),
m_livePreTriggerDelay(0),
@ -524,6 +526,10 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, int ilen
uint32_t length = m_traceSize / m_timeBase;
int remainder = ilength;
if (m_spectrumVis) {
m_spectrumVis->feed(cbegin, cbegin + ilength, false);
}
while ((remainder > 0) && (m_nbSamples > 0))
{
std::vector<TraceControl*>::iterator itCtl = m_traces.m_tracesControl.begin();

View File

@ -40,6 +40,7 @@
class GLScopeInterface;
class SpectrumVis;
class SDRBASE_API ScopeVis : public QObject {
Q_OBJECT
@ -48,6 +49,7 @@ public:
virtual ~ScopeVis();
void setGLScope(GLScopeInterface* glScope);
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
@ -1040,6 +1042,7 @@ private:
};
GLScopeInterface* m_glScope;
SpectrumVis *m_spectrumVis;
MessageQueue m_inputMessageQueue;
MessageQueue *m_messageQueueToGUI;
uint32_t m_preTriggerDelay; //!< Pre-trigger delay in number of samples

View File

@ -69,7 +69,6 @@ set(sdrgui_SOURCES
gui/wrappingdatetimeedit.cpp
dsp/scopevisxy.cpp
dsp/spectrumscopecombovis.cpp
device/deviceuiset.cpp
@ -157,7 +156,6 @@ set(sdrgui_HEADERS
gui/wrappingdatetimeedit.h
dsp/scopevisxy.h
dsp/spectrumscopecombovis.h
device/deviceuiset.h

View File

@ -1,52 +0,0 @@
#include "dsp/spectrumscopecombovis.h"
#include "dsp/dspcommands.h"
#include "dsp/scopevis.h"
#include "util/messagequeue.h"
SpectrumScopeComboVis::SpectrumScopeComboVis(SpectrumVis* spectrumVis, ScopeVis* scopeVis) :
m_spectrumVis(spectrumVis),
m_scopeVis(scopeVis)
{
setObjectName("SpectrumScopeComboVis");
}
SpectrumScopeComboVis::~SpectrumScopeComboVis()
{
}
void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
{
(void) positiveOnly;
std::vector<SampleVector::const_iterator> vbegin;
vbegin.push_back(begin);
m_scopeVis->feed(vbegin, end - begin);
//SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint();
//m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly);
int triggerPointLocation = m_scopeVis->getTriggerLocation();
if (m_scopeVis->getFreeRun()) {
m_spectrumVis->feed(begin, end, positiveOnly);
} else if ((triggerPointLocation >= 0) && (triggerPointLocation <= end - begin)) {
m_spectrumVis->feedTriggered(end - triggerPointLocation, end, positiveOnly);
} else {
m_spectrumVis->feedTriggered(begin, end, positiveOnly);
}
}
void SpectrumScopeComboVis::start()
{
m_spectrumVis->start();
}
void SpectrumScopeComboVis::stop()
{
m_spectrumVis->stop();
}
bool SpectrumScopeComboVis::handleMessage(const Message& message)
{
bool spectDone = m_spectrumVis->handleMessage(message);
bool scopeDone = m_scopeVis->handleMessage(message);
return (spectDone || scopeDone);
}

View File

@ -1,28 +0,0 @@
#ifndef INCLUDE_SPECTRUMSCOPENGCOMBOVIS_H
#define INCLUDE_SPECTRUMSCOPENGCOMBOVIS_H
#include <dsp/basebandsamplesink.h>
#include "dsp/spectrumvis.h"
#include "export.h"
class Message;
class ScopeVis;
class SDRGUI_API SpectrumScopeComboVis : public BasebandSampleSink {
public:
SpectrumScopeComboVis(SpectrumVis* spectrumVis, ScopeVis* scopeVis);
virtual ~SpectrumScopeComboVis();
using BasebandSampleSink::feed;
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
virtual void start();
virtual void stop();
virtual bool handleMessage(const Message& message);
private:
SpectrumVis* m_spectrumVis;
ScopeVis* m_scopeVis;
};
#endif // INCLUDE_SPECTRUMSCOPENGCOMBOVIS_H