mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-30 05:52:24 -04:00
AM demod: enhanced squelch: supressed transients, smooth open/close
This commit is contained in:
parent
0613100bbd
commit
d46ab16ead
@ -88,14 +88,23 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
|
|||||||
|
|
||||||
if (m_magsq >= m_squelchLevel)
|
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;
|
qint16 sample;
|
||||||
|
|
||||||
if (m_squelchState > 0)
|
if (m_squelchCount >= m_running.m_audioSampleRate / 20)
|
||||||
{
|
{
|
||||||
m_squelchState--;
|
|
||||||
Real demod = sqrt(magsq);
|
Real demod = sqrt(magsq);
|
||||||
|
|
||||||
demod = m_lowpass.filter(demod);
|
demod = m_lowpass.filter(demod);
|
||||||
@ -111,7 +120,8 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
|
|||||||
|
|
||||||
m_volumeAGC.feed(demod);
|
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;
|
demod *= m_running.m_volume;
|
||||||
sample = demod * 32700 * 16;
|
sample = demod * 32700 * 16;
|
||||||
|
|
||||||
@ -163,7 +173,7 @@ void AMDemod::start()
|
|||||||
qDebug() << "AMDemod::start: m_inputSampleRate: " << m_config.m_inputSampleRate
|
qDebug() << "AMDemod::start: m_inputSampleRate: " << m_config.m_inputSampleRate
|
||||||
<< " m_inputFrequencyOffset: " << m_config.m_inputFrequencyOffset;
|
<< " m_inputFrequencyOffset: " << m_config.m_inputFrequencyOffset;
|
||||||
|
|
||||||
m_squelchState = 0;
|
m_squelchCount = 0;
|
||||||
m_audioFifo.clear();
|
m_audioFifo.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ private:
|
|||||||
Lowpass<Real> m_lowpass;
|
Lowpass<Real> m_lowpass;
|
||||||
|
|
||||||
Real m_squelchLevel;
|
Real m_squelchLevel;
|
||||||
int m_squelchState;
|
int m_squelchCount;
|
||||||
Real m_magsq;
|
Real m_magsq;
|
||||||
|
|
||||||
MovingAverage<Real> m_movingAverage;
|
MovingAverage<Real> m_movingAverage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user