1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Mute option for NFM channel

This commit is contained in:
f4exb 2015-12-06 04:49:22 +01:00
parent 45261ce623
commit 078ec79b1c
6 changed files with 64 additions and 17 deletions

View File

@ -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
<h2>Major redesign</h2>

View File

@ -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;
}

View File

@ -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;

View File

@ -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());
}
}

View File

@ -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<Real> m_channelPowerDbAvg;
static const int m_rfBW[];

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>281</width>
<height>433</height>
<height>162</height>
</rect>
</property>
<property name="windowTitle">
@ -16,10 +16,10 @@
<widget class="QWidget" name="settingsContainer" native="true">
<property name="geometry">
<rect>
<x>6</x>
<y>35</y>
<width>235</width>
<height>395</height>
<x>0</x>
<y>0</y>
<width>271</width>
<height>131</height>
</rect>
</property>
<property name="windowTitle">
@ -383,6 +383,24 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="audioMute">
<property name="toolTip">
<string>Mute/Unmute audio</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/sound_on.png</normaloff>
<normalon>:/sound_off.png</normalon>:/sound_on.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>