From d9b32700fc8af4f6ae4e6d474f3ec771fede6711 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 29 Sep 2026 09:19:17 +0100 Subject: [PATCH] BFMDemod: Set audio icon background to green when squelch open. --- plugins/channelrx/demodbfm/bfmdemod.h | 1 + plugins/channelrx/demodbfm/bfmdemodbaseband.h | 1 + plugins/channelrx/demodbfm/bfmdemodgui.cpp | 21 ++++++++++++++++++- plugins/channelrx/demodbfm/bfmdemodgui.h | 2 ++ plugins/channelrx/demodbfm/bfmdemodsink.h | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h index c1e0f1b7f..aae436b6f 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.h +++ b/plugins/channelrx/demodbfm/bfmdemod.h @@ -118,6 +118,7 @@ public: Real getDemodQua() const { return m_running ? m_basebandSink->getDemodQua() : 0.0f; } Real getDemodFclk() const { return m_running ? m_basebandSink->getDemodFclk() : 0.0f; } int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } + bool getSquelchOpen() const { return m_running && m_basebandSink->getSquelchOpen(); } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { if (m_running) { diff --git a/plugins/channelrx/demodbfm/bfmdemodbaseband.h b/plugins/channelrx/demodbfm/bfmdemodbaseband.h index e0cf9849a..0744184b5 100644 --- a/plugins/channelrx/demodbfm/bfmdemodbaseband.h +++ b/plugins/channelrx/demodbfm/bfmdemodbaseband.h @@ -78,6 +78,7 @@ public: int getAudioSampleRate() const { return m_sink.getAudioSampleRate(); } int getSquelchState() const { return m_sink.getSquelchState(); } + bool getSquelchOpen() const { return m_sink.getSquelchOpen(); } double getMagSq() const { return m_sink.getMagSq(); } bool getPilotLock() const { return m_sink.getPilotLock(); } Real getPilotLevel() const { return m_sink.getPilotLevel(); } diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp index 50c2884db..fb4c74ee5 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp @@ -402,6 +402,8 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban m_basebandSampleRate(1), m_rdsTimerCount(0), m_radiotext_AB_flag(false), + m_squelchOpen(false), + m_audioSampleRate(-1), m_rate(625000) { setAttribute(Qt::WA_DeleteOnClose, true); @@ -586,7 +588,24 @@ void BFMDemodGUI::tick() Real pilotPowDb = CalcDb::dbPower(m_bfmDemod->getPilotLevel()); ui->pilotPower->setText(QString::number(pilotPowDb, 'f', 1)); - if (m_bfmDemod->getAudioSampleRate() < 0) + int audioSampleRate = m_bfmDemod->getAudioSampleRate(); + bool squelchOpen = m_bfmDemod->getSquelchOpen(); + + if ((audioSampleRate != m_audioSampleRate) || (squelchOpen != m_squelchOpen)) + { + if (audioSampleRate < 0) { + ui->audioMute->setStyleSheet("QToolButton { background-color : red; }"); + } else if (squelchOpen) { + ui->audioMute->setStyleSheet("QToolButton { background-color : green; }"); + } else { + ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + } + + m_audioSampleRate = audioSampleRate; + m_squelchOpen = squelchOpen; + } + + if (audioSampleRate < 0) { ui->audioStereo->setStyleSheet("QToolButton { background-color : red; }"); } diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.h b/plugins/channelrx/demodbfm/bfmdemodgui.h index f1b4c38af..569563168 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.h +++ b/plugins/channelrx/demodbfm/bfmdemodgui.h @@ -79,6 +79,8 @@ private: bool m_doApplySettings; int m_rdsTimerCount; bool m_radiotext_AB_flag; + bool m_squelchOpen; + int m_audioSampleRate; SpectrumVis* m_spectrumVis; diff --git a/plugins/channelrx/demodbfm/bfmdemodsink.h b/plugins/channelrx/demodbfm/bfmdemodsink.h index c05927d44..a10ee7849 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsink.h +++ b/plugins/channelrx/demodbfm/bfmdemodsink.h @@ -62,6 +62,7 @@ public: Real getDemodQua() const { return m_rdsDemod.m_report.qua; } Real getDemodFclk() const { return m_rdsDemod.m_report.fclk; } int getSquelchState() const { return m_squelchState; } + bool getSquelchOpen() const { return m_squelchState > m_settings.m_rfBandwidth / 20; } void getMagSqLevels(double& avg, double& peak, int& nbSamples) {