mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
AM dempd: light audio mute button in green when the squelch is open
This commit is contained in:
parent
2c38a8b9a0
commit
692686684e
@ -28,6 +28,7 @@
|
|||||||
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
|
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
|
||||||
|
|
||||||
AMDemod::AMDemod() :
|
AMDemod::AMDemod() :
|
||||||
|
m_squelchOpen(false),
|
||||||
m_audioFifo(4, 48000),
|
m_audioFifo(4, 48000),
|
||||||
m_settingsMutex(QMutex::Recursive)
|
m_settingsMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
@ -124,11 +125,12 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
|
|||||||
demod *= ((0.003 * attack) / m_volumeAGC.getValue());
|
demod *= ((0.003 * attack) / m_volumeAGC.getValue());
|
||||||
demod *= m_running.m_volume;
|
demod *= m_running.m_volume;
|
||||||
sample = demod * 32700 * 16;
|
sample = demod * 32700 * 16;
|
||||||
|
m_squelchOpen = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sample = 0;
|
sample = 0;
|
||||||
|
m_squelchOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
m_audioBuffer[m_audioBufferFill].l = sample;
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
virtual bool handleMessage(const Message& cmd);
|
virtual bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
Real getMagSq() const { return m_magsq; }
|
Real getMagSq() const { return m_magsq; }
|
||||||
|
bool getSquelchOpen() const { return m_squelchOpen; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MsgConfigureAMDemod : public Message {
|
class MsgConfigureAMDemod : public Message {
|
||||||
@ -120,6 +121,7 @@ private:
|
|||||||
|
|
||||||
Real m_squelchLevel;
|
Real m_squelchLevel;
|
||||||
int m_squelchCount;
|
int m_squelchCount;
|
||||||
|
bool m_squelchOpen;
|
||||||
Real m_magsq;
|
Real m_magsq;
|
||||||
|
|
||||||
MovingAverage<Real> m_movingAverage;
|
MovingAverage<Real> m_movingAverage;
|
||||||
|
@ -207,7 +207,8 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_basicSettingsShown(false),
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_channelPowerDbAvg(20,0)
|
m_channelPowerDbAvg(20,0),
|
||||||
|
m_squelchOpen(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
@ -290,5 +291,17 @@ void AMDemodGUI::tick()
|
|||||||
Real powDb = CalcDb::dbPower(m_amDemod->getMagSq());
|
Real powDb = CalcDb::dbPower(m_amDemod->getMagSq());
|
||||||
m_channelPowerDbAvg.feed(powDb);
|
m_channelPowerDbAvg.feed(powDb);
|
||||||
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
||||||
|
bool squelchOpen = m_amDemod->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); }");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ private:
|
|||||||
Channelizer* m_channelizer;
|
Channelizer* m_channelizer;
|
||||||
AMDemod* m_amDemod;
|
AMDemod* m_amDemod;
|
||||||
MovingAverage<Real> m_channelPowerDbAvg;
|
MovingAverage<Real> m_channelPowerDbAvg;
|
||||||
|
bool m_squelchOpen;
|
||||||
|
|
||||||
static const int m_rfBW[];
|
static const int m_rfBW[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user