1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

GLScope redesign: moved ScopeVis to sdrbase

This commit is contained in:
f4exb 2021-05-29 12:22:43 +02:00
parent 70550f453f
commit aa868b9176
12 changed files with 73 additions and 57 deletions

View File

@ -438,7 +438,7 @@ AISDemodGUI::AISDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayXYV);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
triggerData.m_triggerLevel = 0.1;
triggerData.m_triggerLevelCoarse = 10;
triggerData.m_triggerPositiveEdge = true;

View File

@ -259,7 +259,7 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base
traceData.m_ofsCoarse = 50; // this is 50 coarse steps
ui->scopeGUI->changeTrace(0, traceData);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
triggerData.m_triggerLevel = 0.1;
triggerData.m_triggerLevelCoarse = 10;
triggerData.m_triggerPositiveEdge = false;

View File

@ -383,7 +383,7 @@ IEEE_802_15_4_ModGUI::IEEE_802_15_4_ModGUI(PluginAPI* pluginAPI, DeviceUISet *de
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayPol);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
triggerData.m_triggerLevel = 0.1;
triggerData.m_triggerLevelCoarse = 10;
triggerData.m_triggerPositiveEdge = true;

View File

@ -513,7 +513,7 @@ AISModGUI::AISModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
ui->scopeGUI->setDisplayMode(GLScopeGUI::DisplayPol);
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
triggerData.m_triggerLevel = 0.1;
triggerData.m_triggerLevelCoarse = 10;
triggerData.m_triggerPositiveEdge = true;

View File

