kopia lustrzana https://github.com/f4exb/sdrangel
AM demod: fixed delayed squelch
rodzic
1ac7ceae80
commit
97677075b1
|
@ -4,8 +4,9 @@ sdrangel (3.14.5-1) unstable; urgency=medium
|
|||
* Added a benchmark program testing decimators
|
||||
* Optimization of decimators using even/odd technique
|
||||
* SSB mod: fixed channel unregistration
|
||||
* AM demod: fixed delayed squelch
|
||||
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Fri, 04 May 2018 20:14:18 +0200
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 06 May 2018 20:14:18 +0200
|
||||
|
||||
sdrangel (3.14.4-1) unstable; urgency=medium
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
|
|||
m_inputFrequencyOffset(0),
|
||||
m_running(false),
|
||||
m_squelchOpen(false),
|
||||
m_squelchDelayLine(12000),
|
||||
m_squelchDelayLine(9600),
|
||||
m_magsqSum(0.0f),
|
||||
m_magsqPeak(0.0f),
|
||||
m_magsqCount(0),
|
||||
|
@ -232,7 +232,7 @@ void AMDemod::applyAudioSampleRate(int sampleRate)
|
|||
m_interpolatorDistance = (Real) m_inputSampleRate / (Real) sampleRate;
|
||||
m_bandpass.create(301, sampleRate, 300.0, m_settings.m_rfBandwidth / 2.0f);
|
||||
m_audioFifo.setSize(sampleRate);
|
||||
m_squelchDelayLine.resize(sampleRate/4);
|
||||
m_squelchDelayLine.resize(sampleRate/5);
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
m_audioSampleRate = sampleRate;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "audio/audiofifo.h"
|
||||
#include "util/message.h"
|
||||
#include "util/doublebufferfifo.h"
|
||||
|
||||
#include "amdemodsettings.h"
|
||||
|
||||
class DeviceSourceAPI;
|
||||
|
@ -183,8 +182,8 @@ private:
|
|||
|
||||
void processOneSample(Complex &ci)
|
||||
{
|
||||
Real re = ci.real() / SDR_RX_SCALED;
|
||||
Real im = ci.imag() / SDR_RX_SCALED;
|
||||
Real re = ci.real() / SDR_RX_SCALEF;
|
||||
Real im = ci.imag() / SDR_RX_SCALEF;
|
||||
Real magsq = re*re + im*im;
|
||||
m_movingAverage(magsq);
|
||||
m_magsq = m_movingAverage.asDouble();
|
||||
|
@ -197,43 +196,28 @@ private:
|
|||
|
||||
m_magsqCount++;
|
||||
|
||||
// if (m_magsq >= m_squelchLevel)
|
||||
// {
|
||||
// if (m_squelchCount <= m_audioSampleRate / 10)
|
||||
// {
|
||||
// m_squelchCount++;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (m_squelchCount > 1)
|
||||
// {
|
||||
// m_squelchCount -= 2;
|
||||
// }
|
||||
// }
|
||||
m_squelchDelayLine.write(magsq);
|
||||
|
||||
if (m_magsq >= m_squelchLevel)
|
||||
{
|
||||
if (m_squelchCount < m_audioSampleRate / 10) {
|
||||
m_squelchCount++;
|
||||
}
|
||||
|
||||
m_squelchDelayLine.write(magsq);
|
||||
}
|
||||
else
|
||||
if (m_magsq < m_squelchLevel)
|
||||
{
|
||||
if (m_squelchCount > 0) {
|
||||
m_squelchCount--;
|
||||
}
|
||||
|
||||
m_squelchDelayLine.write(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_squelchCount < m_audioSampleRate / 10) {
|
||||
m_squelchCount++;
|
||||
}
|
||||
}
|
||||
|
||||
qint16 sample;
|
||||
|
||||
if ((m_squelchCount >= m_audioSampleRate / 20) && !m_settings.m_audioMute)
|
||||
m_squelchOpen = (m_squelchCount >= m_audioSampleRate / 20);
|
||||
|
||||
if (m_squelchOpen && !m_settings.m_audioMute)
|
||||
{
|
||||
Real demod = sqrt(m_squelchDelayLine.readBack(m_audioSampleRate / 20));
|
||||
Real demod = sqrt(m_squelchDelayLine.readBack(m_audioSampleRate/20));
|
||||
m_volumeAGC.feed(demod);
|
||||
demod = (demod - m_volumeAGC.getValue()) / m_volumeAGC.getValue();
|
||||
|
||||
|
@ -245,12 +229,10 @@ private:
|
|||
|
||||
Real attack = (m_squelchCount - 0.05f * m_audioSampleRate) / (0.05f * m_audioSampleRate);
|
||||
sample = demod * attack * (m_audioSampleRate/24) * m_settings.m_volume;
|
||||
m_squelchOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sample = 0;
|
||||
m_squelchOpen = false;
|
||||
}
|
||||
|
||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
||||
|
|
Ładowanie…
Reference in New Issue