diff --git a/Readme.md b/Readme.md
index c92fe63d6..bdf745c74 100644
--- a/Readme.md
+++ b/Readme.md
@@ -183,6 +183,7 @@ For Debian Jessie or Stretch:
- New USB source plugin to connect to an external demodulator (ex: GNU radio) via USB ports
- Binaural option for SSB demod
- DSB option for SSB
+ - Mute option for NFM channel
Major redesign
diff --git a/plugins/channel/nfm/nfmdemod.cpp b/plugins/channel/nfm/nfmdemod.cpp
index eb5797a7f..077b7cc45 100644
--- a/plugins/channel/nfm/nfmdemod.cpp
+++ b/plugins/channel/nfm/nfmdemod.cpp
@@ -35,6 +35,7 @@ NFMDemod::NFMDemod() :
m_sampleCount(0),
m_squelchCount(0),
m_agcAttack(2400),
+ m_audioMute(false),
m_afSquelch(2, afSqTones),
m_audioFifo(4, 48000),
m_settingsMutex(QMutex::Recursive)
@@ -48,6 +49,7 @@ NFMDemod::NFMDemod() :
m_config.m_squelch = -30.0;
m_config.m_volume = 2.0;
m_config.m_ctcssOn = false;
+ m_config.m_audioMute = false;
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
apply();
@@ -75,13 +77,15 @@ void NFMDemod::configure(MessageQueue* messageQueue,
Real afBandwidth,
Real volume,
Real squelch,
- bool ctcssOn)
+ bool ctcssOn,
+ bool audioMute)
{
Message* cmd = MsgConfigureNFMDemod::create(rfBandwidth,
afBandwidth,
volume,
squelch,
- ctcssOn);
+ ctcssOn,
+ audioMute);
messageQueue->push(cmd);
}
@@ -196,7 +200,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
squelchOpen = m_afSquelch.evaluate();
}*/
- if (squelchOpen)
+ if ((squelchOpen) && !m_running.m_audioMute)
//if (m_AGC.getAverage() > m_squelchLevel)
{
if (m_running.m_ctcssOn)
@@ -324,14 +328,16 @@ bool NFMDemod::handleMessage(const Message& cmd)
m_config.m_volume = cfg.getVolume();
m_config.m_squelch = cfg.getSquelch();
m_config.m_ctcssOn = cfg.getCtcssOn();
+ m_config.m_audioMute = cfg.getAudioMute();
apply();
- qDebug() << " - MsgConfigureNFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
+ qDebug() << "NFMDemod::handleMessage: MsgConfigureNFMDemod: 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_ctcssOn: " << m_config.m_ctcssOn;
+ << " m_ctcssOn: " << m_config.m_ctcssOn
+ << " m_audioMute: " << m_config.m_audioMute;
return true;
}
@@ -384,4 +390,5 @@ void NFMDemod::apply()
m_running.m_volume = m_config.m_volume;
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
m_running.m_ctcssOn = m_config.m_ctcssOn;
+ m_running.m_audioMute = m_config.m_audioMute;
}
diff --git a/plugins/channel/nfm/nfmdemod.h b/plugins/channel/nfm/nfmdemod.h
index 3a12096bc..460b16aca 100644
--- a/plugins/channel/nfm/nfmdemod.h
+++ b/plugins/channel/nfm/nfmdemod.h
@@ -44,7 +44,8 @@ public:
Real afBandwidth,
Real volume,
Real squelch,
- bool ctcssOn);
+ bool ctcssOn,
+ bool audioMute);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
@@ -76,14 +77,16 @@ private:
Real getVolume() const { return m_volume; }
Real getSquelch() const { return m_squelch; }
bool getCtcssOn() const { return m_ctcssOn; }
+ bool getAudioMute() const { return m_audioMute; }
static MsgConfigureNFMDemod* create(Real rfBandwidth,
Real afBandwidth,
Real volume,
Real squelch,
- bool ctcssOn)
+ bool ctcssOn,
+ bool audioMute)
{
- return new MsgConfigureNFMDemod(rfBandwidth, afBandwidth, volume, squelch, ctcssOn);
+ return new MsgConfigureNFMDemod(rfBandwidth, afBandwidth, volume, squelch, ctcssOn, audioMute);
}
private:
@@ -92,18 +95,21 @@ private:
Real m_volume;
Real m_squelch;
bool m_ctcssOn;
+ bool m_audioMute;
MsgConfigureNFMDemod(Real rfBandwidth,
Real afBandwidth,
Real volume,
Real squelch,
- bool ctcssOn) :
+ bool ctcssOn,
+ bool audioMute) :
Message(),
m_rfBandwidth(rfBandwidth),
m_afBandwidth(afBandwidth),
m_volume(volume),
m_squelch(squelch),
- m_ctcssOn(ctcssOn)
+ m_ctcssOn(ctcssOn),
+ m_audioMute(audioMute)
{ }
};
@@ -126,6 +132,7 @@ private:
Real m_squelch;
Real m_volume;
bool m_ctcssOn;
+ bool m_audioMute;
int m_ctcssIndex;
quint32 m_audioSampleRate;
@@ -137,6 +144,7 @@ private:
m_squelch(0),
m_volume(0),
m_ctcssOn(false),
+ m_audioMute(false),
m_ctcssIndex(0),
m_audioSampleRate(0)
{ }
@@ -157,6 +165,7 @@ private:
int m_sampleCount;
int m_squelchCount;
int m_agcAttack;
+ bool m_audioMute;
double m_squelchLevel;
diff --git a/plugins/channel/nfm/nfmdemodgui.cpp b/plugins/channel/nfm/nfmdemodgui.cpp
index e09017166..bea349e72 100644
--- a/plugins/channel/nfm/nfmdemodgui.cpp
+++ b/plugins/channel/nfm/nfmdemodgui.cpp
@@ -61,6 +61,7 @@ void NFMDemodGUI::resetToDefaults()
ui->squelch->setValue(-40);
ui->deltaFrequency->setValue(0);
ui->ctcssOn->setChecked(false);
+ ui->audioMute->setChecked(false);
blockApplySettings(false);
applySettings();
@@ -77,6 +78,7 @@ QByteArray NFMDemodGUI::serialize() const
s.writeU32(7, m_channelMarker.getColor().rgb());
s.writeS32(8, ui->ctcss->currentIndex());
s.writeBool(9, ui->ctcssOn->isChecked());
+ s.writeBool(10, ui->audioMute->isChecked());
return s.final();
}
@@ -118,9 +120,10 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
d.readS32(8, &tmp, 0);
ui->ctcss->setCurrentIndex(tmp);
-
d.readBool(9, &boolTmp, false);
ui->ctcssOn->setChecked(boolTmp);
+ d.readBool(10, &boolTmp, false);
+ ui->audioMute->setChecked(boolTmp);
blockApplySettings(false);
m_channelMarker.blockSignals(false);
@@ -199,6 +202,12 @@ void NFMDemodGUI::on_ctcssOn_toggled(bool checked)
applySettings();
}
+void NFMDemodGUI::on_audioMute_toggled(bool checked)
+{
+ m_audioMute = checked;
+ applySettings();
+}
+
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index)
{
if (m_nfmDemod != 0)
@@ -304,7 +313,8 @@ void NFMDemodGUI::applySettings()
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0,
ui->squelch->value(),
- ui->ctcssOn->isChecked());
+ ui->ctcssOn->isChecked(),
+ ui->audioMute->isChecked());
}
}
diff --git a/plugins/channel/nfm/nfmdemodgui.h b/plugins/channel/nfm/nfmdemodgui.h
index 50bba7b5a..0d9a7fa15 100644
--- a/plugins/channel/nfm/nfmdemodgui.h
+++ b/plugins/channel/nfm/nfmdemodgui.h
@@ -46,6 +46,7 @@ private slots:
void on_squelch_valueChanged(int value);
void on_ctcss_currentIndexChanged(int index);
void on_ctcssOn_toggled(bool checked);
+ void on_audioMute_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDoubleClicked();
void tick();
@@ -61,6 +62,7 @@ private:
Channelizer* m_channelizer;
NFMDemod* m_nfmDemod;
bool m_ctcssOn;
+ bool m_audioMute;
MovingAverage m_channelPowerDbAvg;
static const int m_rfBW[];
diff --git a/plugins/channel/nfm/nfmdemodgui.ui b/plugins/channel/nfm/nfmdemodgui.ui
index d45fbfe90..d55c3b613 100644
--- a/plugins/channel/nfm/nfmdemodgui.ui
+++ b/plugins/channel/nfm/nfmdemodgui.ui
@@ -7,7 +7,7 @@
0
0
281
- 433
+ 162
@@ -16,10 +16,10 @@
- 6
- 35
- 235
- 395
+ 0
+ 0
+ 271
+ 131
@@ -383,6 +383,24 @@
+ -
+
+
+ Mute/Unmute audio
+
+
+ ...
+
+
+
+ :/sound_on.png
+ :/sound_off.png:/sound_on.png
+
+
+ true
+
+
+