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

DSD demod: GUI scope simplification (6)

This commit is contained in:
f4exb 2018-03-13 01:39:43 +01:00
parent dc5f1397b6
commit c2544b528e
11 changed files with 216 additions and 53 deletions

View File

@ -169,6 +169,20 @@ void DSDDemodGUI::on_traceLength_valueChanged(int value)
m_scopeVisXY->setPixelsPerFrame(m_settings.m_traceLengthMutliplier*960); // 48000 / 50. Chunks of 50 ms.
}
void DSDDemodGUI::on_traceStroke_valueChanged(int value)
{
m_settings.m_traceStroke = value;
ui->traceStrokeText->setText(QString("%1").arg(m_settings.m_traceStroke));
m_scopeVisXY->setStroke(m_settings.m_traceStroke);
}
void DSDDemodGUI::on_traceDecay_valueChanged(int value)
{
m_settings.m_traceDecay = value;
ui->traceDecayText->setText(QString("%1").arg(m_settings.m_traceDecay));
m_scopeVisXY->setDecay(m_settings.m_traceDecay);
}
void DSDDemodGUI::on_slot1On_toggled(bool checked)
{
m_settings.m_slot1On = checked;
@ -419,10 +433,19 @@ void DSDDemodGUI::displaySettings()
}
ui->baudRate->setCurrentIndex(DSDDemodBaudRates::getRateIndex(m_settings.m_baudRate));
ui->traceLength->setValue(m_settings.m_traceLengthMutliplier);
ui->traceLengthText->setText(QString("%1").arg(m_settings.m_traceLengthMutliplier*50));
m_scopeVisXY->setPixelsPerFrame(m_settings.m_traceLengthMutliplier*960); // 48000 / 50. Chunks of 50 ms.
ui->traceStroke->setValue(m_settings.m_traceStroke);
ui->traceStrokeText->setText(QString("%1").arg(m_settings.m_traceStroke));
m_scopeVisXY->setStroke(m_settings.m_traceStroke);
ui->traceDecay->setValue(m_settings.m_traceDecay);
ui->traceDecayText->setText(QString("%1").arg(m_settings.m_traceDecay));
m_scopeVisXY->setDecay(m_settings.m_traceDecay);
blockApplySettings(false);
}

View File

@ -120,6 +120,8 @@ private slots:
void on_enableCosineFiltering_toggled(bool enable);
void on_syncOrConstellation_toggled(bool checked);
void on_traceLength_valueChanged(int value);
void on_traceStroke_valueChanged(int value);
void on_traceDecay_valueChanged(int value);
void on_slot1On_toggled(bool checked);
void on_slot2On_toggled(bool checked);
void on_tdmaStereoSplit_toggled(bool checked);

View File

@ -62,16 +62,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -566,16 +557,7 @@
<string>Digital</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -692,7 +674,7 @@
</property>
<property name="geometry">
<rect>
<x>200</x>
<x>230</x>
<y>10</y>
<width>23</width>
<height>22</height>
@ -769,8 +751,8 @@
<widget class="ButtonSwitch" name="enableCosineFiltering">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<x>200</x>
<y>10</y>
<width>23</width>
<height>22</height>
</rect>
@ -789,7 +771,7 @@
<widget class="QLabel" name="inCarrierPosText">
<property name="geometry">
<rect>
<x>110</x>
<x>80</x>
<y>40</y>
<width>25</width>
<height>28</height>
@ -814,7 +796,7 @@
<widget class="QLabel" name="inLevelText">
<property name="geometry">
<rect>
<x>150</x>
<x>110</x>
<y>40</y>
<width>25</width>
<height>28</height>
@ -865,7 +847,7 @@
<rect>
<x>50</x>
<y>107</y>
<width>115</width>
<width>151</width>
<height>16</height>
</rect>
</property>
@ -901,7 +883,7 @@
<widget class="QLabel" name="fmDeviationText">
<property name="geometry">
<rect>
<x>180</x>
<x>210</x>
<y>100</y>
<width>40</width>
<height>29</height>
@ -938,7 +920,7 @@
<rect>
<x>50</x>
<y>137</y>
<width>115</width>
<width>151</width>
<height>16</height>
</rect>
</property>
@ -970,8 +952,8 @@
<widget class="QToolButton" name="slot1On">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<x>170</x>
<y>40</y>
<width>23</width>
<height>22</height>
</rect>
@ -994,8 +976,8 @@
<widget class="QToolButton" name="slot2On">
<property name="geometry">
<rect>
<x>170</x>
<y>70</y>
<x>200</x>
<y>40</y>
<width>23</width>
<height>22</height>
</rect>
@ -1018,8 +1000,8 @@
<widget class="QToolButton" name="tdmaStereoSplit">
<property name="geometry">
<rect>
<x>200</x>
<y>70</y>
<x>230</x>
<y>40</y>
<width>23</width>
<height>22</height>
</rect>
@ -1058,7 +1040,7 @@
<string>Display trace length (ms)</string>
</property>
<property name="minimum">
<number>1</number>
<number>6</number>
</property>
<property name="maximum">
<number>30</number>
@ -1067,7 +1049,7 @@
<number>1</number>
</property>
<property name="value">
<number>5</number>
<number>6</number>
</property>
</widget>
<widget class="QLabel" name="traceLengthText">
@ -1092,7 +1074,7 @@
<widget class="QLabel" name="demodGainText">
<property name="geometry">
<rect>
<x>180</x>
<x>210</x>
<y>130</y>
<width>40</width>
<height>29</height>
@ -1111,6 +1093,106 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QDial" name="traceStroke">
<property name="geometry">
<rect>
<x>110</x>
<y>70</y>
<width>24</width>
<height>24</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Trace stroke [0..255]</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
<widget class="QLabel" name="traceStrokeText">
<property name="geometry">
<rect>
<x>130</x>
<y>73</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>Trace stroke value</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QDial" name="traceDecay">
<property name="geometry">
<rect>
<x>170</x>
<y>70</y>
<width>24</width>
<height>24</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Trace decay [0..255]</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>200</number>
</property>
</widget>
<widget class="QLabel" name="traceDecayText">
<property name="geometry">
<rect>
<x>190</x>
<y>73</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>Trace decay value</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
</item>
</layout>

