kopia lustrzana https://github.com/f4exb/sdrangel
AM demod: refactor demodulation
rodzic
225f25b9f4
commit
51d24102ed
|
@ -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");
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Ładowanie…
Reference in New Issue