1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

DSD demod: GUI scope simplification (5)

This commit is contained in:
f4exb 2018-03-12 20:39:16 +01:00
parent e317a0bbea
commit dc5f1397b6
12 changed files with 144 additions and 41 deletions

View File

@ -206,7 +206,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_settings.m_syncOrConstellation)
{
Sample s(sample, m_dsdDecoder.getSymbolSyncSample() * m_scaleFromShort);
Sample s(sample, m_dsdDecoder.getSymbolSyncSample() * m_scaleFromShort * 0.84);
m_scopeSampleBuffer.push_back(s);
}
else

View File

@ -162,6 +162,13 @@ void DSDDemodGUI::on_syncOrConstellation_toggled(bool checked)
applySettings();
}
void DSDDemodGUI::on_traceLength_valueChanged(int value)
{
m_settings.m_traceLengthMutliplier = value;
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.
}
void DSDDemodGUI::on_slot1On_toggled(bool checked)
{
m_settings.m_slot1On = checked;
@ -412,6 +419,9 @@ 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.
blockApplySettings(false);
}

View File

@ -119,6 +119,7 @@ private slots:
void on_baudRate_currentIndexChanged(int index);
void on_enableCosineFiltering_toggled(bool enable);
void on_syncOrConstellation_toggled(bool checked);
void on_traceLength_valueChanged(int value);
void on_slot1On_toggled(bool checked);
void on_slot2On_toggled(bool checked);
void on_tdmaStereoSplit_toggled(bool checked);

View File

@ -62,7 +62,16 @@
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -158,15 +167,15 @@
</widget>
</item>
<item>
<widget class="QLabel" name="demodGainText">
<widget class="QLabel" name="rfBWText">
<property name="minimumSize">
<size>
<width>35</width>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0.00</string>
<string>00.0k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -554,10 +563,19 @@
</size>
</property>
<property name="windowTitle">
<string>Discriminator Scope</string>
<string>Digital</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -846,7 +864,7 @@
<property name="geometry">
<rect>
<x>50</x>
<y>105</y>
<y>107</y>
<width>115</width>
<height>16</height>
</rect>
@ -919,7 +937,7 @@
<property name="geometry">
<rect>
<x>50</x>
<y>135</y>
<y>137</y>
<width>115</width>
<height>16</height>
</rect>
@ -949,32 +967,10 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="rfBWText">
<property name="geometry">
<rect>
<x>180</x>
<y>130</y>
<width>40</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>00.0k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QToolButton" name="slot1On">
<property name="geometry">
<rect>
<x>40</x>
<x>140</x>
<y>70</y>
<width>23</width>
<height>22</height>
@ -998,7 +994,7 @@
<widget class="QToolButton" name="slot2On">
<property name="geometry">
<rect>
<x>70</x>
<x>170</x>
<y>70</y>
<width>23</width>
<height>22</height>
@ -1022,7 +1018,7 @@
<widget class="QToolButton" name="tdmaStereoSplit">
<property name="geometry">
<rect>
<x>100</x>
<x>200</x>
<y>70</y>
<width>23</width>
<height>22</height>
@ -1043,6 +1039,78 @@
<bool>true</bool>
</property>
</widget>
<widget class="QDial" name="traceLength">
<property name="geometry">
<rect>
<x>40</x>
<y>68</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>Display trace length (ms)</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
<widget class="QLabel" name="traceLengthText">
<property name="geometry">
<rect>
<x>70</x>
<y>73</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>Display trace length (ms)</string>
</property>
<property name="text">
<string>0000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="demodGainText">
<property name="geometry">
<rect>
<x>180</x>
<y>130</y>
<width>40</width>
<height>29</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>35</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0.00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
</item>
</layout>

View File

