1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 05:22:25 -04:00

AM demod: enhanced squelch: supressed transients, smooth open/close

This commit is contained in:
f4exb 2015-12-26 18:11:38 +01:00
parent 0613100bbd
commit d46ab16ead
2 changed files with 16 additions and 6 deletions

View File

@ -88,14 +88,23 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
if (m_magsq >= m_squelchLevel)
{
m_squelchState = m_running.m_audioSampleRate / 20;
if (m_squelchCount <= m_running.m_audioSampleRate / 10)
{
m_squelchCount++;
}
}
else
{
if (m_squelchCount > 0)
{
m_squelchCount--;
}
}
qint16 sample;
if (m_squelchState > 0)
if (m_squelchCount >= m_running.m_audioSampleRate / 20)
{
m_squelchState--;
Real demod = sqrt(magsq);
demod = m_lowpass.filter(demod);
@ -111,7 +120,8 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
m_volumeAGC.feed(demod);
demod *= (0.003 / m_volumeAGC.getValue());
Real attack = (m_squelchCount - (m_running.m_audioSampleRate / 20)) / (Real) (m_running.m_audioSampleRate / 20);
demod *= ((0.003 * attack) / m_volumeAGC.getValue());
demod *= m_running.m_volume;
sample = demod * 32700 * 16;
@ -163,7 +173,7 @@ void AMDemod::start()
qDebug() << "AMDemod::start: m_inputSampleRate: " << m_config.m_inputSampleRate
<< " m_inputFrequencyOffset: " << m_config.m_inputFrequencyOffset;
m_squelchState = 0;
m_squelchCount = 0;
m_audioFifo.clear();
}

View File

@ -114,7 +114,7 @@ private:
Lowpass<Real> m_lowpass;
Real m_squelchLevel;
int m_squelchState;
int m_squelchCount;
Real m_magsq;
MovingAverage<Real> m_movingAverage;