1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-30 03:38:55 -05:00

DSD demod plugin: added scope window on discriminator output

This commit is contained in:
f4exb 2016-04-07 19:54:26 +02:00
parent d4cd66f433
commit 93b0b91f79
3 changed files with 51 additions and 61 deletions

View File

@ -41,7 +41,7 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
m_fmExcursion(24),
m_settingsMutex(QMutex::Recursive),
m_scope(sampleSink),
m_scopeEnabled(false)
m_scopeEnabled(true)
{
setObjectName("DSDDemod");
@ -113,7 +113,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_AGC.feed(ci);
Real demod = m_phaseDiscri.phaseDiscriminator(ci);
Real demod = 32768.0f * m_phaseDiscri.phaseDiscriminator(ci) * ((float) m_running.m_demodGain / 100.0f);
m_sampleCount++;
// AF processing
@ -144,21 +144,21 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
Sample s(demod, 0.0);
m_scopeSampleBuffer.push_back(s);
// m_audioBuffer[m_audioBufferFill].l = sample;
// m_audioBuffer[m_audioBufferFill].r = sample;
// ++m_audioBufferFill;
//
// if (m_audioBufferFill >= m_audioBuffer.size())
// {
// uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 10);
//
// if (res != m_audioBufferFill)
// {
// qDebug("DSDDemod::feed: %u/%u audio samples written", res, m_audioBufferFill);
// }
//
// m_audioBufferFill = 0;
// }
m_audioBuffer[m_audioBufferFill].l = sample;
m_audioBuffer[m_audioBufferFill].r = sample;
++m_audioBufferFill;
if (m_audioBufferFill >= m_audioBuffer.size())
{
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 10);
if (res != m_audioBufferFill)
{
qDebug("DSDDemod::feed: %u/%u audio samples written", res, m_audioBufferFill);
}
m_audioBufferFill = 0;
}
m_interpolatorDistanceRemain += m_interpolatorDistance;
}

View File

@ -1,13 +1,11 @@
#include <QDockWidget>
#include <QMainWindow>
#include <QDebug>
#include "dsddemodgui.h"
#include "ui_dsddemodgui.h"
#include "dsp/threadedsamplesink.h"
#include "dsp/channelizer.h"
#include "dsp/scopevis.h"
#include "dsddemod.h"
#include "dsp/nullsink.h"
#include "gui/glscope.h"
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
#include "util/db.h"
@ -15,6 +13,9 @@
#include "dsp/dspengine.h"
#include "mainwindow.h"
#include "dsddemod.h"
#include "dsddemodgui.h"
DSDDemodGUI* DSDDemodGUI::create(PluginAPI* pluginAPI)
{
DSDDemodGUI* gui = new DSDDemodGUI(pluginAPI);
@ -74,6 +75,7 @@ QByteArray DSDDemodGUI::serialize() const
s.writeU32(7, m_channelMarker.getColor().rgb());
s.writeS32(8, ui->squelchGate->value());
s.writeS32(9, ui->volume->value());
s.writeBlob(10, ui->scopeGUI->serialize());
return s.final();
}
@ -117,6 +119,8 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
ui->squelchGate->setValue(tmp);
d.readS32(9, &tmp, 20);
ui->volume->setValue(tmp);
d.readBlob(10, &bytetmp);
ui->scopeGUI->deserialize(bytetmp);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@ -242,6 +246,9 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_dsdDemod = new DSDDemod(m_scopeVis);
m_dsdDemod->registerGUI(this);
ui->glScope->setSampleRate(48000);
m_scopeVis->setSampleRate(48000);
ui->glScope->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>503</width>
<height>506</height>
<height>898</height>
</rect>
</property>
<property name="sizePolicy">
@ -234,7 +234,7 @@
<number>50</number>
</property>
<property name="maximum">
<number>150</number>
<number>200</number>
</property>
<property name="pageStep">
<number>1</number>
@ -525,50 +525,33 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="scopeContainer" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<widget class="QWidget" name="verticalWidget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<x>10</x>
<y>180</y>
<width>501</width>
<height>291</height>
<width>481</width>
<height>651</height>
</rect>
</property>
<property name="windowTitle">
<string>Discriminator Scope</string>
</property>
<layout class="QVBoxLayout" name="scopeContainer">
<item>
<widget class="GLScope" name="glScope" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>250</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>250</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>8</pointsize>
</font>
</property>
</widget>
<widget class="GLScopeGUI" name="scopeGUI" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>260</y>
<width>481</width>
<height>26</height>
</rect>
</property>
</widget>
</item>
<item>
<widget class="GLScopeGUI" name="scopeGUI" native="true"/>
</item>
</layout>
</widget>
</widget>
<customwidgets>