mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Make CTCSS processing conditional to GUI checkbox
This commit is contained in:
parent
952a2b39ed
commit
f5021f5b9e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
CMakeLists.txt.user*
|
CMakeLists.txt.user*
|
||||||
build/*
|
build/*
|
||||||
qtbuild/*
|
qtbuild/*
|
||||||
|
sdriq/*
|
||||||
LOCAL/*
|
LOCAL/*
|
||||||
sdrangelove.supp
|
sdrangelove.supp
|
||||||
.cproject
|
.cproject
|
||||||
|
@ -46,6 +46,7 @@ NFMDemod::NFMDemod() :
|
|||||||
m_config.m_afBandwidth = 3000;
|
m_config.m_afBandwidth = 3000;
|
||||||
m_config.m_squelch = -30.0;
|
m_config.m_squelch = -30.0;
|
||||||
m_config.m_volume = 2.0;
|
m_config.m_volume = 2.0;
|
||||||
|
m_config.m_ctcssOn = false;
|
||||||
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
@ -70,9 +71,18 @@ NFMDemod::~NFMDemod()
|
|||||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch)
|
void NFMDemod::configure(MessageQueue* messageQueue,
|
||||||
|
Real rfBandwidth,
|
||||||
|
Real afBandwidth,
|
||||||
|
Real volume,
|
||||||
|
Real squelch,
|
||||||
|
bool ctcssOn)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgConfigureNFMDemod::create(rfBandwidth, afBandwidth, volume, squelch);
|
Message* cmd = MsgConfigureNFMDemod::create(rfBandwidth,
|
||||||
|
afBandwidth,
|
||||||
|
volume,
|
||||||
|
squelch,
|
||||||
|
ctcssOn);
|
||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,6 +180,8 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_squelchOpen)
|
if (m_squelchOpen)
|
||||||
|
{
|
||||||
|
if (m_running.m_ctcssOn)
|
||||||
{
|
{
|
||||||
Real ctcss_sample = m_lowpass.filter(demod);
|
Real ctcss_sample = m_lowpass.filter(demod);
|
||||||
|
|
||||||
@ -197,8 +209,9 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ctcssIndexSelected && (m_ctcssIndexSelected != m_ctcssIndex))
|
if (m_running.m_ctcssOn && m_ctcssIndexSelected && (m_ctcssIndexSelected != m_ctcssIndex))
|
||||||
{
|
{
|
||||||
sample = 0;
|
sample = 0;
|
||||||
}
|
}
|
||||||
@ -297,13 +310,15 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
|||||||
m_config.m_afBandwidth = cfg.getAFBandwidth();
|
m_config.m_afBandwidth = cfg.getAFBandwidth();
|
||||||
m_config.m_volume = cfg.getVolume();
|
m_config.m_volume = cfg.getVolume();
|
||||||
m_config.m_squelch = cfg.getSquelch();
|
m_config.m_squelch = cfg.getSquelch();
|
||||||
|
m_config.m_ctcssOn = cfg.getCtcssOn();
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
|
|
||||||
qDebug() << " - MsgConfigureNFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
|
qDebug() << " - MsgConfigureNFMDemod: m_rfBandwidth: " << m_config.m_rfBandwidth
|
||||||
<< " m_afBandwidth: " << m_config.m_afBandwidth
|
<< " m_afBandwidth: " << m_config.m_afBandwidth
|
||||||
<< " m_volume: " << m_config.m_volume
|
<< " m_volume: " << m_config.m_volume
|
||||||
<< " m_squelch: " << m_config.m_squelch;
|
<< " m_squelch: " << m_config.m_squelch
|
||||||
|
<< " m_ctcssOn: " << m_config.m_ctcssOn;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -355,4 +370,5 @@ void NFMDemod::apply()
|
|||||||
m_running.m_squelch = m_config.m_squelch;
|
m_running.m_squelch = m_config.m_squelch;
|
||||||
m_running.m_volume = m_config.m_volume;
|
m_running.m_volume = m_config.m_volume;
|
||||||
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
|
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
|
||||||
|
m_running.m_ctcssOn = m_config.m_ctcssOn;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,12 @@ public:
|
|||||||
NFMDemod();
|
NFMDemod();
|
||||||
~NFMDemod();
|
~NFMDemod();
|
||||||
|
|
||||||
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 ctcssOn);
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
@ -68,10 +73,15 @@ private:
|
|||||||
Real getAFBandwidth() const { return m_afBandwidth; }
|
Real getAFBandwidth() const { return m_afBandwidth; }
|
||||||
Real getVolume() const { return m_volume; }
|
Real getVolume() const { return m_volume; }
|
||||||
Real getSquelch() const { return m_squelch; }
|
Real getSquelch() const { return m_squelch; }
|
||||||
|
bool getCtcssOn() const { return m_ctcssOn; }
|
||||||
|
|
||||||
static MsgConfigureNFMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch)
|
static MsgConfigureNFMDemod* create(Real rfBandwidth,
|
||||||
|
Real afBandwidth,
|
||||||
|
Real volume,
|
||||||
|
Real squelch,
|
||||||
|
bool ctcssOn)
|
||||||
{
|
{
|
||||||
return new MsgConfigureNFMDemod(rfBandwidth, afBandwidth, volume, squelch);
|
return new MsgConfigureNFMDemod(rfBandwidth, afBandwidth, volume, squelch, ctcssOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -79,13 +89,19 @@ private:
|
|||||||
Real m_afBandwidth;
|
Real m_afBandwidth;
|
||||||
Real m_volume;
|
Real m_volume;
|
||||||
Real m_squelch;
|
Real m_squelch;
|
||||||
|
bool m_ctcssOn;
|
||||||
|
|
||||||
MsgConfigureNFMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch) :
|
MsgConfigureNFMDemod(Real rfBandwidth,
|
||||||
|
Real afBandwidth,
|
||||||
|
Real volume,
|
||||||
|
Real squelch,
|
||||||
|
bool ctcssOn) :
|
||||||
Message(),
|
Message(),
|
||||||
m_rfBandwidth(rfBandwidth),
|
m_rfBandwidth(rfBandwidth),
|
||||||
m_afBandwidth(afBandwidth),
|
m_afBandwidth(afBandwidth),
|
||||||
m_volume(volume),
|
m_volume(volume),
|
||||||
m_squelch(squelch)
|
m_squelch(squelch),
|
||||||
|
m_ctcssOn(ctcssOn)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,6 +123,7 @@ private:
|
|||||||
Real m_afBandwidth;
|
Real m_afBandwidth;
|
||||||
Real m_squelch;
|
Real m_squelch;
|
||||||
Real m_volume;
|
Real m_volume;
|
||||||
|
bool m_ctcssOn;
|
||||||
int m_ctcssIndex;
|
int m_ctcssIndex;
|
||||||
quint32 m_audioSampleRate;
|
quint32 m_audioSampleRate;
|
||||||
|
|
||||||
@ -117,6 +134,7 @@ private:
|
|||||||
m_afBandwidth(-1),
|
m_afBandwidth(-1),
|
||||||
m_squelch(0),
|
m_squelch(0),
|
||||||
m_volume(0),
|
m_volume(0),
|
||||||
|
m_ctcssOn(false),
|
||||||
m_ctcssIndex(0),
|
m_ctcssIndex(0),
|
||||||
m_audioSampleRate(0)
|
m_audioSampleRate(0)
|
||||||
{ }
|
{ }
|
||||||
|
@ -52,6 +52,7 @@ void NFMDemodGUI::resetToDefaults()
|
|||||||
ui->volume->setValue(20);
|
ui->volume->setValue(20);
|
||||||
ui->squelch->setValue(-40);
|
ui->squelch->setValue(-40);
|
||||||
ui->deltaFrequency->setValue(0);
|
ui->deltaFrequency->setValue(0);
|
||||||
|
ui->ctcssOn->setChecked(false);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
applySettings();
|
applySettings();
|
||||||
@ -67,6 +68,7 @@ QByteArray NFMDemodGUI::serialize() const
|
|||||||
s.writeS32(5, ui->squelch->value());
|
s.writeS32(5, ui->squelch->value());
|
||||||
s.writeU32(7, m_channelMarker.getColor().rgb());
|
s.writeU32(7, m_channelMarker.getColor().rgb());
|
||||||
s.writeS32(8, ui->ctcss->currentIndex());
|
s.writeS32(8, ui->ctcss->currentIndex());
|
||||||
|
s.writeBool(9, ui->ctcssOn->isChecked());
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +87,7 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
|
|||||||
QByteArray bytetmp;
|
QByteArray bytetmp;
|
||||||
quint32 u32tmp;
|
quint32 u32tmp;
|
||||||
qint32 tmp;
|
qint32 tmp;
|
||||||
|
bool boolTmp;
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
@ -108,6 +111,9 @@ bool NFMDemodGUI::deserialize(const QByteArray& data)
|
|||||||
d.readS32(8, &tmp, 0);
|
d.readS32(8, &tmp, 0);
|
||||||
ui->ctcss->setCurrentIndex(tmp);
|
ui->ctcss->setCurrentIndex(tmp);
|
||||||
|
|
||||||
|
d.readBool(9, &boolTmp, false);
|
||||||
|
ui->ctcssOn->setChecked(boolTmp);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
|
|
||||||
@ -179,6 +185,12 @@ void NFMDemodGUI::on_squelch_valueChanged(int value)
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NFMDemodGUI::on_ctcssOn_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_ctcssOn = checked;
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index)
|
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (m_nfmDemod != 0)
|
if (m_nfmDemod != 0)
|
||||||
@ -280,7 +292,8 @@ void NFMDemodGUI::applySettings()
|
|||||||
m_rfBW[ui->rfBW->value()],
|
m_rfBW[ui->rfBW->value()],
|
||||||
ui->afBW->value() * 1000.0,
|
ui->afBW->value() * 1000.0,
|
||||||
ui->volume->value() / 10.0,
|
ui->volume->value() / 10.0,
|
||||||
ui->squelch->value());
|
ui->squelch->value(),
|
||||||
|
ui->ctcssOn->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ private slots:
|
|||||||
void on_volume_valueChanged(int value);
|
void on_volume_valueChanged(int value);
|
||||||
void on_squelch_valueChanged(int value);
|
void on_squelch_valueChanged(int value);
|
||||||
void on_ctcss_currentIndexChanged(int index);
|
void on_ctcss_currentIndexChanged(int index);
|
||||||
|
void on_ctcssOn_toggled(bool checked);
|
||||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||||
void onMenuDoubleClicked();
|
void onMenuDoubleClicked();
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ private:
|
|||||||
ThreadedSampleSink* m_threadedChannelizer;
|
ThreadedSampleSink* m_threadedChannelizer;
|
||||||
Channelizer* m_channelizer;
|
Channelizer* m_channelizer;
|
||||||
NFMDemod* m_nfmDemod;
|
NFMDemod* m_nfmDemod;
|
||||||
|
bool m_ctcssOn;
|
||||||
|
|
||||||
static const int m_rfBW[];
|
static const int m_rfBW[];
|
||||||
|
|
||||||
|
@ -41,7 +41,34 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="3" column="1">
|
<item row="5" column="4">
|
||||||
|
<layout class="QHBoxLayout" name="CTCSSblock">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="ctcssOn">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Activate CTCSS</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="ctcss">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Set CTCSS Frequency</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="4">
|
||||||
<widget class="QSlider" name="volume">
|
<widget class="QSlider" name="volume">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
@ -54,7 +81,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="4">
|
||||||
<widget class="QSlider" name="rfBW">
|
<widget class="QSlider" name="rfBW">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
@ -101,7 +128,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="4">
|
||||||
<widget class="QSlider" name="squelch">
|
<widget class="QSlider" name="squelch">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-60</number>
|
<number>-60</number>
|
||||||
@ -120,7 +147,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="volumeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Volume</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
<widget class="QLabel" name="rfBWText">
|
<widget class="QLabel" name="rfBWText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -136,7 +170,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="6">
|
||||||
<widget class="QLabel" name="afBWText">
|
<widget class="QLabel" name="afBWText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -152,14 +186,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="4">
|
||||||
<widget class="QLabel" name="volumeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Volume</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSlider" name="afBW">
|
<widget class="QSlider" name="afBW">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
@ -178,7 +205,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="4" column="6">
|
||||||
<widget class="QLabel" name="squelchText">
|
<widget class="QLabel" name="squelchText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -194,7 +221,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="3" column="6">
|
||||||
<widget class="QLabel" name="volumeText">
|
<widget class="QLabel" name="volumeText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -210,7 +237,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="6">
|
||||||
<widget class="QLabel" name="deltaUnits">
|
<widget class="QLabel" name="deltaUnits">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hz</string>
|
<string>Hz</string>
|
||||||
@ -220,7 +247,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="ctcssLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>CTCSS</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
<widget class="ValueDial" name="deltaFrequency" native="true">
|
<widget class="ValueDial" name="deltaFrequency" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
@ -251,21 +285,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="6">
|
||||||
<widget class="QLabel" name="ctcssLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>CTCSS</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QComboBox" name="ctcss">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Set CTCSS</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QLabel" name="ctcssText">
|
<widget class="QLabel" name="ctcssText">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>CTCSS detected</string>
|
<string>CTCSS detected</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user