View File

@ -53,7 +53,9 @@ void DSDDemodSettings::resetToDefaults()
m_rgbColor = QColor(0, 255, 255).rgb();
m_title = "DSD Demodulator";
m_highPassFilter = false;
m_traceLengthMutliplier = 5; // 250 ms
m_traceLengthMutliplier = 6; // 300 ms
m_traceStroke = 100;
m_traceDecay = 200;
}
QByteArray DSDDemodSettings::serialize() const
@ -87,6 +89,8 @@ QByteArray DSDDemodSettings::serialize() const
s.writeBool(19, m_highPassFilter);
s.writeBool(20, m_copyAudioUseRTP);
s.writeS32(21, m_traceLengthMutliplier);
s.writeS32(22, m_traceStroke);
s.writeS32(23, m_traceDecay);
return s.final();
}
@ -142,7 +146,11 @@ bool DSDDemodSettings::deserialize(const QByteArray& data)
d.readBool(19, &m_highPassFilter, false);
d.readBool(20, &m_copyAudioUseRTP, false);
d.readS32(21, &tmp, 5);
m_traceLengthMutliplier = tmp < 1 ? 1 : tmp > 30 ? 30 : tmp;
m_traceLengthMutliplier = tmp < 2 ? 2 : tmp > 30 ? 30 : tmp;
d.readS32(22, &tmp, 100);
m_traceStroke = tmp < 0 ? 0 : tmp > 255 ? 255 : tmp;
d.readS32(23, &tmp, 200);
m_traceDecay = tmp < 0 ? 0 : tmp > 255 ? 255 : tmp;
return true;
}

View File

@ -47,6 +47,8 @@ struct DSDDemodSettings
QString m_title;
bool m_highPassFilter;
int m_traceLengthMutliplier; // x 50ms
int m_traceStroke; // [0..255]
int m_traceDecay; // [0..255]
Serializable *m_channelMarker;
Serializable *m_scopeGUI;

View File

@ -26,14 +26,26 @@ ScopeVisXY::ScopeVisXY(TVScreen *tvScreen) :
m_rows(0),
m_pixelsPerFrame(480),
m_pixelCount(0),
m_alphaTrace(128),
m_alphaReset(128),
m_plotRGB(qRgb(0, 255, 0)),
m_gridRGB(qRgb(255, 255 ,255))
{
setObjectName("ScopeVisXY");
setPixelsPerFrame(m_pixelsPerFrame);
m_tvScreen->setAlphaBlend(true);
}
ScopeVisXY::~ScopeVisXY()
{}
{
}
void ScopeVisXY::setPixelsPerFrame(int pixelsPerFrame)
{
m_pixelsPerFrame = pixelsPerFrame;
m_pixelCount = 0;
m_tvScreen->setAlphaReset();
}
void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end,
bool positiveOnly __attribute__((unused)))
@ -52,20 +64,21 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe
col = col < 0 ? 0 : col >= m_cols ? m_cols-1 : col;
m_tvScreen->selectRow(row);
m_tvScreen->setDataColor(col, qRed(m_plotRGB), qGreen(m_plotRGB), qBlue(m_plotRGB), 128); // FIXME: alpha does not work
m_tvScreen->setDataColor(col, qRed(m_plotRGB), qGreen(m_plotRGB), qBlue(m_plotRGB), m_alphaTrace);
++begin;
m_pixelCount++;
if (m_pixelCount == m_pixelsPerFrame)
{
drawGraticule();
m_tvScreen->renderImage(0);
usleep(50000);
usleep(5000);
m_tvScreen->getSize(m_cols, m_rows);
m_tvScreen->resetImage();
m_tvScreen->resetImage(m_alphaReset);
m_pixelCount = 0;
}
++begin;
}
}