@ -53,6 +53,7 @@ void DSDDemodSettings::resetToDefaults()
m_rgbColor = QColor(0, 255, 255).rgb();
m_title = "DSD Demodulator";
m_highPassFilter = false;
m_traceLengthMutliplier = 5; // 250 ms
}
QByteArray DSDDemodSettings::serialize() const
@ -85,6 +86,7 @@ QByteArray DSDDemodSettings::serialize() const
s.writeString(18, m_title);
s.writeBool(19, m_highPassFilter);
s.writeBool(20, m_copyAudioUseRTP);
s.writeS32(21, m_traceLengthMutliplier);
return s.final();
}
@ -139,6 +141,8 @@ bool DSDDemodSettings::deserialize(const QByteArray& data)
d.readString(18, &m_title, "DSD Demodulator");
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;
return true;
}

View File

@ -46,6 +46,7 @@ struct DSDDemodSettings
quint32 m_rgbColor;
QString m_title;
bool m_highPassFilter;
int m_traceLengthMutliplier; // x 50ms
Serializable *m_channelMarker;
Serializable *m_scopeGUI;

View File

@ -52,14 +52,14 @@ 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));
m_tvScreen->setDataColor(col, qRed(m_plotRGB), qGreen(m_plotRGB), qBlue(m_plotRGB), 128); // FIXME: alpha does not work
m_pixelCount++;
if (m_pixelCount == m_pixelsPerFrame)
{
drawGraticule();
m_tvScreen->renderImage(0);
usleep(10000);
usleep(50000);
m_tvScreen->getSize(m_cols, m_rows);
m_tvScreen->resetImage();
m_pixelCount = 0;

View File

@ -39,7 +39,11 @@ public:
virtual bool handleMessage(const Message& message);
void setScale(float scale) { m_scale = scale; }
void setPixelsPerFrame(int pixelsPerFrame) { m_pixelsPerFrame = pixelsPerFrame; }
void setPixelsPerFrame(int pixelsPerFrame) {
m_pixelsPerFrame = pixelsPerFrame;
m_pixelCount = 0;
}
void setPlotRGB(const QRgb& plotRGB) { m_plotRGB = plotRGB; }
void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; }

View File

@ -45,7 +45,6 @@ GLShaderTVArray::GLShaderTVArray(bool blnColor) : m_blnColor(blnColor)
m_objCurrentRow = 0;
m_objTextureLoc = 0;
m_objColorLoc = 0;
m_objMatrixLoc = 0;
}
@ -100,7 +99,6 @@ void GLShaderTVArray::InitializeGL(int intCols, int intRows)
m_objMatrixLoc = m_objProgram->uniformLocation("uMatrix");
m_objTextureLoc = m_objProgram->uniformLocation("uTexture");
m_objColorLoc = m_objProgram->uniformLocation("uColour");
if (m_objTexture != 0)
{
@ -113,6 +111,7 @@ void GLShaderTVArray::InitializeGL(int intCols, int intRows)
m_objImage->fill(QColor(0, 0, 0));
m_objTexture = new QOpenGLTexture(*m_objImage);
m_objTexture->setFormat(QOpenGLTexture::RGBA8_UNorm);
m_objTexture->setMinificationFilter(QOpenGLTexture::Linear);
m_objTexture->setMagnificationFilter(QOpenGLTexture::Linear);
m_objTexture->setWrapMode(QOpenGLTexture::ClampToEdge);
@ -210,6 +209,9 @@ 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);
m_objTexture->bind();

View File

@ -60,7 +60,7 @@ protected:
QOpenGLShaderProgram *m_objProgram;
int m_objMatrixLoc;
int m_objTextureLoc;
int m_objColorLoc;
//int m_objColorLoc;
static const QString m_strVertexShaderSourceArray;
static const QString m_strFragmentShaderSourceColored;

View File

@ -225,3 +225,15 @@ bool TVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue)
return false;
}
}
bool TVScreen::setDataColor(int intCol, int intRed, int intGreen, int intBlue, int intAlpha)
{
if (m_blnGLContextInitialized)
{
return m_objGLShaderArray.SetDataColor(intCol, qRgba(intBlue, intGreen, intRed, intAlpha)); // FIXME: blue <> red inversion in shader
}
else
{
return false;
}
}

View File

@ -52,7 +52,8 @@ public:
void resetImage();
bool selectRow(int intLine);
bool setDataColor(int intCol,int intRed, int intGreen, int intBlue);
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 connectTimer(const QTimer& timer);