1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-05 14:47:50 -04:00

DSD demod: use buffered squelch to start decoding at the very beginning of the transmission regardless of squelch gate length

This commit is contained in:
f4exb 2018-04-21 09:56:12 +02:00
parent 12f5f4e30c
commit 84538f1acf
2 changed files with 218 additions and 211 deletions

View File

@ -50,6 +50,7 @@ DSDDemod::DSDDemod(DeviceSourceAPI *deviceAPI) :
m_squelchGate(0), m_squelchGate(0),
m_squelchLevel(1e-4), m_squelchLevel(1e-4),
m_squelchOpen(false), m_squelchOpen(false),
m_squelchDelayLine(24000),
m_audioFifo1(48000), m_audioFifo1(48000),
m_audioFifo2(48000), m_audioFifo2(48000),
m_scopeXY(0), m_scopeXY(0),
@ -143,6 +144,8 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if (m_movingAverage.asDouble() > m_squelchLevel) if (m_movingAverage.asDouble() > m_squelchLevel)
{ {
m_squelchDelayLine.write(demod);
if (m_squelchGate > 0) if (m_squelchGate > 0)
{ {
if (m_squelchCount < m_squelchGate) { if (m_squelchCount < m_squelchGate) {
@ -158,14 +161,17 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
} }
else else
{ {
m_squelchDelayLine.write(0);
m_squelchCount = 0; m_squelchCount = 0;
m_squelchOpen = false; m_squelchOpen = false;
} }
if (m_squelchOpen) if (m_squelchOpen)
{ {
sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples sampleDSD = m_squelchDelayLine.readBack(m_squelchGate) * 32768.0f; // DSD decoder takes int16 samples
sample = demod * SDR_RX_SCALEF; // scale to sample size sample = m_squelchDelayLine.readBack(m_squelchGate) * SDR_RX_SCALEF; // scale to sample size
// sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples
// sample = demod * SDR_RX_SCALEF; // scale to sample size
} }
else else
{ {

View File

@ -34,6 +34,7 @@
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "util/message.h" #include "util/message.h"
#include "util/udpsink.h" #include "util/udpsink.h"
#include "util/doublebufferfifo.h"
#include "dsddemodsettings.h" #include "dsddemodsettings.h"
#include "dsddecoder.h" #include "dsddecoder.h"
@ -172,9 +173,9 @@ private:
int m_sampleCount; int m_sampleCount;
int m_squelchCount; int m_squelchCount;
int m_squelchGate; int m_squelchGate;
double m_squelchLevel; double m_squelchLevel;
bool m_squelchOpen; bool m_squelchOpen;
DoubleBufferFIFO<Real> m_squelchDelayLine;
MovingAverageUtil<Real, double, 16> m_movingAverage; MovingAverageUtil<Real, double, 16> m_movingAverage;
double m_magsq; double m_magsq;