View File

@ -39,11 +39,10 @@ public:
virtual bool handleMessage(const Message& message);
void setScale(float scale) { m_scale = scale; }
void setPixelsPerFrame(int pixelsPerFrame) {
m_pixelsPerFrame = pixelsPerFrame;
m_pixelCount = 0;
}
void setStroke(int stroke) { m_alphaTrace = stroke; }
void setDecay(int decay) { m_alphaReset = 255 - decay; }
void setPixelsPerFrame(int pixelsPerFrame);
void setPlotRGB(const QRgb& plotRGB) { m_plotRGB = plotRGB; }
void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; }
@ -59,6 +58,8 @@ private:
int m_rows;
int m_pixelsPerFrame;
int m_pixelCount;
int m_alphaTrace; //!< this is the stroke value [0:255]
int m_alphaReset; //!< alpha channel of screen blanking (blackening) is 255 minus decay value [0:255]
QRgb m_plotRGB;
QRgb m_gridRGB;
std::vector<std::complex<float> > m_graticule;

View File

@ -36,6 +36,8 @@ const QString GLShaderTVArray::m_strFragmentShaderSourceColored = QString(
GLShaderTVArray::GLShaderTVArray(bool blnColor) : m_blnColor(blnColor)
{
m_blnAlphaBlend = false;
m_blnAlphaReset = false;
m_objProgram = 0;
m_objImage = 0;
m_objTexture = 0;
@ -209,9 +211,18 @@ void GLShaderTVArray::RenderPixels(unsigned char *chrData)
m_objProgram->setUniformValue(m_objMatrixLoc, objQMatrix);
m_objProgram->setUniformValue(m_objTextureLoc, 0);
ptrF->glClear(GL_COLOR_BUFFER_BIT);
ptrF->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ptrF->glEnable(GL_BLEND);
if (m_blnAlphaReset) {
ptrF->glClear(GL_COLOR_BUFFER_BIT);
m_blnAlphaReset = false;
}
if (m_blnAlphaBlend) {
ptrF->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ptrF->glEnable(GL_BLEND);
} else {
ptrF->glDisable(GL_BLEND);
}
m_objTexture->bind();
@ -244,6 +255,14 @@ void GLShaderTVArray::ResetPixels()
}
}
void GLShaderTVArray::ResetPixels(int alpha)
{
if (m_objImage != 0)
{
m_objImage->fill(qRgba(0, 0, 0, alpha));
}
}
void GLShaderTVArray::Cleanup()
{
m_blnInitialized = false;

View File

@ -43,6 +43,8 @@ public:
~GLShaderTVArray();
void setColor(bool blnColor) { m_blnColor = blnColor; }
void setAlphaBlend(bool blnAlphaBlend) { m_blnAlphaBlend = blnAlphaBlend; }
void setAlphaReset() { m_blnAlphaReset = true; }
void InitializeGL(int intCols, int intRows);
void ResizeContainer(int intCols, int intRows);
void getSize(int& intCols, int& intRows) const { intCols = m_intCols, intRows = m_intRows; }
@ -50,6 +52,7 @@ public:
QRgb *GetRowBuffer(int intRow);
void RenderPixels(unsigned char *chrData);
void ResetPixels();
void ResetPixels(int alpha);
bool SelectRow(int intLine);
bool SetDataColor(int intCol,QRgb objColor);
@ -74,6 +77,8 @@ protected:
bool m_blnInitialized;
bool m_blnColor;
bool m_blnAlphaBlend;
bool m_blnAlphaReset;
};
#endif /* INCLUDE_GUI_GLTVSHADERARRAY_H_ */

View File

@ -81,6 +81,11 @@ void TVScreen::resetImage()
m_objGLShaderArray.ResetPixels();
}
void TVScreen::resetImage(int alpha)
{
m_objGLShaderArray.ResetPixels(alpha);
}
void TVScreen::resizeTVScreen(int intCols, int intRows)
{
m_intAskedCols = intCols;

View File

@ -42,7 +42,7 @@ class TVScreen: public QGLWidget
public:
TVScreen(bool blnColor, QWidget* parent = 0);
~TVScreen();
virtual ~TVScreen();
void setColor(bool blnColor);
void resizeTVScreen(int intCols, int intRows);
@ -50,11 +50,14 @@ public:
void renderImage(unsigned char * objData);
QRgb* getRowBuffer(int intRow);
void resetImage();
void resetImage(int alpha);
bool selectRow(int intLine);
bool setDataColor(int intCol, int intRed, int intGreen, int intBlue);
bool setDataColor(int intCol, int intRed, int intGreen, int intBlue, int intAlpha);
void setRenderImmediate(bool blnRenderImmediate) { m_blnRenderImmediate = blnRenderImmediate; }
void setAlphaBlend(bool blnAlphaBlend) { m_objGLShaderArray.setAlphaBlend(blnAlphaBlend); }
void setAlphaReset() { m_objGLShaderArray.setAlphaReset(); }
void connectTimer(const QTimer& timer);