NFM demod: use smootherstep function for squelch attack and decay

This commit is contained in:
f4exb 2017-05-13 11:00:02 +02:00
parent 07c476f1d4
commit 68f742fad7
2 changed files with 11 additions and 2 deletions

View File

@ -277,8 +277,8 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
}
else
{
Real squelchFactor = (Real) (m_squelchCount - m_squelchGate) / 480.0f;
sample = demod * m_running.m_volume * squelchFactor * squelchFactor;
Real squelchFactor = smootherstep((Real) (m_squelchCount - m_squelchGate) / 480.0f);
sample = demod * m_running.m_volume * squelchFactor;
}
}
}

View File

@ -244,6 +244,15 @@ private:
PhaseDiscriminators m_phaseDiscri;
void apply();
float smootherstep(float x)
{
double x3 = x * x * x;
double x4 = x * x3;
double x5 = x * x4;
return (float) (6.0*x5 - 15.0*x4 + 10.0*x3);
}
};
#endif // INCLUDE_NFMDEMOD_H