1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

NFM demod and AF squelch: fixed initialization and reset at each squelch change

This commit is contained in:
f4exb 2017-05-31 23:36:02 +02:00
parent db1a620fc2
commit 9a8cc15d8f
2 changed files with 5 additions and 1 deletions

View File

@ -75,7 +75,7 @@ NFMDemod::NFMDemod() :
m_movingAverage.resize(32, 0);
m_ctcssDetector.setCoefficients(3000, 6000.0); // 0.5s / 2 Hz resolution
m_afSquelch.setCoefficients(24, 60, 48000.0, 20, 0); // 0.5ms test period, 30ms average span, 48kS/s SR, 10ms attack, no decay
m_afSquelch.setCoefficients(24, 600, 48000.0, 200, 0); // 0.5ms test period, 300ms average span, 48kS/s SR, 100ms attack, no decay
DSPEngine::instance()->addAudioSink(&m_audioFifo);
}
@ -445,6 +445,7 @@ void NFMDemod::apply(bool force)
{ // input is a value in negative millis
m_squelchLevel = (- m_config.m_squelch) / 1000.0;
m_afSquelch.setThreshold(m_squelchLevel);
m_afSquelch.reset();
}
else
{ // input is a value in centi-Bels

View File

@ -51,6 +51,7 @@ AFSquelch::AFSquelch() :
m_u0[j] = 0.0;
m_u1[j] = 0.0;
m_power[j] = 0.0;
m_movingAverages[j].fill(0.0);
}
}
@ -86,6 +87,7 @@ AFSquelch::AFSquelch(unsigned int nbTones, const double *tones) :
m_u0[j] = 0.0;
m_u1[j] = 0.0;
m_power[j] = 0.0;
m_movingAverages[j].fill(0.0);
}
}
@ -137,6 +139,7 @@ void AFSquelch::setCoefficients(
m_u0[j] = 0.0;
m_u1[j] = 0.0;
m_power[j] = 0.0;
m_movingAverages[j].fill(0.0);
}
}