diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index 3721d85be..45fffef46 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -65,9 +65,15 @@ WFMDemod::~WFMDemod() DSPEngine::instance()->removeAudioSink(&m_audioFifo); } -void WFMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) +void WFMDemod::configure( + MessageQueue* messageQueue, + Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool audioMute) { - Message* cmd = MsgConfigureWFMDemod::create(rfBandwidth, afBandwidth, volume, squelch); + Message* cmd = MsgConfigureWFMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioMute); messageQueue->push(cmd); } @@ -98,16 +104,23 @@ void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto if(m_movingAverage.average() >= m_squelchLevel) m_squelchState = m_running.m_rfBandwidth / 20; // decay rate - if(m_squelchState > 0) + if (m_squelchState > 0) { m_squelchState--; + m_squelchOpen = true; } else { demod = 0; + m_squelchOpen = false; } - Complex e(demod, 0); + if (m_running.m_audioMute) + { + demod = 0; + } + + Complex e(demod, 0); if(m_interpolator.decimate(&m_interpolatorDistanceRemain, e, &ci)) { @@ -191,11 +204,13 @@ bool WFMDemod::handleMessage(const Message& cmd) m_config.m_afBandwidth = cfg.getAFBandwidth(); m_config.m_volume = cfg.getVolume(); m_config.m_squelch = cfg.getSquelch(); + m_config.m_audioMute = cfg.getAudioMute(); qDebug() << "WFMDemod::handleMessage: MsgConfigureWFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth << " m_afBandwidth: " << m_config.m_afBandwidth << " m_volume: " << m_config.m_volume - << " m_squelch: " << m_config.m_squelch; + << " m_squelch: " << m_config.m_squelch + << " m_audioMute: " << m_config.m_audioMute; apply(); @@ -258,5 +273,5 @@ void WFMDemod::apply() m_running.m_squelch = m_config.m_squelch; m_running.m_volume = m_config.m_volume; m_running.m_audioSampleRate = m_config.m_audioSampleRate; - + m_running.m_audioMute = m_config.m_audioMute; } diff --git a/plugins/channelrx/demodwfm/wfmdemod.h b/plugins/channelrx/demodwfm/wfmdemod.h index 196e1deb7..390ee5390 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.h +++ b/plugins/channelrx/demodwfm/wfmdemod.h @@ -37,7 +37,13 @@ public: WFMDemod(BasebandSampleSink* sampleSink); virtual ~WFMDemod(); - void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch); + void configure( + MessageQueue* messageQueue, + Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool auduiMute); virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); virtual void start(); @@ -45,6 +51,7 @@ public: virtual bool handleMessage(const Message& cmd); Real getMagSq() const { return m_movingAverage.average(); } + bool getSquelchOpen() const { return m_squelchOpen; } private: class MsgConfigureWFMDemod : public Message { @@ -55,10 +62,11 @@ private: Real getAFBandwidth() const { return m_afBandwidth; } Real getVolume() const { return m_volume; } Real getSquelch() const { return m_squelch; } + bool getAudioMute() const { return m_audioMute; } - static MsgConfigureWFMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) + static MsgConfigureWFMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) { - return new MsgConfigureWFMDemod(rfBandwidth, afBandwidth, volume, squelch); + return new MsgConfigureWFMDemod(rfBandwidth, afBandwidth, volume, squelch, audioMute); } private: @@ -66,13 +74,15 @@ private: Real m_afBandwidth; Real m_volume; Real m_squelch; + bool m_audioMute; - MsgConfigureWFMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) : + MsgConfigureWFMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute) : Message(), m_rfBandwidth(rfBandwidth), m_afBandwidth(afBandwidth), m_volume(volume), - m_squelch(squelch) + m_squelch(squelch), + m_audioMute(audioMute) { } }; @@ -95,6 +105,7 @@ private: Real m_squelch; Real m_volume; quint32 m_audioSampleRate; + bool m_audioMute; Config() : m_inputSampleRate(-1), @@ -103,7 +114,8 @@ private: m_afBandwidth(-1), m_squelch(0), m_volume(0), - m_audioSampleRate(0) + m_audioSampleRate(0), + m_audioMute(false) { } }; @@ -118,6 +130,7 @@ private: Real m_squelchLevel; int m_squelchState; + bool m_squelchOpen; Real m_lastArgument; MovingAverage m_movingAverage; diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.cpp b/plugins/channelrx/demodwfm/wfmdemodgui.cpp index cd9fe2aa8..61eabb326 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.cpp +++ b/plugins/channelrx/demodwfm/wfmdemodgui.cpp @@ -192,6 +192,11 @@ void WFMDemodGUI::on_squelch_valueChanged(int value) applySettings(); } +void WFMDemodGUI::on_audioMute_toggled(bool checked) +{ + m_audioMute = checked; + applySettings(); +} void WFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) { @@ -288,7 +293,8 @@ void WFMDemodGUI::applySettings() m_rfBW[ui->rfBW->currentIndex()], ui->afBW->value() * 1000.0, ui->volume->value() / 10.0, - ui->squelch->value()); + ui->squelch->value(), + ui->audioMute->isChecked()); } } @@ -311,4 +317,17 @@ void WFMDemodGUI::tick() Real powDb = CalcDb::dbPower(m_wfmDemod->getMagSq()); m_channelPowerDbAvg.feed(powDb); ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); + + bool squelchOpen = m_wfmDemod->getSquelchOpen(); + + if (squelchOpen != m_squelchOpen) + { + if (squelchOpen) { + ui->audioMute->setStyleSheet("QToolButton { background-color : green; }"); + } else { + ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + } + + m_squelchOpen = squelchOpen; + } } diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.h b/plugins/channelrx/demodwfm/wfmdemodgui.h index 947baa0bb..74d63c043 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.h +++ b/plugins/channelrx/demodwfm/wfmdemodgui.h @@ -45,6 +45,7 @@ private slots: void on_afBW_valueChanged(int value); void on_volume_valueChanged(int value); void on_squelch_valueChanged(int value); + void on_audioMute_toggled(bool checked); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); void tick(); @@ -56,6 +57,8 @@ private: ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; + bool m_audioMute; + bool m_squelchOpen; ThreadedBasebandSampleSink* m_threadedChannelizer; DownChannelizer* m_channelizer; diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.ui b/plugins/channelrx/demodwfm/wfmdemodgui.ui index c618dd9d9..a3478670e 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.ui +++ b/plugins/channelrx/demodwfm/wfmdemodgui.ui @@ -6,10 +6,22 @@ 0 0 - 288 - 147 + 302 + 170 + + + 302 + 0 + + + + + 302 + 16777215 + + Sans Serif @@ -22,12 +34,24 @@ - 10 - 10 - 261 - 121 + 0 + 0 + 300 + 161 + + + 300 + 0 + + + + + 300 + 16777215 + + Settings @@ -35,7 +59,16 @@ 3 - + + 2 + + + 2 + + + 2 + + 2 @@ -140,6 +173,42 @@ + + + + + + dB + + + + + + + + 0 + 0 + + + + + 0 + 24 + + + + + Monospace + 8 + + + + channelPowerMeterUnits + + + + + @@ -209,7 +278,7 @@ - + Vol @@ -238,10 +307,16 @@ - 50 + 30 0 + + + 30 + 16777215 + + 2.0 @@ -255,7 +330,7 @@ - + Sq @@ -284,10 +359,16 @@ - 50 + 40 0 + + + 40 + 16777215 + + -40dB @@ -296,6 +377,21 @@ + + + + + + + + :/sound_on.png + :/sound_off.png:/sound_on.png + + + true + + + @@ -314,6 +410,12 @@
gui/valuedial.h
1 + + LevelMeterSignalDB + QWidget +
gui/levelmeter.h
+ 1 +