AM demod: refactor demodulation

pull/27/head
f4exb 2017-05-12 04:25:14 +02:00
rodzic 225f25b9f4
commit 51d24102ed
2 zmienionych plików z 7 dodań i 11 usunięć

Wyświetl plik

@ -35,7 +35,7 @@ AMDemod::AMDemod() :
m_magsqPeak(0.0f), m_magsqPeak(0.0f),
m_magsqCount(0), m_magsqCount(0),
m_movingAverage(40, 0), m_movingAverage(40, 0),
m_volumeAGC(40, 0) m_volumeAGC(4800, 1.0)
{ {
setObjectName("AMDemod"); setObjectName("AMDemod");

Wyświetl plik

@ -177,21 +177,17 @@ private:
{ {
Real demod = sqrt(magsq); Real demod = sqrt(magsq);
if (demod < -1) if (demod > 1)
{
demod = -1;
}
else if (demod > 1)
{ {
demod = 1; demod = 1;
} }
m_volumeAGC.feed(demod); m_volumeAGC.feed(demod);
demod /= m_volumeAGC.getValue();
Real attack = (m_squelchCount - (m_running.m_audioSampleRate / 20)) / (Real) (m_running.m_audioSampleRate / 20); sample = (0.5 - demod) * 2048 * m_running.m_volume;
demod *= ((0.003 * attack) / m_volumeAGC.getValue()); // Real attack = (m_squelchCount - (m_running.m_audioSampleRate / 20)) / (Real) (m_running.m_audioSampleRate / 20);
demod *= m_running.m_volume; // demod *= ((0.003 * attack) / m_volumeAGC.getValue());
sample = demod * 32700 * 16; // sample = demod * 32700 * 16;
m_squelchOpen = true; m_squelchOpen = true;
} }
else else