mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
AM demod: implement mute/umute toggle
This commit is contained in:
parent
d46ab16ead
commit
61d6d90ce3
@ -58,9 +58,9 @@ AMDemod::~AMDemod()
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
}
|
||||
|
||||
void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch)
|
||||
void AMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute)
|
||||
{
|
||||
Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, afBandwidth, volume, squelch);
|
||||
Message* cmd = MsgConfigureAMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioMute);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
|
||||
|
||||
qint16 sample;
|
||||
|
||||
if (m_squelchCount >= m_running.m_audioSampleRate / 20)
|
||||
if ((m_squelchCount >= m_running.m_audioSampleRate / 20) && !m_running.m_audioMute)
|
||||
{
|
||||
Real demod = sqrt(magsq);
|
||||
|
||||
@ -208,6 +208,7 @@ bool AMDemod::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();
|
||||
|
||||
apply();
|
||||
|
||||
@ -215,7 +216,8 @@ bool AMDemod::handleMessage(const Message& cmd)
|
||||
<< " 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;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -265,4 +267,5 @@ void AMDemod::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;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
AMDemod();
|
||||
~AMDemod();
|
||||
|
||||
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 audioMute);
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
virtual void start();
|
||||
@ -52,10 +52,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 MsgConfigureAMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch)
|
||||
static MsgConfigureAMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioMute)
|
||||
{
|
||||
return new MsgConfigureAMDemod(rfBandwidth, afBandwidth, volume, squelch);
|
||||
return new MsgConfigureAMDemod(rfBandwidth, afBandwidth, volume, squelch, audioMute);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -63,13 +64,15 @@ private:
|
||||
Real m_afBandwidth;
|
||||
Real m_volume;
|
||||
Real m_squelch;
|
||||
bool m_audioMute;
|
||||
|
||||
MsgConfigureAMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) :
|
||||
MsgConfigureAMDemod(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)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -92,6 +95,7 @@ private:
|
||||
Real m_squelch;
|
||||
Real m_volume;
|
||||
quint32 m_audioSampleRate;
|
||||
bool m_audioMute;
|
||||
|
||||
Config() :
|
||||
m_inputSampleRate(-1),
|
||||
@ -100,7 +104,8 @@ private:
|
||||
m_afBandwidth(-1),
|
||||
m_squelch(0),
|
||||
m_volume(0),
|
||||
m_audioSampleRate(0)
|
||||
m_audioSampleRate(0),
|
||||
m_audioMute(false)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -179,6 +179,10 @@ void AMDemodGUI::on_squelch_valueChanged(int value)
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMDemodGUI::on_audioMute_toggled(bool checked)
|
||||
{
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
{
|
||||
@ -263,7 +267,8 @@ void AMDemodGUI::applySettings()
|
||||
m_rfBW[ui->rfBW->value()],
|
||||
ui->afBW->value() * 1000.0,
|
||||
ui->volume->value() / 10.0,
|
||||
ui->squelch->value());
|
||||
ui->squelch->value(),
|
||||
ui->audioMute->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,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();
|
||||
|
@ -139,6 +139,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user