@ -139,6 +139,7 @@ set(sdrbase_SOURCES
dsp/samplesinkfifo.cpp
dsp/samplesimplefifo.cpp
dsp/samplesourcefifo.cpp
dsp/scopevis.cpp
dsp/basebandsamplesink.cpp
dsp/basebandsamplesource.cpp
dsp/nullsink.cpp
@ -333,6 +334,7 @@ set(sdrbase_HEADERS
dsp/samplesinkfifo.h
dsp/samplesimplefifo.h
dsp/samplesourcefifo.h
dsp/scopevis.h
dsp/basebandsamplesink.h
dsp/basebandsamplesource.h
dsp/nullsink.h

View File

@ -29,6 +29,16 @@ public:
virtual ~GLScopeInterface() {}
virtual void setTraces(std::vector<GLScopeSettings::TraceData>* tracesData, std::vector<float *>* traces) = 0;
virtual void newTraces(std::vector<float *>* traces, int traceIndex, std::vector<Projector::ProjectionType>* projectionTypes) = 0;
virtual void setSampleRate(int sampleRate) = 0;
virtual void setTraceSize(int trceSize, bool emitSignal = false) = 0;
virtual void setTriggerPre(uint32_t triggerPre, bool emitSignal = false) = 0;
virtual const QAtomicInt& getProcessingTraceIndex() const = 0;
virtual void setTimeBase(int timeBase) = 0;
virtual void setTimeOfsProMill(int timeOfsProMill) = 0;
virtual void setFocusedTriggerData(GLScopeSettings::TriggerData& triggerData) = 0;
virtual void setFocusedTraceIndex(uint32_t traceIndex) = 0;
virtual void setConfigChanged() = 0;
virtual void updateDisplay() = 0;
};
#endif // SDRBASE_DSP_GLSCOPEINTERFACE_H_

View File

@ -22,7 +22,7 @@
#include "scopevis.h"
#include "dsp/dspcommands.h"
#include "gui/glscope.h"
#include "dsp/glscopeinterface.h"
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVisNG, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGAddTrigger, Message)
@ -41,7 +41,7 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
const uint ScopeVis::m_traceChunkDefaultSize = 4800;
ScopeVis::ScopeVis(GLScope* glScope) :
ScopeVis::ScopeVis(GLScopeInterface* glScope) :
m_glScope(glScope),
m_preTriggerDelay(0),
m_livePreTriggerDelay(0),
@ -171,13 +171,13 @@ void ScopeVis::focusOnTrace(uint32_t traceIndex)
getInputMessageQueue()->push(cmd);
}
void ScopeVis::addTrigger(const TriggerData& triggerData)
void ScopeVis::addTrigger(const GLScopeSettings::TriggerData& triggerData)
{
Message* cmd = MsgScopeVisNGAddTrigger::create(triggerData);
getInputMessageQueue()->push(cmd);
}
void ScopeVis::changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex)
void ScopeVis::changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
Message* cmd = MsgScopeVisNGChangeTrigger::create(triggerData, triggerIndex);
getInputMessageQueue()->push(cmd);
@ -1034,10 +1034,13 @@ void ScopeVis::computeDisplayTriggerLevels()
void ScopeVis::updateGLScopeDisplay()
{
if (m_currentTraceMemoryIndex > 0) {
if (m_currentTraceMemoryIndex > 0)
{
m_glScope->setConfigChanged();
processMemoryTrace();
} else {
}
else
{
m_glScope->updateDisplay();
}
}

View File

@ -38,7 +38,7 @@
#include "util/doublebuffer.h"
class GLScope;
class GLScopeInterface;
class SDRGUI_API ScopeVis : public BasebandSampleSink {
@ -100,7 +100,7 @@ public:
static const uint32_t m_maxNbTraces = 10;
static const uint32_t m_nbTraceMemories = 50;
ScopeVis(GLScope* glScope = 0);
ScopeVis(GLScopeInterface* glScope = nullptr);
virtual ~ScopeVis();
void setLiveRate(int sampleRate);
@ -110,8 +110,8 @@ public:
void removeTrace(uint32_t traceIndex);
void moveTrace(uint32_t traceIndex, bool upElseDown);
void focusOnTrace(uint32_t traceIndex);
void addTrigger(const TriggerData& triggerData);
void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex);
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
void focusOnTrigger(uint32_t triggerIndex);
@ -169,7 +169,7 @@ public:
}
}
void getTriggerData(TriggerData& triggerData, uint32_t triggerIndex)
void getTriggerData(GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
if (triggerIndex < m_triggerConditions.size()) {
triggerData = m_triggerConditions[triggerIndex]->m_triggerData;
@ -183,7 +183,7 @@ public:
}
}
const TriggerData& getTriggerData(uint32_t triggerIndex) const { return m_triggerConditions[triggerIndex]->m_triggerData; }
const GLScopeSettings::TriggerData& getTriggerData(uint32_t triggerIndex) const { return m_triggerConditions[triggerIndex]->m_triggerData; }
const std::vector<GLScopeSettings::TraceData>& getTracesData() const { return m_traces.m_tracesData; }
uint32_t getNbTriggers() const { return m_triggerConditions.size(); }
@ -244,17 +244,17 @@ private:
public:
static MsgScopeVisNGAddTrigger* create(
const TriggerData& triggerData)
const GLScopeSettings::TriggerData& triggerData)
{
return new MsgScopeVisNGAddTrigger(triggerData);
}
const TriggerData& getTriggerData() const { return m_triggerData; }
const GLScopeSettings::TriggerData& getTriggerData() const { return m_triggerData; }
private:
TriggerData m_triggerData;
GLScopeSettings::TriggerData m_triggerData;
MsgScopeVisNGAddTrigger(const TriggerData& triggerData) :
MsgScopeVisNGAddTrigger(const GLScopeSettings::TriggerData& triggerData) :
m_triggerData(triggerData)
{}
};
@ -265,19 +265,19 @@ private:
public:
static MsgScopeVisNGChangeTrigger* create(
const TriggerData& triggerData, uint32_t triggerIndex)
const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
return new MsgScopeVisNGChangeTrigger(triggerData, triggerIndex);
}
const TriggerData& getTriggerData() const { return m_triggerData; }
const GLScopeSettings::TriggerData& getTriggerData() const { return m_triggerData; }
uint32_t getTriggerIndex() const { return m_triggerIndex; }
private:
TriggerData m_triggerData;
GLScopeSettings::TriggerData m_triggerData;
uint32_t m_triggerIndex;
MsgScopeVisNGChangeTrigger(const TriggerData& triggerData, uint32_t triggerIndex) :
MsgScopeVisNGChangeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex) :
m_triggerData(triggerData),
m_triggerIndex(triggerIndex)
{}
@ -520,7 +520,7 @@ private:
{
public:
Projector m_projector;
TriggerData m_triggerData; //!< Trigger data
GLScopeSettings::TriggerData m_triggerData; //!< Trigger data
bool m_prevCondition; //!< Condition (above threshold) at previous sample
uint32_t m_triggerDelayCount; //!< Counter of samples for delay
uint32_t m_triggerCounter; //!< Counter of trigger occurrences
@ -528,7 +528,7 @@ private:
uint32_t m_falses; //!< Count of false conditions for holdoff processing
TriggerCondition(const TriggerData& triggerData) :
TriggerCondition(const GLScopeSettings::TriggerData& triggerData) :
m_projector(Projector::ProjectionReal),
m_triggerData(triggerData),
m_prevCondition(false),
@ -552,7 +552,7 @@ private:
{
}
void setData(const TriggerData& triggerData)
void setData(const GLScopeSettings::TriggerData& triggerData)
{
m_triggerData = triggerData;
@ -1078,7 +1078,7 @@ private:
bool m_reset;
};
GLScope* m_glScope;
GLScopeInterface* m_glScope;
uint32_t m_preTriggerDelay; //!< Pre-trigger delay in number of samples
uint32_t m_livePreTriggerDelay; //!< Pre-trigger delay in number of samples in live mode
std::vector<TriggerCondition*> m_triggerConditions; //!< Chain of triggers

View File

@ -68,7 +68,6 @@ set(sdrgui_SOURCES
gui/wsspectrumsettingsdialog.cpp
gui/wrappingdatetimeedit.cpp
dsp/scopevis.cpp
dsp/scopevisxy.cpp
dsp/spectrumscopecombovis.cpp
@ -157,7 +156,6 @@ set(sdrgui_HEADERS
gui/wsspectrumsettingsdialog.h
gui/wrappingdatetimeedit.h
dsp/scopevis.h
dsp/scopevisxy.h
dsp/spectrumscopecombovis.h

View File

@ -65,25 +65,25 @@ public:
int getSampleRate() const { return m_sampleRate; }
int getTraceSize() const { return m_traceSize; }
void setTriggerPre(uint32_t triggerPre, bool emitSignal = false); //!< number of samples
void setTimeOfsProMill(int timeOfsProMill);
void setSampleRate(int sampleRate);
void setTimeBase(int timeBase);
void setFocusedTraceIndex(uint32_t traceIndex);
virtual void setTriggerPre(uint32_t triggerPre, bool emitSignal = false); //!< number of samples
virtual void setTimeOfsProMill(int timeOfsProMill);
virtual void setSampleRate(int sampleRate);
virtual void setTimeBase(int timeBase);
virtual void setFocusedTraceIndex(uint32_t traceIndex);
void setDisplayMode(DisplayMode displayMode);
void setTraceSize(int trceSize, bool emitSignal = false);
void updateDisplay();
virtual void setTraceSize(int trceSize, bool emitSignal = false);
virtual void updateDisplay();
void setDisplayGridIntensity(int intensity);
void setDisplayTraceIntensity(int intensity);
void setFocusedTriggerData(ScopeVis::TriggerData& triggerData) { m_focusedTriggerData = triggerData; }
void setConfigChanged() { m_configChanged = true; }
virtual void setFocusedTriggerData(GLScopeSettings::TriggerData& triggerData) { m_focusedTriggerData = triggerData; }
virtual void setConfigChanged() { m_configChanged = true; }
//void incrementTraceCounter() { m_traceCounter++; }
bool getDataChanged() const { return m_dataChanged; }
DisplayMode getDisplayMode() const { return m_displayMode; }
void setDisplayXYPoints(bool value) { m_displayXYPoints = value; }
void setDisplayXYPolarGrid(bool value) { m_displayPolGrid = value; }
const QAtomicInt& getProcessingTraceIndex() const { return m_processingTraceIndex; }
virtual const QAtomicInt& getProcessingTraceIndex() const { return m_processingTraceIndex; }
void setTraceModulo(int modulo) { m_traceModulo = modulo; }
signals:
@ -142,7 +142,7 @@ private:
std::vector<float *> *m_traces;
std::vector<Projector::ProjectionType> *m_projectionTypes;
QAtomicInt m_processingTraceIndex;
ScopeVis::TriggerData m_focusedTriggerData;
GLScopeSettings::TriggerData m_focusedTriggerData;
//int m_traceCounter;
uint32_t m_bufferIndex;
DisplayMode m_displayMode;

View File

@ -94,7 +94,7 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc
ui->freerun->setChecked(true);
// Add a trigger
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
fillTriggerData(triggerData);
m_scopeVis->addTrigger(triggerData);
@ -210,7 +210,7 @@ QByteArray GLScopeGUI::serialize() const
for (unsigned int i = 0; i < m_scopeVis->getNbTriggers(); i++)
{
const ScopeVis::TriggerData& triggerData = m_scopeVis->getTriggerData(i);
const GLScopeSettings::TriggerData& triggerData = m_scopeVis->getTriggerData(i);
s.writeS32(210 + 16*i, (int) triggerData.m_projectionType);
s.writeS32(211 + 16*i, triggerData.m_triggerRepeat);
s.writeBool(212 + 16*i, triggerData.m_triggerPositiveEdge);
@ -223,6 +223,7 @@ QByteArray GLScopeGUI::serialize() const
s.writeFloat(219 + 16*i, triggerData.m_triggerColorG);
s.writeFloat(220 + 16*i, triggerData.m_triggerColorB);
s.writeU32(221 + 16*i, triggerData.m_triggerHoldoff);
s.writeU32(222 + 16*i, triggerData.m_streamIndex);
}
return s.final();
@ -383,7 +384,7 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
for (iTrigger = 0; iTrigger < nbTriggersSaved; iTrigger++)
{
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
float r, g, b;
d.readS32(210 + 16*iTrigger, &intValue, 0);
@ -409,6 +410,8 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
d.readU32(221 + 16*iTrigger, &uintValue, 1);
ui->trigHoldoff->setValue(uintValue);
ui->trigHoldoffText->setText(tr("%1").arg(uintValue));
d.readU32(222 + 16*iTrigger, &uintValue, 0);
ui->traceStream->setCurrentIndex(uintValue);
fillTriggerData(triggerData);
@ -688,7 +691,7 @@ void GLScopeGUI::on_trig_valueChanged(int value)
{
ui->trigText->setText(tr("%1").arg(value));
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, value);
qDebug() << "GLScopeGUI::on_trig_valueChanged:"
@ -706,7 +709,7 @@ void GLScopeGUI::on_trig_valueChanged(int value)
void GLScopeGUI::on_trigAdd_clicked(bool checked)
{
(void) checked;
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
fillTriggerData(triggerData);
addTrigger(triggerData);
}
@ -729,7 +732,7 @@ void GLScopeGUI::on_trigUp_clicked(bool checked)
int newTriggerIndex = (ui->trig->value() + 1) % (ui->trig->maximum()+1);
m_scopeVis->moveTrigger(ui->trace->value(), true);
ui->trig->setValue(newTriggerIndex); // follow trigger
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, ui->trig->value());
setTriggerUI(triggerData);
m_scopeVis->focusOnTrigger(ui->trig->value());
@ -744,7 +747,7 @@ void GLScopeGUI::on_trigDown_clicked(bool checked)
int newTriggerIndex = (ui->trig->value() - 1) % (ui->trig->maximum()+1);
m_scopeVis->moveTrigger(ui->trace->value(), false);
ui->trig->setValue(newTriggerIndex); // follow trigger
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, ui->trig->value());
setTriggerUI(triggerData);
m_scopeVis->focusOnTrigger(ui->trig->value());
@ -1301,7 +1304,7 @@ void GLScopeGUI::changeCurrentTrace()
void GLScopeGUI::changeCurrentTrigger()
{
ScopeVis::TriggerData triggerData;
GLScopeSettings::TriggerData triggerData;
fillTriggerData(triggerData);
uint32_t currentTriggerIndex = ui->trig->value();
m_scopeVis->changeTrigger(triggerData, currentTriggerIndex);
@ -1372,7 +1375,7 @@ void GLScopeGUI::fillTraceData(GLScopeSettings::TraceData& traceData)
traceData.m_viewTrace = ui->traceView->isChecked();
}
void GLScopeGUI::fillTriggerData(ScopeVis::TriggerData& triggerData)
void GLScopeGUI::fillTriggerData(GLScopeSettings::TriggerData& triggerData)
{
triggerData.m_projectionType = (Projector::ProjectionType) ui->trigMode->currentIndex();
triggerData.m_inputIndex = 0;
@ -1415,7 +1418,7 @@ void GLScopeGUI::setTraceUI(const GLScopeSettings::TraceData& traceData)
ui->traceView->setChecked(traceData.m_viewTrace);
}
void GLScopeGUI::setTriggerUI(const ScopeVis::TriggerData& triggerData)
void GLScopeGUI::setTriggerUI(const GLScopeSettings::TriggerData& triggerData)
{
TrigUIBlocker trigUIBlocker(ui);
@ -1685,12 +1688,12 @@ void GLScopeGUI::focusOnTrace(int traceIndex)
on_trace_valueChanged(traceIndex);
}
void GLScopeGUI::changeTrigger(int triggerIndex, const ScopeVis::TriggerData& triggerData)
void GLScopeGUI::changeTrigger(int triggerIndex, const GLScopeSettings::TriggerData& triggerData)
{
m_scopeVis->changeTrigger(triggerData, triggerIndex);
}
void GLScopeGUI::addTrigger(const ScopeVis::TriggerData& triggerData)
void GLScopeGUI::addTrigger(const GLScopeSettings::TriggerData& triggerData)
{
if (ui->trig->maximum() < 9)
{

View File

@ -73,8 +73,8 @@ public:
void addTrace(const GLScopeSettings::TraceData& traceData);
void focusOnTrace(int traceIndex);
// trigger (third line):
void changeTrigger(int triggerIndex, const ScopeVis::TriggerData& triggerData);
void addTrigger(const ScopeVis::TriggerData& triggerData);
void changeTrigger(int triggerIndex, const GLScopeSettings::TriggerData& triggerData);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void focusOnTrigger(int triggerIndex);
void traceLengthChange();
@ -178,8 +178,8 @@ private:
void changeCurrentTrigger();
void fillTraceData(GLScopeSettings::TraceData& traceData);
void fillTriggerData(ScopeVis::TriggerData& triggerData);
void setTriggerUI(const ScopeVis::TriggerData& triggerData);
void fillTriggerData(GLScopeSettings::TriggerData& triggerData);
void setTriggerUI(const GLScopeSettings::TriggerData& triggerData);
void setTraceUI(const GLScopeSettings::TraceData& traceData);
void fillProjectionCombo(QComboBox* comboBox);