mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 14:47:50 -04:00
NFM demod: pass CTCSS index via message
This commit is contained in:
parent
f8fe5e2e13
commit
531ab992f3
@ -63,6 +63,7 @@ NFMDemod::NFMDemod() :
|
|||||||
m_config.m_squelch = -30.0;
|
m_config.m_squelch = -30.0;
|
||||||
m_config.m_volume = 1.0;
|
m_config.m_volume = 1.0;
|
||||||
m_config.m_ctcssOn = false;
|
m_config.m_ctcssOn = false;
|
||||||
|
m_config.m_ctcssIndex = 0;
|
||||||
m_config.m_audioMute = false;
|
m_config.m_audioMute = false;
|
||||||
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
m_config.m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ void NFMDemod::configure(MessageQueue* messageQueue,
|
|||||||
int squelchGate,
|
int squelchGate,
|
||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
|
int ctcssIndex,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool copyAudioToUDP,
|
bool copyAudioToUDP,
|
||||||
@ -109,6 +111,7 @@ void NFMDemod::configure(MessageQueue* messageQueue,
|
|||||||
squelchGate,
|
squelchGate,
|
||||||
deltaSquelch,
|
deltaSquelch,
|
||||||
squelch,
|
squelch,
|
||||||
|
ctcssIndex,
|
||||||
ctcssOn,
|
ctcssOn,
|
||||||
audioMute,
|
audioMute,
|
||||||
copyAudioToUDP,
|
copyAudioToUDP,
|
||||||
@ -390,6 +393,7 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
|||||||
m_config.m_squelchGate = cfg.getSquelchGate();
|
m_config.m_squelchGate = cfg.getSquelchGate();
|
||||||
m_config.m_deltaSquelch = cfg.getDeltaSquelch();
|
m_config.m_deltaSquelch = cfg.getDeltaSquelch();
|
||||||
m_config.m_squelch = cfg.getSquelch();
|
m_config.m_squelch = cfg.getSquelch();
|
||||||
|
m_config.m_ctcssIndex = cfg.getCtcssIndex();
|
||||||
m_config.m_ctcssOn = cfg.getCtcssOn();
|
m_config.m_ctcssOn = cfg.getCtcssOn();
|
||||||
m_config.m_audioMute = cfg.getAudioMute();
|
m_config.m_audioMute = cfg.getAudioMute();
|
||||||
m_config.m_copyAudioToUDP = cfg.getCopyAudioToUDP();
|
m_config.m_copyAudioToUDP = cfg.getCopyAudioToUDP();
|
||||||
@ -405,6 +409,7 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
|||||||
<< " m_squelchGate: " << m_config.m_squelchGate
|
<< " m_squelchGate: " << m_config.m_squelchGate
|
||||||
<< " m_deltaSquelch: " << m_config.m_deltaSquelch
|
<< " m_deltaSquelch: " << m_config.m_deltaSquelch
|
||||||
<< " m_squelch: " << m_squelchLevel
|
<< " m_squelch: " << m_squelchLevel
|
||||||
|
<< " m_ctcssIndex: " << m_config.m_ctcssIndex
|
||||||
<< " m_ctcssOn: " << m_config.m_ctcssOn
|
<< " m_ctcssOn: " << m_config.m_ctcssOn
|
||||||
<< " m_audioMute: " << m_config.m_audioMute
|
<< " m_audioMute: " << m_config.m_audioMute
|
||||||
<< " m_copyAudioToUDP: " << m_config.m_copyAudioToUDP
|
<< " m_copyAudioToUDP: " << m_config.m_copyAudioToUDP
|
||||||
@ -483,5 +488,10 @@ void NFMDemod::apply(bool force)
|
|||||||
m_udpBufferAudio->setPort(m_config.m_udpPort);
|
m_udpBufferAudio->setPort(m_config.m_udpPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_config.m_ctcssIndex != m_running.m_ctcssIndex) || force)
|
||||||
|
{
|
||||||
|
setSelectedCtcssIndex(m_config.m_ctcssIndex);
|
||||||
|
}
|
||||||
|
|
||||||
m_running = m_config;
|
m_running = m_config;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
int squelchGate,
|
int squelchGate,
|
||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
|
int ctcssIndex,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool copyAudioToUDP,
|
bool copyAudioToUDP,
|
||||||
@ -99,6 +100,7 @@ private:
|
|||||||
int getSquelchGate() const { return m_squelchGate; }
|
int getSquelchGate() const { return m_squelchGate; }
|
||||||
bool getDeltaSquelch() const { return m_deltaSquelch; }
|
bool getDeltaSquelch() const { return m_deltaSquelch; }
|
||||||
Real getSquelch() const { return m_squelch; }
|
Real getSquelch() const { return m_squelch; }
|
||||||
|
int getCtcssIndex() const { return m_ctcssIndex; }
|
||||||
bool getCtcssOn() const { return m_ctcssOn; }
|
bool getCtcssOn() const { return m_ctcssOn; }
|
||||||
bool getAudioMute() const { return m_audioMute; }
|
bool getAudioMute() const { return m_audioMute; }
|
||||||
bool getCopyAudioToUDP() const { return m_copyAudioToUDP; }
|
bool getCopyAudioToUDP() const { return m_copyAudioToUDP; }
|
||||||
@ -113,6 +115,7 @@ private:
|
|||||||
int squelchGate,
|
int squelchGate,
|
||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
|
int ctcssIndex,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool copyAudioToUDP,
|
bool copyAudioToUDP,
|
||||||
@ -128,6 +131,7 @@ private:
|
|||||||
squelchGate,
|
squelchGate,
|
||||||
deltaSquelch,
|
deltaSquelch,
|
||||||
squelch,
|
squelch,
|
||||||
|
ctcssIndex,
|
||||||
ctcssOn,
|
ctcssOn,
|
||||||
audioMute,
|
audioMute,
|
||||||
copyAudioToUDP,
|
copyAudioToUDP,
|
||||||
@ -144,6 +148,7 @@ private:
|
|||||||
int m_squelchGate;
|
int m_squelchGate;
|
||||||
bool m_deltaSquelch;
|
bool m_deltaSquelch;
|
||||||
Real m_squelch;
|
Real m_squelch;
|
||||||
|
int m_ctcssIndex;
|
||||||
bool m_ctcssOn;
|
bool m_ctcssOn;
|
||||||
bool m_audioMute;
|
bool m_audioMute;
|
||||||
bool m_copyAudioToUDP;
|
bool m_copyAudioToUDP;
|
||||||
@ -158,6 +163,7 @@ private:
|
|||||||
int squelchGate,
|
int squelchGate,
|
||||||
bool deltaSquelch,
|
bool deltaSquelch,
|
||||||
Real squelch,
|
Real squelch,
|
||||||
|
int ctcssIndex,
|
||||||
bool ctcssOn,
|
bool ctcssOn,
|
||||||
bool audioMute,
|
bool audioMute,
|
||||||
bool copyAudioToUDP,
|
bool copyAudioToUDP,
|
||||||
@ -172,6 +178,7 @@ private:
|
|||||||
m_squelchGate(squelchGate),
|
m_squelchGate(squelchGate),
|
||||||
m_deltaSquelch(deltaSquelch),
|
m_deltaSquelch(deltaSquelch),
|
||||||
m_squelch(squelch),
|
m_squelch(squelch),
|
||||||
|
m_ctcssIndex(ctcssIndex),
|
||||||
m_ctcssOn(ctcssOn),
|
m_ctcssOn(ctcssOn),
|
||||||
m_audioMute(audioMute),
|
m_audioMute(audioMute),
|
||||||
m_copyAudioToUDP(copyAudioToUDP),
|
m_copyAudioToUDP(copyAudioToUDP),
|
||||||
|
@ -268,11 +268,8 @@ void NFMDemodGUI::on_copyAudioToUDP_toggled(bool checked)
|
|||||||
|
|
||||||
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index)
|
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (m_nfmDemod != 0)
|
|
||||||
{
|
|
||||||
m_nfmDemod->setSelectedCtcssIndex(index);
|
|
||||||
}
|
|
||||||
m_settings.m_ctcssIndex = index;
|
m_settings.m_ctcssIndex = index;
|
||||||
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFMDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
|
void NFMDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
|
||||||
@ -304,13 +301,6 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
blockApplySettings(true);
|
|
||||||
ui->rfBW->clear();
|
|
||||||
for (int i = 0; i < m_nbRfBW; i++) {
|
|
||||||
ui->rfBW->addItem(QString("%1").arg(m_rfBW[i] / 1000.0, 0, 'f', 2));
|
|
||||||
}
|
|
||||||
blockApplySettings(false);
|
|
||||||
|
|
||||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||||
|
|
||||||
@ -319,6 +309,14 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
|
|
||||||
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
|
blockApplySettings(true);
|
||||||
|
|
||||||
|
ui->rfBW->clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nbRfBW; i++) {
|
||||||
|
ui->rfBW->addItem(QString("%1").arg(m_rfBW[i] / 1000.0, 0, 'f', 2));
|
||||||
|
}
|
||||||
|
|
||||||
int ctcss_nbTones;
|
int ctcss_nbTones;
|
||||||
const Real *ctcss_tones = m_nfmDemod->getCtcssToneSet(ctcss_nbTones);
|
const Real *ctcss_tones = m_nfmDemod->getCtcssToneSet(ctcss_nbTones);
|
||||||
|
|
||||||
@ -329,6 +327,8 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
|
|||||||
ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i]));
|
ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockApplySettings(false);
|
||||||
|
|
||||||
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); // squelch closed
|
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); // squelch closed
|
||||||
|
|
||||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||||
@ -396,6 +396,7 @@ void NFMDemodGUI::applySettings(bool force)
|
|||||||
m_settings.m_squelchGate, // in 10ths of ms 1 -> 50
|
m_settings.m_squelchGate, // in 10ths of ms 1 -> 50
|
||||||
m_settings.m_deltaSquelch,
|
m_settings.m_deltaSquelch,
|
||||||
m_settings.m_squelch, // -1000 -> 0
|
m_settings.m_squelch, // -1000 -> 0
|
||||||
|
m_settings.m_ctcssIndex,
|
||||||
m_settings.m_ctcssOn,
|
m_settings.m_ctcssOn,
|
||||||
m_settings.m_audioMute,
|
m_settings.m_audioMute,
|
||||||
m_settings.m_copyAudioToUDP,
|
m_settings.m_copyAudioToUDP,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user