1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

SSB demod: implement audio mute button squelch light indicator

This commit is contained in:
f4exb 2017-07-26 01:44:57 +02:00
parent 52eb869b7c
commit 8452985061
5 changed files with 26 additions and 7 deletions

View File

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

View File

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

View File

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

View File

@ -72,6 +72,7 @@ private:
bool m_dsb;
bool m_audioMute;
MovingAverage<double> m_channelPowerDbAvg;
bool m_squelchOpen;
ThreadedBasebandSampleSink* m_threadedChannelizer;
DownChannelizer* m_channelizer;

View File

@ -521,7 +521,7 @@
</size>
</property>
<property name="toolTip">
<string>AGC power threshold (dB)</string>
<string>Power threshold (dB)</string>
</property>
<property name="minimum">
<number>-99</number>
@ -546,7 +546,7 @@
</size>
</property>
<property name="toolTip">
<string>AGC power threshold (dB)</string>
<string>Power threshold (dB)</string>
</property>
<property name="text">
<string>-00</string>
@ -565,7 +565,7 @@
</size>
</property>
<property name="toolTip">
<string>Set threshiold gate (ms)</string>
<string>Power threshiold gate (ms)</string>
</property>
<property name="maximum">
<number>20</number>
@ -587,7 +587,7 @@
</size>
</property>
<property name="toolTip">
<string>Threshiold gate (ms)</string>
<string>Power threshiold gate (ms)</string>
</property>
<property name="text">
<string>00</string>