1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-13 11:51:47 -05:00

NFM dempd: light audio mute button in green when the squelch is open

This commit is contained in:
f4exb 2016-03-27 05:37:15 +02:00
parent 17db3e03b6
commit 2c38a8b9a0
4 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,7 @@ NFMDemod::NFMDemod() :
m_squelchCount(0),
m_agcAttack(2400),
m_audioMute(false),
m_squelchOpen(false),
m_afSquelch(2, afSqTones),
m_audioFifo(4, 48000),
m_fmExcursion(2400),
@ -122,7 +123,6 @@ Real angleDist(Real a, Real b)
void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
{
bool squelchOpen;
Complex ci;
m_settingsMutex.lock();
@ -162,7 +162,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
}
//squelchOpen = (getMag() > m_squelchLevel);
squelchOpen = m_squelchCount == m_agcAttack; // wait for AGC to stabilize
m_squelchOpen = m_squelchCount == m_agcAttack; // wait for AGC to stabilize
/*
if (m_afSquelch.analyze(demod))
@ -170,7 +170,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
squelchOpen = m_afSquelch.evaluate();
}*/
if ((squelchOpen) && !m_running.m_audioMute)
if ((m_squelchOpen) && !m_running.m_audioMute)
//if (m_AGC.getAverage() > m_squelchLevel)
{
if (m_running.m_ctcssOn)

View File

@ -67,6 +67,7 @@ public:
}
Real getMag() { return m_AGC.getAverage() / (1<<15); }
bool getSquelchOpen() const { return m_squelchOpen; }
private:
class MsgConfigureNFMDemod : public Message {
@ -169,6 +170,7 @@ private:
bool m_audioMute;
double m_squelchLevel;
bool m_squelchOpen;
Real m_lastArgument;
//Complex m_m1Sample;

View File

@ -240,6 +240,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_channelMarker(this),
m_basicSettingsShown(false),
m_doApplySettings(true),
m_squelchOpen(false),
m_channelPowerDbAvg(20,0)
{
ui->setupUi(this);
@ -353,4 +354,16 @@ void NFMDemodGUI::tick()
Real powDb = CalcDb::dbPower(m_nfmDemod->getMag()) * 2;
m_channelPowerDbAvg.feed(powDb);
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
bool squelchOpen = m_nfmDemod->getSquelchOpen();
if (squelchOpen != m_squelchOpen)
{
m_squelchOpen = squelchOpen;
if (m_squelchOpen) {
ui->audioMute->setStyleSheet("QToolButton { background-color : green; }");
} else {
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
}
}

View File

@ -63,6 +63,7 @@ private:
NFMDemod* m_nfmDemod;
bool m_ctcssOn;
bool m_audioMute;
bool m_squelchOpen;
MovingAverage<Real> m_channelPowerDbAvg;
static const int m_rfBW[];