diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 7c3f62329..1b6f374df 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -38,6 +38,7 @@ SSBDemod::SSBDemod(BasebandSampleSink* sampleSink) : m_agcNbSamples(12000), m_agcPowerThreshold(1e-2), m_agcThresholdGate(0), + m_audioActive(false), m_sampleSink(sampleSink), m_audioFifo(4, 24000), m_settingsMutex(QMutex::Recursive) @@ -181,6 +182,9 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto m_sum.imag(0.0); } + double agcVal = m_agcActive ? m_agc.feedAndGetValue(sideband[i]) : 1.0; + m_audioActive = agcVal != 0.0; + if (m_audioMute) { m_audioBuffer[m_audioBufferFill].r = 0; @@ -188,8 +192,6 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto } else { - double agcVal = m_agcActive ? m_agc.feedAndGetValue(sideband[i]) : 1.0; - if (m_audioBinaual) { if (m_audioFlipChannels) diff --git a/plugins/channelrx/demodssb/ssbdemod.h b/plugins/channelrx/demodssb/ssbdemod.h index 2edaea576..c9f2cfe29 100644 --- a/plugins/channelrx/demodssb/ssbdemod.h +++ b/plugins/channelrx/demodssb/ssbdemod.h @@ -56,6 +56,7 @@ public: virtual bool handleMessage(const Message& cmd); double getMagSq() const { return m_magsq; } + bool getAudioActive() const { return m_audioActive; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { @@ -185,6 +186,7 @@ private: int m_agcNbSamples; //!< number of audio (48 kHz) samples for AGC averaging double m_agcPowerThreshold; //!< AGC power threshold (linear) int m_agcThresholdGate; //!< Gate length in number of samples befor threshold triggers + bool m_audioActive; //!< True if an audio signal is produced (no AGC or AGC and above threshold) NCOF m_nco; Interpolator m_interpolator; diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp index 95acabc26..d651e21f0 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.cpp +++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp @@ -357,7 +357,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg m_audioFlipChannels(false), m_dsb(false), m_audioMute(false), - m_channelPowerDbAvg(20,0) + m_channelPowerDbAvg(20,0), + m_squelchOpen(false) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); @@ -549,4 +550,17 @@ void SSBDemodGUI::tick() nbMagsqSamples); ui->channelPower->setText(tr("%1 dB").arg(powDbAvg, 0, 'f', 1)); + + bool squelchOpen = m_ssbDemod->getAudioActive(); + + 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/demodssb/ssbdemodgui.h b/plugins/channelrx/demodssb/ssbdemodgui.h index 3c3b58fc2..db374405e 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.h +++ b/plugins/channelrx/demodssb/ssbdemodgui.h @@ -72,6 +72,7 @@ private: bool m_dsb; bool m_audioMute; MovingAverage m_channelPowerDbAvg; + bool m_squelchOpen; ThreadedBasebandSampleSink* m_threadedChannelizer; DownChannelizer* m_channelizer; diff --git a/plugins/channelrx/demodssb/ssbdemodgui.ui b/plugins/channelrx/demodssb/ssbdemodgui.ui index e634ea148..d2688f13e 100644 --- a/plugins/channelrx/demodssb/ssbdemodgui.ui +++ b/plugins/channelrx/demodssb/ssbdemodgui.ui @@ -521,7 +521,7 @@ - AGC power threshold (dB) + Power threshold (dB) -99 @@ -546,7 +546,7 @@ - AGC power threshold (dB) + Power threshold (dB) -00 @@ -565,7 +565,7 @@ - Set threshiold gate (ms) + Power threshiold gate (ms) 20 @@ -587,7 +587,7 @@ - Threshiold gate (ms) + Power threshiold gate (ms) 00