mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 18:43:28 -05:00
WDSP receiver: implemented squelch
This commit is contained in:
parent
07e179c196
commit
8dd46a08ea
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QRecursiveMutex>
|
|
||||||
|
|
||||||
#include "dsp/mimochannel.h"
|
#include "dsp/mimochannel.h"
|
||||||
#include "dsp/spectrumvis.h"
|
#include "dsp/spectrumvis.h"
|
||||||
@ -186,7 +185,7 @@ private:
|
|||||||
ScopeVis m_scopeSink;
|
ScopeVis m_scopeSink;
|
||||||
QThread *m_thread;
|
QThread *m_thread;
|
||||||
InterferometerBaseband* m_basebandSink;
|
InterferometerBaseband* m_basebandSink;
|
||||||
QRecursiveMutex m_mutex;
|
QMutex m_mutex;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
InterferometerSettings m_settings;
|
InterferometerSettings m_settings;
|
||||||
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
|
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
|
||||||
|
@ -22,6 +22,7 @@ WDSPRxDNRDialog::WDSPRxDNRDialog(QWidget* parent) :
|
|||||||
ui(new Ui::WDSPRxDNRDialog)
|
ui(new Ui::WDSPRxDNRDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->snb->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
WDSPRxDNRDialog::~WDSPRxDNRDialog()
|
WDSPRxDNRDialog::~WDSPRxDNRDialog()
|
||||||
@ -29,6 +30,14 @@ WDSPRxDNRDialog::~WDSPRxDNRDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WDSPRxDNRDialog::setSNB(bool snb)
|
||||||
|
{
|
||||||
|
ui->snb->blockSignals(true);
|
||||||
|
ui->snb->setChecked(snb);
|
||||||
|
ui->snb->blockSignals(false);
|
||||||
|
m_snb = snb;
|
||||||
|
}
|
||||||
|
|
||||||
void WDSPRxDNRDialog::setANF(bool anf)
|
void WDSPRxDNRDialog::setANF(bool anf)
|
||||||
{
|
{
|
||||||
ui->anf->blockSignals(true);
|
ui->anf->blockSignals(true);
|
||||||
@ -77,6 +86,12 @@ void WDSPRxDNRDialog::setNR2ArtifactReduction(bool nr2ArtifactReducion)
|
|||||||
m_nr2ArtifactReduction = nr2ArtifactReducion;
|
m_nr2ArtifactReduction = nr2ArtifactReducion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WDSPRxDNRDialog::on_snb_clicked(bool checked)
|
||||||
|
{
|
||||||
|
m_snb = checked;
|
||||||
|
emit valueChanged(ChangedSNB);
|
||||||
|
}
|
||||||
|
|
||||||
void WDSPRxDNRDialog::on_anf_clicked(bool checked)
|
void WDSPRxDNRDialog::on_anf_clicked(bool checked)
|
||||||
{
|
{
|
||||||
m_anf = checked;
|
m_anf = checked;
|
||||||
|
@ -30,6 +30,7 @@ class SDRGUI_API WDSPRxDNRDialog : public QDialog {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum ValueChanged {
|
enum ValueChanged {
|
||||||
|
ChangedSNB,
|
||||||
ChangedANF,
|
ChangedANF,
|
||||||
ChangedNR,
|
ChangedNR,
|
||||||
ChangedNR2Gain,
|
ChangedNR2Gain,
|
||||||
@ -41,6 +42,7 @@ public:
|
|||||||
explicit WDSPRxDNRDialog(QWidget* parent = nullptr);
|
explicit WDSPRxDNRDialog(QWidget* parent = nullptr);
|
||||||
~WDSPRxDNRDialog();
|
~WDSPRxDNRDialog();
|
||||||
|
|
||||||
|
void setSNB(bool snb);
|
||||||
void setANF(bool anf);
|
void setANF(bool anf);
|
||||||
void setNRScheme(WDSPRxProfile::WDSPRxNRScheme scheme);
|
void setNRScheme(WDSPRxProfile::WDSPRxNRScheme scheme);
|
||||||
void setNR2Gain(WDSPRxProfile::WDSPRxNR2Gain gain);
|
void setNR2Gain(WDSPRxProfile::WDSPRxNR2Gain gain);
|
||||||
@ -48,6 +50,7 @@ public:
|
|||||||
void setNRPosition(WDSPRxProfile::WDSPRxNRPosition position);
|
void setNRPosition(WDSPRxProfile::WDSPRxNRPosition position);
|
||||||
void setNR2ArtifactReduction(bool nr2ArtifactReducion);
|
void setNR2ArtifactReduction(bool nr2ArtifactReducion);
|
||||||
|
|
||||||
|
bool getSNB() const { return m_snb; }
|
||||||
bool getANF() const { return m_anf; }
|
bool getANF() const { return m_anf; }
|
||||||
WDSPRxProfile::WDSPRxNRScheme getNRScheme() const { return m_nrScheme; }
|
WDSPRxProfile::WDSPRxNRScheme getNRScheme() const { return m_nrScheme; }
|
||||||
WDSPRxProfile::WDSPRxNR2Gain getNR2Gain() const { return m_nr2Gain; }
|
WDSPRxProfile::WDSPRxNR2Gain getNR2Gain() const { return m_nr2Gain; }
|
||||||
@ -60,6 +63,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::WDSPRxDNRDialog *ui;
|
Ui::WDSPRxDNRDialog *ui;
|
||||||
|
bool m_snb;
|
||||||
bool m_anf;
|
bool m_anf;
|
||||||
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
|
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
|
||||||
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
|
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
|
||||||
@ -68,6 +72,7 @@ private:
|
|||||||
bool m_nr2ArtifactReduction;
|
bool m_nr2ArtifactReduction;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_snb_clicked(bool checked);
|
||||||
void on_anf_clicked(bool checked);
|
void on_anf_clicked(bool checked);
|
||||||
void on_nr_currentIndexChanged(int index);
|
void on_nr_currentIndexChanged(int index);
|
||||||
void on_nr2Gain_currentIndexChanged(int index);
|
void on_nr2Gain_currentIndexChanged(int index);
|
||||||
|
@ -40,6 +40,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="snb">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Spectral Noise Blanker</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>SNB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="anf">
|
<widget class="QCheckBox" name="anf">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -318,6 +318,7 @@ void WDSPRxGUI::on_profileIndex_valueChanged(int value)
|
|||||||
m_settings.m_nbAvgTime = m_settings.m_profiles[m_settings.m_profileIndex].m_nbAvgTime;
|
m_settings.m_nbAvgTime = m_settings.m_profiles[m_settings.m_profileIndex].m_nbAvgTime;
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
m_settings.m_dnr = m_settings.m_profiles[m_settings.m_profileIndex].m_dnr;
|
m_settings.m_dnr = m_settings.m_profiles[m_settings.m_profileIndex].m_dnr;
|
||||||
|
m_settings.m_snb = m_settings.m_profiles[m_settings.m_profileIndex].m_snb;
|
||||||
m_settings.m_anf = m_settings.m_profiles[m_settings.m_profileIndex].m_anf;
|
m_settings.m_anf = m_settings.m_profiles[m_settings.m_profileIndex].m_anf;
|
||||||
m_settings.m_nrScheme = m_settings.m_profiles[m_settings.m_profileIndex].m_nrScheme;
|
m_settings.m_nrScheme = m_settings.m_profiles[m_settings.m_profileIndex].m_nrScheme;
|
||||||
m_settings.m_nr2Gain = m_settings.m_profiles[m_settings.m_profileIndex].m_nr2Gain;
|
m_settings.m_nr2Gain = m_settings.m_profiles[m_settings.m_profileIndex].m_nr2Gain;
|
||||||
@ -946,6 +947,7 @@ void WDSPRxGUI::dnrSetupDialog(const QPoint& p)
|
|||||||
{
|
{
|
||||||
m_dnrDialog = new WDSPRxDNRDialog();
|
m_dnrDialog = new WDSPRxDNRDialog();
|
||||||
m_dnrDialog->move(p);
|
m_dnrDialog->move(p);
|
||||||
|
m_dnrDialog->setSNB(m_settings.m_snb);
|
||||||
m_dnrDialog->setANF(m_settings.m_anf);
|
m_dnrDialog->setANF(m_settings.m_anf);
|
||||||
m_dnrDialog->setNRScheme(m_settings.m_nrScheme);
|
m_dnrDialog->setNRScheme(m_settings.m_nrScheme);
|
||||||
m_dnrDialog->setNR2Gain(m_settings.m_nr2Gain);
|
m_dnrDialog->setNR2Gain(m_settings.m_nr2Gain);
|
||||||
@ -969,6 +971,11 @@ void WDSPRxGUI::dnrSetup(int32_t iValueChanged)
|
|||||||
|
|
||||||
switch (valueChanged)
|
switch (valueChanged)
|
||||||
{
|
{
|
||||||
|
case WDSPRxDNRDialog::ValueChanged::ChangedSNB:
|
||||||
|
m_settings.m_snb = m_dnrDialog->getSNB();
|
||||||
|
m_settings.m_profiles[m_settings.m_profileIndex].m_snb = m_settings.m_snb;
|
||||||
|
applySettings();
|
||||||
|
break;
|
||||||
case WDSPRxDNRDialog::ValueChanged::ChangedANF:
|
case WDSPRxDNRDialog::ValueChanged::ChangedANF:
|
||||||
m_settings.m_anf = m_dnrDialog->getANF();
|
m_settings.m_anf = m_dnrDialog->getANF();
|
||||||
m_settings.m_profiles[m_settings.m_profileIndex].m_anf = m_settings.m_anf;
|
m_settings.m_profiles[m_settings.m_profileIndex].m_anf = m_settings.m_anf;
|
||||||
|
@ -63,6 +63,7 @@ void WDSPRxSettings::resetToDefaults()
|
|||||||
m_nbAvgTime = 50.0;
|
m_nbAvgTime = 50.0;
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
m_dnr = false;
|
m_dnr = false;
|
||||||
|
m_snb = false;
|
||||||
m_anf = false;
|
m_anf = false;
|
||||||
m_nrScheme = WDSPRxProfile::NRSchemeNR;
|
m_nrScheme = WDSPRxProfile::NRSchemeNR;
|
||||||
m_nr2Gain = WDSPRxProfile::NR2GainGamma;
|
m_nr2Gain = WDSPRxProfile::NR2GainGamma;
|
||||||
@ -138,6 +139,7 @@ QByteArray WDSPRxSettings::serialize() const
|
|||||||
s.writeDouble(27, m_nbAvgTime);
|
s.writeDouble(27, m_nbAvgTime);
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
s.writeBool( 30, m_dnr);
|
s.writeBool( 30, m_dnr);
|
||||||
|
s.writeBool( 31, m_snb);
|
||||||
s.writeBool( 32, m_anf);
|
s.writeBool( 32, m_anf);
|
||||||
s.writeS32( 33, (int) m_nrScheme);
|
s.writeS32( 33, (int) m_nrScheme);
|
||||||
s.writeS32( 34, (int) m_nr2Gain);
|
s.writeS32( 34, (int) m_nr2Gain);
|
||||||
@ -160,9 +162,10 @@ QByteArray WDSPRxSettings::serialize() const
|
|||||||
// Squelch
|
// Squelch
|
||||||
s.writeBool( 60, m_squelch);
|
s.writeBool( 60, m_squelch);
|
||||||
s.writeS32( 61, m_squelchThreshold);
|
s.writeS32( 61, m_squelchThreshold);
|
||||||
s.writeDouble(62, m_ssqlTauMute);
|
s.writeS32( 62, (int) m_squelchMode);
|
||||||
s.writeDouble(63, m_ssqlTauUnmute);
|
s.writeDouble(63, m_ssqlTauMute);
|
||||||
s.writeDouble(64, m_amsqMaxTail);
|
s.writeDouble(64, m_ssqlTauUnmute);
|
||||||
|
s.writeDouble(65, m_amsqMaxTail);
|
||||||
//
|
//
|
||||||
s.writeString(70, m_title);
|
s.writeString(70, m_title);
|
||||||
s.writeString(71, m_audioDeviceName);
|
s.writeString(71, m_audioDeviceName);
|
||||||
@ -207,6 +210,7 @@ QByteArray WDSPRxSettings::serialize() const
|
|||||||
s.writeDouble(127 + 100*i, m_profiles[i].m_nbAvgTime);
|
s.writeDouble(127 + 100*i, m_profiles[i].m_nbAvgTime);
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
s.writeBool (130 + 100*i, m_profiles[i].m_dnr);
|
s.writeBool (130 + 100*i, m_profiles[i].m_dnr);
|
||||||
|
s.writeBool (131 + 100*i, m_profiles[i].m_snb);
|
||||||
s.writeBool (132 + 100*i, m_profiles[i].m_anf);
|
s.writeBool (132 + 100*i, m_profiles[i].m_anf);
|
||||||
s.writeS32 (133 + 100*i, (int) m_profiles[i].m_nrScheme);
|
s.writeS32 (133 + 100*i, (int) m_profiles[i].m_nrScheme);
|
||||||
s.writeS32 (134 + 100*i, (int) m_profiles[i].m_nr2Gain);
|
s.writeS32 (134 + 100*i, (int) m_profiles[i].m_nr2Gain);
|
||||||
@ -229,9 +233,10 @@ QByteArray WDSPRxSettings::serialize() const
|
|||||||
// Squelch
|
// Squelch
|
||||||
s.writeBool( 160 + 100*i, m_profiles[i].m_squelch);
|
s.writeBool( 160 + 100*i, m_profiles[i].m_squelch);
|
||||||
s.writeS32( 161 + 100*i, m_profiles[i].m_squelchThreshold);
|
s.writeS32( 161 + 100*i, m_profiles[i].m_squelchThreshold);
|
||||||
s.writeDouble(162 + 100*i, m_profiles[i].m_ssqlTauMute);
|
s.writeS32( 162 + 100*i, (int) m_profiles[i].m_squelchMode);
|
||||||
s.writeDouble(163 + 100*i, m_profiles[i].m_ssqlTauUnmute);
|
s.writeDouble(163 + 100*i, m_profiles[i].m_ssqlTauMute);
|
||||||
s.writeDouble(164 + 100*i, m_profiles[i].m_amsqMaxTail);
|
s.writeDouble(164 + 100*i, m_profiles[i].m_ssqlTauUnmute);
|
||||||
|
s.writeDouble(165 + 100*i, m_profiles[i].m_amsqMaxTail);
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
@ -290,6 +295,7 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
|
|||||||
d.readDouble(27, &m_nbAvgTime, 50.0);
|
d.readDouble(27, &m_nbAvgTime, 50.0);
|
||||||
// Nosie reduction
|
// Nosie reduction
|
||||||
d.readBool( 30, &m_dnr, false);
|
d.readBool( 30, &m_dnr, false);
|
||||||
|
d.readBool( 31, &m_snb, false);
|
||||||
d.readBool( 32, &m_anf, false);
|
d.readBool( 32, &m_anf, false);
|
||||||
d.readS32( 33, &tmp, 2);
|
d.readS32( 33, &tmp, 2);
|
||||||
m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
||||||
@ -316,9 +322,11 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
|
|||||||
// Squelch
|
// Squelch
|
||||||
d.readBool( 60, &m_squelch, false);
|
d.readBool( 60, &m_squelch, false);
|
||||||
d.readS32( 61, &m_squelchThreshold, 3);
|
d.readS32( 61, &m_squelchThreshold, 3);
|
||||||
d.readDouble(62, &m_ssqlTauMute, 0.1);
|
d.readS32( 62, &tmp, 0);
|
||||||
d.readDouble(63, &m_ssqlTauUnmute, 0.1);
|
m_squelchMode = (WDSPRxProfile::WDSPRxSquelchMode) tmp;
|
||||||
d.readDouble(64, &m_amsqMaxTail, 1.5);
|
d.readDouble(63, &m_ssqlTauMute, 0.1);
|
||||||
|
d.readDouble(64, &m_ssqlTauUnmute, 0.1);
|
||||||
|
d.readDouble(65, &m_amsqMaxTail, 1.5);
|
||||||
//
|
//
|
||||||
d.readString(70, &m_title, "WDSP Receiver");
|
d.readString(70, &m_title, "WDSP Receiver");
|
||||||
d.readString(71, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
d.readString(71, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
||||||
@ -381,14 +389,15 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
|
|||||||
d.readDouble(127 + 100*i, &m_profiles[i].m_nbAvgTime, 50.0);
|
d.readDouble(127 + 100*i, &m_profiles[i].m_nbAvgTime, 50.0);
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
d.readBool (130 + 100*i, &m_profiles[i].m_dnr, false);
|
d.readBool (130 + 100*i, &m_profiles[i].m_dnr, false);
|
||||||
|
d.readBool (131 + 100*i, &m_profiles[i].m_snb, false);
|
||||||
d.readBool (132 + 100*i, &m_profiles[i].m_anf, false);
|
d.readBool (132 + 100*i, &m_profiles[i].m_anf, false);
|
||||||
d.readS32 (133 + 100*i, &tmp);
|
d.readS32 (133 + 100*i, &tmp, 0);
|
||||||
m_profiles[i].m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
m_profiles[i].m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
||||||
d.readS32 (134 + 100*i, &tmp);
|
d.readS32 (134 + 100*i, &tmp, 0);
|
||||||
m_profiles[i].m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp;
|
m_profiles[i].m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp;
|
||||||
d.readS32 (135 + 100*i, &tmp);
|
d.readS32 (135 + 100*i, &tmp, 0);
|
||||||
m_profiles[i].m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp;
|
m_profiles[i].m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp;
|
||||||
d.readS32 (136 + 100*i, &tmp);
|
d.readS32 (136 + 100*i, &tmp, 0);
|
||||||
m_profiles[i].m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp;
|
m_profiles[i].m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp;
|
||||||
d.readBool (137 + 100*i, &m_profiles[i].m_nr2ArtifactReduction);
|
d.readBool (137 + 100*i, &m_profiles[i].m_nr2ArtifactReduction);
|
||||||
// Demods
|
// Demods
|
||||||
@ -407,9 +416,11 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
|
|||||||
// Squelch
|
// Squelch
|
||||||
d.readBool( 160 + 100*i, &m_profiles[i].m_squelch, false);
|
d.readBool( 160 + 100*i, &m_profiles[i].m_squelch, false);
|
||||||
d.readS32( 161 + 100*i, &m_profiles[i].m_squelchThreshold, 3);
|
d.readS32( 161 + 100*i, &m_profiles[i].m_squelchThreshold, 3);
|
||||||
d.readDouble(161 + 100*i, &m_profiles[i].m_ssqlTauMute, 0.1);
|
d.readS32( 162 + 100*i, &tmp, 0);
|
||||||
d.readDouble(162 + 100*i, &m_profiles[i].m_ssqlTauUnmute, 0.1);
|
m_profiles[i].m_squelchMode = (WDSPRxProfile::WDSPRxSquelchMode) tmp;
|
||||||
d.readDouble(163 + 100*i, &m_profiles[i].m_amsqMaxTail, 1.5);
|
d.readDouble(163 + 100*i, &m_profiles[i].m_ssqlTauMute, 0.1);
|
||||||
|
d.readDouble(164 + 100*i, &m_profiles[i].m_ssqlTauUnmute, 0.1);
|
||||||
|
d.readDouble(165 + 100*i, &m_profiles[i].m_amsqMaxTail, 1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
422
plugins/channelrx/wdsprx/wdsprxsettings.cpp.orig
Normal file
422
plugins/channelrx/wdsprx/wdsprxsettings.cpp.orig
Normal file
@ -0,0 +1,422 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
#include "audio/audiodevicemanager.h"
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
#include "settings/serializable.h"
|
||||||
|
#include "wdsprxsettings.h"
|
||||||
|
|
||||||
|
#ifdef SDR_RX_SAMPLE_24BIT
|
||||||
|
const int WDSPRxSettings::m_minPowerThresholdDB = -120;
|
||||||
|
const float WDSPRxSettings::m_mminPowerThresholdDBf = 120.0f;
|
||||||
|
#else
|
||||||
|
const int WDSPRxSettings::m_minPowerThresholdDB = -100;
|
||||||
|
const float WDSPRxSettings::m_mminPowerThresholdDBf = 100.0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WDSPRxSettings::WDSPRxSettings() :
|
||||||
|
m_channelMarker(nullptr),
|
||||||
|
m_spectrumGUI(nullptr),
|
||||||
|
m_rollupState(nullptr)
|
||||||
|
{
|
||||||
|
m_profiles.resize(10);
|
||||||
|
resetToDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSettings::resetToDefaults()
|
||||||
|
{
|
||||||
|
m_demod = WDSPRxProfile::DemodSSB;
|
||||||
|
m_audioBinaural = false;
|
||||||
|
m_audioFlipChannels = false;
|
||||||
|
m_dsb = false;
|
||||||
|
m_audioMute = false;
|
||||||
|
// AGC
|
||||||
|
m_agc = false;
|
||||||
|
m_agcMode = WDSPRxProfile::AGCMedium;
|
||||||
|
m_agcGain = 80;
|
||||||
|
m_agcSlope = 35; // 3.5 dB
|
||||||
|
m_agcHangThreshold = 0;
|
||||||
|
// Noise blanker
|
||||||
|
m_dnb = false;
|
||||||
|
m_nbScheme = WDSPRxProfile::WDSPRxNBScheme::NBSchemeNB;
|
||||||
|
m_nb2Mode = WDSPRxProfile::WDSPRxNB2Mode::NB2ModeZero;
|
||||||
|
m_nbSlewTime = 0.1;
|
||||||
|
m_nbLeadTime = 0.1;
|
||||||
|
m_nbLagTime = 0.1;
|
||||||
|
m_nbThreshold = 30;
|
||||||
|
m_nbAvgTime = 50.0;
|
||||||
|
// Noise reduction
|
||||||
|
m_dnr = false;
|
||||||
|
m_anf = false;
|
||||||
|
m_nrScheme = WDSPRxProfile::NRSchemeNR;
|
||||||
|
m_nr2Gain = WDSPRxProfile::NR2GainGamma;
|
||||||
|
m_nr2NPE = WDSPRxProfile::NR2NPEOSMS;
|
||||||
|
m_nrPosition = WDSPRxProfile::NRPositionPreAGC;
|
||||||
|
m_nr2ArtifactReduction = true;
|
||||||
|
// Demods
|
||||||
|
m_amFadeLevel = false;
|
||||||
|
m_cwPeaking = false;
|
||||||
|
m_cwPeakFrequency = 600.0;
|
||||||
|
m_cwBandwidth = 100.0;
|
||||||
|
m_cwGain = 2.0;
|
||||||
|
m_fmDeviation = 2500.0;
|
||||||
|
m_fmAFLow = 300.0;
|
||||||
|
m_fmAFHigh = 3000.0;
|
||||||
|
m_fmAFLimiter = false;
|
||||||
|
m_fmAFLimiterGain = 10.0;
|
||||||
|
m_fmCTCSSNotch = false;
|
||||||
|
m_fmCTCSSNotchFrequency = 67.0;
|
||||||
|
// Squelch
|
||||||
|
m_squelch = false;
|
||||||
|
m_squelchThreshold = 3;
|
||||||
|
m_squelchMode = WDSPRxProfile::SquelchModeVoice;
|
||||||
|
m_ssqlTauMute = 0.1;
|
||||||
|
m_ssqlTauUnmute = 0.1;
|
||||||
|
m_amsqMaxTail = 1.5;
|
||||||
|
//
|
||||||
|
m_volume = 1.0;
|
||||||
|
m_inputFrequencyOffset = 0;
|
||||||
|
m_rgbColor = QColor(0, 255, 196).rgb();
|
||||||
|
m_title = "WDSP Receiver";
|
||||||
|
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;
|
||||||
|
m_streamIndex = 0;
|
||||||
|
m_useReverseAPI = false;
|
||||||
|
m_reverseAPIAddress = "127.0.0.1";
|
||||||
|
m_reverseAPIPort = 8888;
|
||||||
|
m_reverseAPIDeviceIndex = 0;
|
||||||
|
m_reverseAPIChannelIndex = 0;
|
||||||
|
m_workspaceIndex = 0;
|
||||||
|
m_hidden = false;
|
||||||
|
m_profileIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray WDSPRxSettings::serialize() const
|
||||||
|
{
|
||||||
|
SimpleSerializer s(1);
|
||||||
|
s.writeS32( 1, m_inputFrequencyOffset);
|
||||||
|
s.writeS32( 2, (int) m_demod);
|
||||||
|
s.writeS32( 3, m_volume * 10.0);
|
||||||
|
|
||||||
|
if (m_spectrumGUI) {
|
||||||
|
s.writeBlob(4, m_spectrumGUI->serialize());
|
||||||
|
}
|
||||||
|
|
||||||
|
s.writeU32( 5, m_rgbColor);
|
||||||
|
s.writeBool( 8, m_audioBinaural);
|
||||||
|
s.writeBool( 9, m_audioFlipChannels);
|
||||||
|
s.writeBool( 10, m_dsb);
|
||||||
|
// AGC
|
||||||
|
s.writeBool( 11, m_agc);
|
||||||
|
s.writeS32( 12, (int) m_agcMode);
|
||||||
|
s.writeS32( 13, m_agcGain);
|
||||||
|
s.writeS32( 14, m_agcSlope);
|
||||||
|
s.writeS32( 15, m_agcHangThreshold);
|
||||||
|
// Noise blanker
|
||||||
|
s.writeBool( 20, m_dnb);
|
||||||
|
s.writeS32( 21, (int) m_nbScheme);
|
||||||
|
s.writeS32( 22, (int) m_nb2Mode);
|
||||||
|
s.writeDouble(23, m_nbSlewTime);
|
||||||
|
s.writeDouble(24, m_nbLeadTime);
|
||||||
|
s.writeDouble(25, m_nbLagTime);
|
||||||
|
s.writeS32( 26, m_nbThreshold);
|
||||||
|
s.writeDouble(27, m_nbAvgTime);
|
||||||
|
// Noise reduction
|
||||||
|
s.writeBool( 30, m_dnr);
|
||||||
|
s.writeBool( 32, m_anf);
|
||||||
|
s.writeS32( 33, (int) m_nrScheme);
|
||||||
|
s.writeS32( 34, (int) m_nr2Gain);
|
||||||
|
s.writeS32( 35, (int) m_nr2NPE);
|
||||||
|
s.writeS32( 36, (int) m_nrPosition);
|
||||||
|
s.writeBool( 37, m_nr2ArtifactReduction);
|
||||||
|
// Demods
|
||||||
|
s.writeBool( 40, m_amFadeLevel);
|
||||||
|
s.writeBool( 41, m_cwPeaking);
|
||||||
|
s.writeDouble(42, m_cwPeakFrequency);
|
||||||
|
s.writeDouble(43, m_cwBandwidth);
|
||||||
|
s.writeDouble(44, m_cwGain);
|
||||||
|
s.writeDouble(45, m_fmDeviation);
|
||||||
|
s.writeDouble(46, m_fmAFLow);
|
||||||
|
s.writeDouble(47, m_fmAFHigh);
|
||||||
|
s.writeBool( 48, m_fmAFLimiter);
|
||||||
|
s.writeDouble(49, m_fmAFLimiterGain);
|
||||||
|
s.writeBool( 50, m_fmCTCSSNotch);
|
||||||
|
s.writeDouble(51, m_fmCTCSSNotchFrequency);
|
||||||
|
// Squelch
|
||||||
|
s.writeBool( 60, m_squelch);
|
||||||
|
s.writeS32( 61, m_squelchThreshold);
|
||||||
|
s.writeDouble(62, m_ssqlTauMute);
|
||||||
|
s.writeDouble(63, m_ssqlTauUnmute);
|
||||||
|
s.writeDouble(64, m_amsqMaxTail);
|
||||||
|
//
|
||||||
|
s.writeString(70, m_title);
|
||||||
|
s.writeString(71, m_audioDeviceName);
|
||||||
|
s.writeBool( 72, m_useReverseAPI);
|
||||||
|
s.writeString(73, m_reverseAPIAddress);
|
||||||
|
s.writeU32( 74, m_reverseAPIPort);
|
||||||
|
s.writeU32( 75, m_reverseAPIDeviceIndex);
|
||||||
|
s.writeU32( 76, m_reverseAPIChannelIndex);
|
||||||
|
s.writeS32( 77, m_streamIndex);
|
||||||
|
|
||||||
|
if (m_rollupState) {
|
||||||
|
s.writeBlob(78, m_rollupState->serialize());
|
||||||
|
}
|
||||||
|
|
||||||
|
s.writeS32( 79, m_workspaceIndex);
|
||||||
|
s.writeBlob( 80, m_geometryBytes);
|
||||||
|
s.writeBool( 81, m_hidden);
|
||||||
|
s.writeU32( 82, m_profileIndex);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
s.writeS32 (104 + 100*i, (int) m_profiles[i].m_demod);
|
||||||
|
// Filter
|
||||||
|
s.writeS32 (100 + 100*i, m_profiles[i].m_spanLog2);
|
||||||
|
s.writeS32 (101 + 100*i, m_profiles[i].m_highCutoff / 100.0);
|
||||||
|
s.writeS32 (102 + 100*i, m_profiles[i].m_lowCutoff / 100.0);
|
||||||
|
s.writeS32 (103 + 100*i, m_profiles[i].m_fftWindow);
|
||||||
|
// AGC
|
||||||
|
s.writeBool (110 + 100*i, m_profiles[i].m_agc);
|
||||||
|
s.writeS32 (111 + 100*i, (int) m_profiles[i].m_agcMode);
|
||||||
|
s.writeS32 (112 + 100*i, m_profiles[i].m_agcGain);
|
||||||
|
s.writeS32 (113 + 100*i, m_profiles[i].m_agcSlope);
|
||||||
|
s.writeS32 (114 + 100*i, m_profiles[i].m_agcHangThreshold);
|
||||||
|
// Noise blanjer
|
||||||
|
s.writeBool (120 + 100*i, m_profiles[i].m_dnb);
|
||||||
|
s.writeS32 (121 + 100*i, (int) m_profiles[i].m_nbScheme);
|
||||||
|
s.writeS32 (122 + 100*i, (int) m_profiles[i].m_nb2Mode);
|
||||||
|
s.writeDouble(123 + 100*i, m_profiles[i].m_nbSlewTime);
|
||||||
|
s.writeDouble(124 + 100*i, m_profiles[i].m_nbLeadTime);
|
||||||
|
s.writeDouble(125 + 100*i, m_profiles[i].m_nbLagTime);
|
||||||
|
s.writeS32 (126 + 100*i, m_profiles[i].m_nbThreshold);
|
||||||
|
s.writeDouble(127 + 100*i, m_profiles[i].m_nbAvgTime);
|
||||||
|
// Noise reduction
|
||||||
|
s.writeBool (130 + 100*i, m_profiles[i].m_dnr);
|
||||||
|
s.writeBool (132 + 100*i, m_profiles[i].m_anf);
|
||||||
|
s.writeS32 (133 + 100*i, (int) m_profiles[i].m_nrScheme);
|
||||||
|
s.writeS32 (134 + 100*i, (int) m_profiles[i].m_nr2Gain);
|
||||||
|
s.writeS32 (135 + 100*i, (int) m_profiles[i].m_nr2NPE);
|
||||||
|
s.writeS32 (136 + 100*i, (int) m_profiles[i].m_nrPosition);
|
||||||
|
s.writeBool (137 + 100*i, m_profiles[i].m_nr2ArtifactReduction);
|
||||||
|
// Demods
|
||||||
|
s.writeBool (140 + 100*i, m_profiles[i].m_amFadeLevel);
|
||||||
|
s.writeBool (141 + 100*i, m_profiles[i].m_cwPeaking);
|
||||||
|
s.writeDouble(142 + 100*i, m_profiles[i].m_cwPeakFrequency);
|
||||||
|
s.writeDouble(143 + 100*i, m_profiles[i].m_cwBandwidth);
|
||||||
|
s.writeDouble(144 + 100*i, m_profiles[i].m_cwGain);
|
||||||
|
s.writeDouble(145 + 100*i, m_profiles[i].m_fmDeviation);
|
||||||
|
s.writeDouble(146 + 100*i, m_profiles[i].m_fmAFLow);
|
||||||
|
s.writeDouble(147 + 100*i, m_profiles[i].m_fmAFHigh);
|
||||||
|
s.writeBool( 148 + 100*i, m_profiles[i].m_fmAFLimiter);
|
||||||
|
s.writeDouble(149 + 100*i, m_profiles[i].m_fmAFLimiterGain);
|
||||||
|
s.writeBool( 150 + 100*i, m_profiles[i].m_fmCTCSSNotch);
|
||||||
|
s.writeDouble(151 + 100*i, m_profiles[i].m_fmCTCSSNotchFrequency);
|
||||||
|
// Squelch
|
||||||
|
s.writeBool( 160 + 100*i, m_profiles[i].m_squelch);
|
||||||
|
s.writeS32( 161 + 100*i, m_profiles[i].m_squelchThreshold);
|
||||||
|
s.writeDouble(162 + 100*i, m_profiles[i].m_ssqlTauMute);
|
||||||
|
s.writeDouble(163 + 100*i, m_profiles[i].m_ssqlTauUnmute);
|
||||||
|
s.writeDouble(164 + 100*i, m_profiles[i].m_amsqMaxTail);
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.final();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WDSPRxSettings::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
|
if(!d.isValid())
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d.getVersion() == 1)
|
||||||
|
{
|
||||||
|
QByteArray bytetmp;
|
||||||
|
qint32 tmp;
|
||||||
|
uint32_t utmp;
|
||||||
|
QString strtmp;
|
||||||
|
|
||||||
|
d.readS32( 1, &m_inputFrequencyOffset, 0);
|
||||||
|
d.readS32( 2, &tmp, 0);
|
||||||
|
m_demod = (WDSPRxProfile::WDSPRxDemod) tmp;
|
||||||
|
d.readS32( 3, &tmp, 30);
|
||||||
|
m_volume = tmp / 10.0;
|
||||||
|
|
||||||
|
if (m_spectrumGUI)
|
||||||
|
{
|
||||||
|
d.readBlob(4, &bytetmp);
|
||||||
|
m_spectrumGUI->deserialize(bytetmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readU32( 5, &m_rgbColor);
|
||||||
|
d.readBool( 8, &m_audioBinaural, false);
|
||||||
|
d.readBool( 9, &m_audioFlipChannels, false);
|
||||||
|
d.readBool( 10, &m_dsb, false);
|
||||||
|
// AGC
|
||||||
|
d.readBool( 11, &m_agc, true);
|
||||||
|
d.readS32( 12, &tmp, 2);
|
||||||
|
m_agcMode = (WDSPRxProfile::WDSPRxAGCMode) tmp;
|
||||||
|
d.readS32( 13, &m_agcGain, 80);
|
||||||
|
d.readS32( 14, &m_agcSlope, 35);
|
||||||
|
d.readS32( 15, &m_agcHangThreshold, 0);
|
||||||
|
// Noise blanker
|
||||||
|
d.readBool( 20, &m_dnb, false);
|
||||||
|
d.readS32( 21, &tmp, 2);
|
||||||
|
m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) tmp;
|
||||||
|
d.readS32( 22, &tmp, 2);
|
||||||
|
m_nb2Mode = (WDSPRxProfile::WDSPRxNB2Mode) tmp;
|
||||||
|
d.readDouble(23, &m_nbSlewTime, 0.1);
|
||||||
|
d.readDouble(24, &m_nbLeadTime, 0.1);
|
||||||
|
d.readDouble(25, &m_nbLagTime, 0.1);
|
||||||
|
d.readS32( 26, &m_nbThreshold, 30);
|
||||||
|
d.readDouble(27, &m_nbAvgTime, 50.0);
|
||||||
|
// Nosie reduction
|
||||||
|
d.readBool( 30, &m_dnr, false);
|
||||||
|
d.readBool( 32, &m_anf, false);
|
||||||
|
d.readS32( 33, &tmp, 2);
|
||||||
|
m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
||||||
|
d.readS32( 34, &tmp, 2);
|
||||||
|
m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp;
|
||||||
|
d.readS32( 35, &tmp, 2);
|
||||||
|
m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp;
|
||||||
|
d.readS32( 36, &tmp, 2);
|
||||||
|
m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp;
|
||||||
|
d.readBool( 37, &m_nr2ArtifactReduction, true);
|
||||||
|
// Demods
|
||||||
|
d.readBool( 40, &m_amFadeLevel, false);
|
||||||
|
d.readBool( 41, &m_cwPeaking, false);
|
||||||
|
d.readDouble(42, &m_cwPeakFrequency, 600.0);
|
||||||
|
d.readDouble(43, &m_cwBandwidth, 100.0);
|
||||||
|
d.readDouble(44, &m_cwGain, 2.0);
|
||||||
|
d.readDouble(45, &m_fmDeviation, 2500.0);
|
||||||
|
d.readDouble(46, &m_fmAFLow, 300.0);
|
||||||
|
d.readDouble(47, &m_fmAFHigh, 3000.0);
|
||||||
|
d.readBool( 48, &m_fmAFLimiter, false);
|
||||||
|
d.readDouble(49, &m_fmAFLimiterGain, 10.0);
|
||||||
|
d.readBool( 50, &m_fmCTCSSNotch, false);
|
||||||
|
d.readDouble(51, &m_fmCTCSSNotchFrequency, 67.0);
|
||||||
|
// Squelch
|
||||||
|
d.readBool( 60, &m_squelch, false);
|
||||||
|
d.readS32( 61, &m_squelchThreshold, 3);
|
||||||
|
d.readDouble(62, &m_ssqlTauMute, 0.1);
|
||||||
|
d.readDouble(63, &m_ssqlTauUnmute, 0.1);
|
||||||
|
d.readDouble(64, &m_amsqMaxTail, 1.5);
|
||||||
|
//
|
||||||
|
d.readString(70, &m_title, "WDSP Receiver");
|
||||||
|
d.readString(71, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);
|
||||||
|
d.readBool( 72, &m_useReverseAPI, false);
|
||||||
|
d.readString(73, &m_reverseAPIAddress, "127.0.0.1");
|
||||||
|
d.readU32( 74, &utmp, 0);
|
||||||
|
|
||||||
|
if ((utmp > 1023) && (utmp < 65535)) {
|
||||||
|
m_reverseAPIPort = utmp;
|
||||||
|
} else {
|
||||||
|
m_reverseAPIPort = 8888;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readU32( 75, &utmp, 0);
|
||||||
|
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
|
||||||
|
d.readU32( 76, &utmp, 0);
|
||||||
|
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
|
||||||
|
d.readS32( 77, &m_streamIndex, 0);
|
||||||
|
|
||||||
|
if (m_rollupState)
|
||||||
|
{
|
||||||
|
d.readBlob(78, &bytetmp);
|
||||||
|
m_rollupState->deserialize(bytetmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readS32( 79, &m_workspaceIndex, 0);
|
||||||
|
d.readBlob( 80, &m_geometryBytes);
|
||||||
|
d.readBool( 81, &m_hidden, false);
|
||||||
|
d.readU32( 82, &utmp, 0);
|
||||||
|
m_profileIndex = utmp < 10 ? utmp : 0;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; (i < 10); i++)
|
||||||
|
{
|
||||||
|
d.readS32 (104 + 100*i, &tmp, 9);
|
||||||
|
m_profiles[i].m_demod = (WDSPRxProfile::WDSPRxDemod) tmp;
|
||||||
|
// Filter
|
||||||
|
d.readS32 (100 + 100*i, &m_profiles[i].m_spanLog2, 3);
|
||||||
|
d.readS32 (101 + 100*i, &tmp, 30);
|
||||||
|
m_profiles[i].m_highCutoff = tmp * 100.0;
|
||||||
|
d.readS32 (102 + 100*i, &tmp, 3);
|
||||||
|
m_profiles[i].m_lowCutoff = tmp * 100.0;
|
||||||
|
d.readS32 (103 + 100*i, &m_profiles[i].m_fftWindow, 0);
|
||||||
|
// AGC
|
||||||
|
d.readBool( 110 + 100*i, &m_profiles[i].m_agc, true);
|
||||||
|
d.readS32( 111 + 100*i, &tmp, 2);
|
||||||
|
m_profiles[i].m_agcMode = (WDSPRxProfile::WDSPRxAGCMode) tmp;
|
||||||
|
d.readS32( 112 + 100*i, &m_profiles[i].m_agcGain, 80);
|
||||||
|
d.readS32( 113 + 100*i, &m_profiles[i].m_agcSlope, 35);
|
||||||
|
d.readS32( 114 + 100*i, &m_profiles[i].m_agcHangThreshold, 0);
|
||||||
|
// Noise blanker
|
||||||
|
d.readBool (120 + 100*i, &m_profiles[i].m_dnb, false);
|
||||||
|
d.readS32 (121 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) tmp;
|
||||||
|
d.readS32 (122 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nb2Mode = (WDSPRxProfile::WDSPRxNB2Mode) tmp;
|
||||||
|
d.readDouble(123 + 100*i, &m_profiles[i].m_nbSlewTime, 0.1);
|
||||||
|
d.readDouble(124 + 100*i, &m_profiles[i].m_nbLeadTime, 0.1);
|
||||||
|
d.readDouble(125 + 100*i, &m_profiles[i].m_nbLagTime, 0.1);
|
||||||
|
d.readS32 (126 + 100*i, &m_profiles[i].m_nbThreshold, 30);
|
||||||
|
d.readDouble(127 + 100*i, &m_profiles[i].m_nbAvgTime, 50.0);
|
||||||
|
// Noise reduction
|
||||||
|
d.readBool (130 + 100*i, &m_profiles[i].m_dnr, false);
|
||||||
|
d.readBool (132 + 100*i, &m_profiles[i].m_anf, false);
|
||||||
|
d.readS32 (133 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
||||||
|
d.readS32 (134 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp;
|
||||||
|
d.readS32 (135 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp;
|
||||||
|
d.readS32 (136 + 100*i, &tmp);
|
||||||
|
m_profiles[i].m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp;
|
||||||
|
d.readBool (137 + 100*i, &m_profiles[i].m_nr2ArtifactReduction);
|
||||||
|
// Demods
|
||||||
|
d.readBool (140 + 100*i, &m_amFadeLevel, false);
|
||||||
|
d.readBool (141 + 100*i, &m_cwPeaking, false);
|
||||||
|
d.readDouble(142 + 100*i, &m_profiles[i].m_cwPeakFrequency, 600.0);
|
||||||
|
d.readDouble(143 + 100*i, &m_profiles[i].m_cwBandwidth, 100.0);
|
||||||
|
d.readDouble(144 + 100*i, &m_profiles[i].m_cwGain, 2.0);
|
||||||
|
d.readDouble(145 + 100*i, &m_profiles[i].m_fmDeviation, 2500.0);
|
||||||
|
d.readDouble(146 + 100*i, &m_profiles[i].m_fmAFLow, 300.0);
|
||||||
|
d.readDouble(147 + 100*i, &m_profiles[i].m_fmAFHigh, 3000.0);
|
||||||
|
d.readBool( 148 + 100*i, &m_profiles[i].m_fmAFLimiter, false);
|
||||||
|
d.readDouble(149 + 100*i, &m_profiles[i].m_fmAFLimiterGain, 10.0);
|
||||||
|
d.readBool( 150 + 100*i, &m_profiles[i].m_fmCTCSSNotch, false);
|
||||||
|
d.readDouble(151 + 100*i, &m_profiles[i].m_fmCTCSSNotchFrequency, 67.0);
|
||||||
|
// Squelch
|
||||||
|
d.readBool( 160 + 100*i, &m_profiles[i].m_squelch, false);
|
||||||
|
d.readS32( 161 + 100*i, &m_profiles[i].m_squelchThreshold, 3);
|
||||||
|
d.readDouble(161 + 100*i, &m_profiles[i].m_ssqlTauMute, 0.1);
|
||||||
|
d.readDouble(162 + 100*i, &m_profiles[i].m_ssqlTauUnmute, 0.1);
|
||||||
|
d.readDouble(163 + 100*i, &m_profiles[i].m_amsqMaxTail, 1.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetToDefaults();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
18
plugins/channelrx/wdsprx/wdsprxsettings.cpp.rej
Normal file
18
plugins/channelrx/wdsprx/wdsprxsettings.cpp.rej
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
--- plugins/channelrx/wdsprx/wdsprxsettings.cpp
|
||||||
|
+++ plugins/channelrx/wdsprx/wdsprxsettings.cpp
|
||||||
|
@@ -182,6 +184,7 @@ QByteArray WDSPRxSettings::serialize() const
|
||||||
|
s.writeDouble(127 + 50*i, m_profiles[i].m_nbAvgTime);
|
||||||
|
// Noise reduction
|
||||||
|
s.writeBool (130 + 50*i, m_profiles[i].m_dnr);
|
||||||
|
+ s.writeBool (131 + 50*i, m_profiles[i].m_snb);
|
||||||
|
s.writeBool (132 + 50*i, m_profiles[i].m_anf);
|
||||||
|
s.writeS32 (133 + 50*i, (int) m_profiles[i].m_nrScheme);
|
||||||
|
s.writeS32 (134 + 50*i, (int) m_profiles[i].m_nr2Gain);
|
||||||
|
@@ -329,6 +333,7 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
|
||||||
|
d.readDouble(127 + 50*i, &m_profiles[i].m_nbAvgTime, 50.0);
|
||||||
|
// Noise reduction
|
||||||
|
d.readBool (130 + 50*i, &m_profiles[i].m_dnr, false);
|
||||||
|
+ d.readBool (131 + 50*i, &m_profiles[i].m_snb, false);
|
||||||
|
d.readBool (132 + 50*i, &m_profiles[i].m_anf, false);
|
||||||
|
d.readS32 (133 + 50*i, &tmp);
|
||||||
|
m_profiles[i].m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
|
@ -106,6 +106,7 @@ struct WDSPRxProfile
|
|||||||
double m_nbAvgTime; // a.k.a back tau
|
double m_nbAvgTime; // a.k.a back tau
|
||||||
// Noise rediction
|
// Noise rediction
|
||||||
bool m_dnr;
|
bool m_dnr;
|
||||||
|
bool m_snb;
|
||||||
bool m_anf;
|
bool m_anf;
|
||||||
WDSPRxNRScheme m_nrScheme;
|
WDSPRxNRScheme m_nrScheme;
|
||||||
WDSPRxNR2Gain m_nr2Gain;
|
WDSPRxNR2Gain m_nr2Gain;
|
||||||
@ -153,6 +154,7 @@ struct WDSPRxProfile
|
|||||||
m_nbThreshold(30),
|
m_nbThreshold(30),
|
||||||
m_nbAvgTime(50.0),
|
m_nbAvgTime(50.0),
|
||||||
m_dnr(false),
|
m_dnr(false),
|
||||||
|
m_snb(false),
|
||||||
m_anf(false),
|
m_anf(false),
|
||||||
m_nrScheme(NRSchemeNR),
|
m_nrScheme(NRSchemeNR),
|
||||||
m_nr2Gain(NR2GainGamma),
|
m_nr2Gain(NR2GainGamma),
|
||||||
@ -209,6 +211,7 @@ struct WDSPRxSettings
|
|||||||
double m_nbAvgTime;
|
double m_nbAvgTime;
|
||||||
// Noise reduction
|
// Noise reduction
|
||||||
bool m_dnr;
|
bool m_dnr;
|
||||||
|
bool m_snb;
|
||||||
bool m_anf;
|
bool m_anf;
|
||||||
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
|
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
|
||||||
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
|
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
|
||||||
|
271
plugins/channelrx/wdsprx/wdsprxsettings.h.orig
Normal file
271
plugins/channelrx/wdsprx/wdsprxsettings.h.orig
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_
|
||||||
|
#define PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "dsp/fftwindow.h"
|
||||||
|
|
||||||
|
class Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
struct WDSPRxProfile
|
||||||
|
{
|
||||||
|
enum WDSPRxDemod
|
||||||
|
{
|
||||||
|
DemodSSB,
|
||||||
|
DemodAM,
|
||||||
|
DemodSAM,
|
||||||
|
DemodFMN,
|
||||||
|
};
|
||||||
|
enum WDSPRxAGCMode
|
||||||
|
{
|
||||||
|
AGCLong,
|
||||||
|
AGCSlow,
|
||||||
|
AGCMedium,
|
||||||
|
AGCFast,
|
||||||
|
};
|
||||||
|
enum WDSPRxNRScheme
|
||||||
|
{
|
||||||
|
NRSchemeNR,
|
||||||
|
NRSchemeNR2,
|
||||||
|
};
|
||||||
|
enum WDSPRxNBScheme
|
||||||
|
{
|
||||||
|
NBSchemeNB, //!< Preemptive Wideband Blanker (ANB)
|
||||||
|
NBSchemeNB2, //!< Interpolating Wideband Blanker (NOB)
|
||||||
|
};
|
||||||
|
enum WDSPRxNR2Gain
|
||||||
|
{
|
||||||
|
NR2GainLinear,
|
||||||
|
NR2GainLog,
|
||||||
|
NR2GainGamma,
|
||||||
|
};
|
||||||
|
enum WDSPRxNR2NPE
|
||||||
|
{
|
||||||
|
NR2NPEOSMS,
|
||||||
|
NR2NPEMMSE,
|
||||||
|
};
|
||||||
|
enum WDSPRxNRPosition
|
||||||
|
{
|
||||||
|
NRPositionPreAGC,
|
||||||
|
NRPositionPostAGC,
|
||||||
|
};
|
||||||
|
enum WDSPRxNB2Mode
|
||||||
|
{
|
||||||
|
NB2ModeZero,
|
||||||
|
NB2ModeSampleAndHold,
|
||||||
|
NB2ModeMeanHold,
|
||||||
|
NB2ModeHoldSample,
|
||||||
|
NB2ModeInterpolate,
|
||||||
|
};
|
||||||
|
enum WDSPRxSquelchMode
|
||||||
|
{
|
||||||
|
SquelchModeVoice,
|
||||||
|
SquelchModeAM,
|
||||||
|
SquelchModeFM,
|
||||||
|
};
|
||||||
|
|
||||||
|
WDSPRxDemod m_demod;
|
||||||
|
// Filter
|
||||||
|
int m_spanLog2;
|
||||||
|
Real m_highCutoff;
|
||||||
|
Real m_lowCutoff;
|
||||||
|
int m_fftWindow; // 0: 4-term Blackman-Harris, 1: 7-term Blackman-Harris
|
||||||
|
// AGC
|
||||||
|
bool m_agc;
|
||||||
|
WDSPRxAGCMode m_agcMode;
|
||||||
|
int m_agcGain; //!< Fixed gain if AGC is off else top gain
|
||||||
|
int m_agcSlope;
|
||||||
|
int m_agcHangThreshold;
|
||||||
|
// Noise blanker
|
||||||
|
bool m_dnb;
|
||||||
|
WDSPRxNBScheme m_nbScheme;
|
||||||
|
WDSPRxNB2Mode m_nb2Mode;
|
||||||
|
double m_nbSlewTime; // a.k.a tau
|
||||||
|
double m_nbLeadTime; // a.k.a adv time
|
||||||
|
double m_nbLagTime; // a.k.a hang time
|
||||||
|
int m_nbThreshold;
|
||||||
|
double m_nbAvgTime; // a.k.a back tau
|
||||||
|
// Noise rediction
|
||||||
|
bool m_dnr;
|
||||||
|
bool m_anf;
|
||||||
|
WDSPRxNRScheme m_nrScheme;
|
||||||
|
WDSPRxNR2Gain m_nr2Gain;
|
||||||
|
WDSPRxNR2NPE m_nr2NPE;
|
||||||
|
WDSPRxNRPosition m_nrPosition;
|
||||||
|
bool m_nr2ArtifactReduction;
|
||||||
|
// Demods
|
||||||
|
bool m_amFadeLevel;
|
||||||
|
bool m_cwPeaking;
|
||||||
|
double m_cwPeakFrequency;
|
||||||
|
double m_cwBandwidth;
|
||||||
|
double m_cwGain;
|
||||||
|
double m_fmDeviation;
|
||||||
|
double m_fmAFLow;
|
||||||
|
double m_fmAFHigh;
|
||||||
|
bool m_fmAFLimiter;
|
||||||
|
double m_fmAFLimiterGain;
|
||||||
|
bool m_fmCTCSSNotch;
|
||||||
|
double m_fmCTCSSNotchFrequency;
|
||||||
|
// Squelch
|
||||||
|
bool m_squelch;
|
||||||
|
int m_squelchThreshold;
|
||||||
|
WDSPRxSquelchMode m_squelchMode;
|
||||||
|
double m_ssqlTauMute; //!< Voice squelch tau mute
|
||||||
|
double m_ssqlTauUnmute; //!< Voice squelch tau unmute
|
||||||
|
double m_amsqMaxTail;
|
||||||
|
|
||||||
|
WDSPRxProfile() :
|
||||||
|
m_demod(DemodSSB),
|
||||||
|
m_spanLog2(3),
|
||||||
|
m_highCutoff(3000),
|
||||||
|
m_lowCutoff(300),
|
||||||
|
m_fftWindow(0),
|
||||||
|
m_agc(false),
|
||||||
|
m_agcMode(AGCMedium),
|
||||||
|
m_agcGain(80),
|
||||||
|
m_agcSlope(35),
|
||||||
|
m_agcHangThreshold(0),
|
||||||
|
m_dnb(false),
|
||||||
|
m_nbScheme(NBSchemeNB),
|
||||||
|
m_nb2Mode(NB2ModeZero),
|
||||||
|
m_nbSlewTime(0.1),
|
||||||
|
m_nbLeadTime(0.1),
|
||||||
|
m_nbLagTime(0.1),
|
||||||
|
m_nbThreshold(30),
|
||||||
|
m_nbAvgTime(50.0),
|
||||||
|
m_dnr(false),
|
||||||
|
m_anf(false),
|
||||||
|
m_nrScheme(NRSchemeNR),
|
||||||
|
m_nr2Gain(NR2GainGamma),
|
||||||
|
m_nr2NPE(NR2NPEOSMS),
|
||||||
|
m_nrPosition(NRPositionPreAGC),
|
||||||
|
m_nr2ArtifactReduction(true),
|
||||||
|
m_amFadeLevel(false),
|
||||||
|
m_cwPeaking(false),
|
||||||
|
m_cwPeakFrequency(600.0),
|
||||||
|
m_cwBandwidth(100.0),
|
||||||
|
m_cwGain(2.0),
|
||||||
|
m_fmDeviation(2500.0),
|
||||||
|
m_fmAFLow(300.0),
|
||||||
|
m_fmAFHigh(3000.0),
|
||||||
|
m_fmAFLimiter(false),
|
||||||
|
m_fmAFLimiterGain(10.0),
|
||||||
|
m_fmCTCSSNotch(false),
|
||||||
|
m_fmCTCSSNotchFrequency(67.0),
|
||||||
|
m_squelch(false),
|
||||||
|
m_squelchThreshold(3),
|
||||||
|
m_squelchMode(SquelchModeVoice),
|
||||||
|
m_ssqlTauMute(0.1),
|
||||||
|
m_ssqlTauUnmute(0.1),
|
||||||
|
m_amsqMaxTail(1.5)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WDSPRxSettings
|
||||||
|
{
|
||||||
|
WDSPRxProfile::WDSPRxDemod m_demod;
|
||||||
|
qint32 m_inputFrequencyOffset;
|
||||||
|
// Real m_highCutoff;
|
||||||
|
// Real m_lowCutoff;
|
||||||
|
Real m_volume;
|
||||||
|
// int m_spanLog2;
|
||||||
|
bool m_audioBinaural;
|
||||||
|
bool m_audioFlipChannels;
|
||||||
|
bool m_dsb;
|
||||||
|
bool m_audioMute;
|
||||||
|
// AGC
|
||||||
|
bool m_agc;
|
||||||
|
WDSPRxProfile::WDSPRxAGCMode m_agcMode;
|
||||||
|
int m_agcGain; //!< Fixed gain if AGC is off else top gain
|
||||||
|
int m_agcSlope;
|
||||||
|
int m_agcHangThreshold;
|
||||||
|
// Noise blanker
|
||||||
|
bool m_dnb;
|
||||||
|
WDSPRxProfile::WDSPRxNBScheme m_nbScheme;
|
||||||
|
WDSPRxProfile::WDSPRxNB2Mode m_nb2Mode;
|
||||||
|
double m_nbSlewTime;
|
||||||
|
double m_nbLeadTime;
|
||||||
|
double m_nbLagTime;
|
||||||
|
int m_nbThreshold;
|
||||||
|
double m_nbAvgTime;
|
||||||
|
// Noise reduction
|
||||||
|
bool m_dnr;
|
||||||
|
bool m_anf;
|
||||||
|
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
|
||||||
|
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
|
||||||
|
WDSPRxProfile::WDSPRxNR2NPE m_nr2NPE;
|
||||||
|
WDSPRxProfile::WDSPRxNRPosition m_nrPosition;
|
||||||
|
bool m_nr2ArtifactReduction;
|
||||||
|
// Demods
|
||||||
|
bool m_amFadeLevel;
|
||||||
|
bool m_cwPeaking;
|
||||||
|
double m_cwPeakFrequency;
|
||||||
|
double m_cwBandwidth;
|
||||||
|
double m_cwGain;
|
||||||
|
double m_fmDeviation;
|
||||||
|
double m_fmAFLow;
|
||||||
|
double m_fmAFHigh;
|
||||||
|
bool m_fmAFLimiter;
|
||||||
|
double m_fmAFLimiterGain;
|
||||||
|
bool m_fmCTCSSNotch;
|
||||||
|
double m_fmCTCSSNotchFrequency;
|
||||||
|
// Squelch
|
||||||
|
bool m_squelch;
|
||||||
|
int m_squelchThreshold;
|
||||||
|
WDSPRxProfile::WDSPRxSquelchMode m_squelchMode;
|
||||||
|
double m_ssqlTauMute; //!< Voice squelch tau mute
|
||||||
|
double m_ssqlTauUnmute; //!< Voice squelch tau unmute
|
||||||
|
double m_amsqMaxTail;
|
||||||
|
|
||||||
|
quint32 m_rgbColor;
|
||||||
|
QString m_title;
|
||||||
|
QString m_audioDeviceName;
|
||||||
|
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx).
|
||||||
|
bool m_useReverseAPI;
|
||||||
|
QString m_reverseAPIAddress;
|
||||||
|
uint16_t m_reverseAPIPort;
|
||||||
|
uint16_t m_reverseAPIDeviceIndex;
|
||||||
|
uint16_t m_reverseAPIChannelIndex;
|
||||||
|
int m_workspaceIndex;
|
||||||
|
QByteArray m_geometryBytes;
|
||||||
|
bool m_hidden;
|
||||||
|
std::vector<WDSPRxProfile> m_profiles;
|
||||||
|
unsigned int m_profileIndex;
|
||||||
|
|
||||||
|
Serializable *m_channelMarker;
|
||||||
|
Serializable *m_spectrumGUI;
|
||||||
|
Serializable *m_rollupState;
|
||||||
|
|
||||||
|
WDSPRxSettings();
|
||||||
|
void resetToDefaults();
|
||||||
|
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
|
||||||
|
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
|
||||||
|
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
|
||||||
|
static const int m_minPowerThresholdDB;
|
||||||
|
static const float m_mminPowerThresholdDBf;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_ */
|
@ -131,7 +131,6 @@ WDSPRxSink::WDSPRxSink() :
|
|||||||
);
|
);
|
||||||
m_rxa->setSpectrumProbe(&m_spectrumProbe);
|
m_rxa->setSpectrumProbe(&m_spectrumProbe);
|
||||||
WDSP::RXA::SetPassband(*m_rxa, 0, m_Bandwidth);
|
WDSP::RXA::SetPassband(*m_rxa, 0, m_Bandwidth);
|
||||||
WDSP::ANR::SetANRVals(*m_rxa, 64, 16, 16e-4, 10e-7);
|
|
||||||
|
|
||||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
@ -351,7 +350,6 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
|
|||||||
<< " m_agcSlope: " << settings.m_agcSlope
|
<< " m_agcSlope: " << settings.m_agcSlope
|
||||||
<< " m_agcHangThreshold: " << settings.m_agcHangThreshold
|
<< " m_agcHangThreshold: " << settings.m_agcHangThreshold
|
||||||
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
||||||
<< " m_anf: "<< settings.m_anf
|
|
||||||
<< " m_dnr: " << settings.m_dnr
|
<< " m_dnr: " << settings.m_dnr
|
||||||
<< " m_nrScheme: " << settings.m_nrScheme
|
<< " m_nrScheme: " << settings.m_nrScheme
|
||||||
<< " m_nrPosition: "<< settings.m_nrPosition
|
<< " m_nrPosition: "<< settings.m_nrPosition
|
||||||
@ -553,6 +551,11 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
|
|||||||
WDSP::ANF::SetANFRun(*m_rxa, settings.m_anf ? 1 : 0);
|
WDSP::ANF::SetANFRun(*m_rxa, settings.m_anf ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Caution: Causes corruption
|
||||||
|
if ((m_settings.m_snb != settings.m_snb) || force) {
|
||||||
|
WDSP::SNBA::SetSNBARun(*m_rxa, settings.m_snb ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
// CW Peaking
|
// CW Peaking
|
||||||
|
|
||||||
if ((m_settings.m_cwPeaking != settings.m_cwPeaking) || force) {
|
if ((m_settings.m_cwPeaking != settings.m_cwPeaking) || force) {
|
||||||
|
782
plugins/channelrx/wdsprx/wdsprxsink.cpp.orig
Normal file
782
plugins/channelrx/wdsprx/wdsprxsink.cpp.orig
Normal file
@ -0,0 +1,782 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <QTime>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "dsp/spectrumvis.h"
|
||||||
|
#include "dsp/datafifo.h"
|
||||||
|
#include "util/db.h"
|
||||||
|
#include "util/messagequeue.h"
|
||||||
|
#include "maincore.h"
|
||||||
|
#include "RXA.hpp"
|
||||||
|
#include "nbp.hpp"
|
||||||
|
#include "meter.hpp"
|
||||||
|
#include "patchpanel.hpp"
|
||||||
|
#include "wcpAGC.hpp"
|
||||||
|
#include "anr.hpp"
|
||||||
|
#include "emnr.hpp"
|
||||||
|
#include "snba.hpp"
|
||||||
|
#include "anf.hpp"
|
||||||
|
#include "anb.hpp"
|
||||||
|
#include "nob.hpp"
|
||||||
|
#include "amd.hpp"
|
||||||
|
#include "fmd.hpp"
|
||||||
|
#include "iir.cpp"
|
||||||
|
#include "ssql.hpp"
|
||||||
|
#include "amsq.hpp"
|
||||||
|
#include "fmsq.hpp"
|
||||||
|
|
||||||
|
#include "wdsprxsink.h"
|
||||||
|
|
||||||
|
const int WDSPRxSink::m_ssbFftLen = 2048;
|
||||||
|
const int WDSPRxSink::m_wdspSampleRate = 48000;
|
||||||
|
const int WDSPRxSink::m_wdspBufSize = 512;
|
||||||
|
|
||||||
|
WDSPRxSink::SpectrumProbe::SpectrumProbe(SampleVector& sampleVector) :
|
||||||
|
m_sampleVector(sampleVector),
|
||||||
|
m_spanLog2(0),
|
||||||
|
m_dsb(false),
|
||||||
|
m_usb(true),
|
||||||
|
m_sum(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void WDSPRxSink::SpectrumProbe::setSpanLog2(int spanLog2)
|
||||||
|
{
|
||||||
|
m_spanLog2 = spanLog2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::SpectrumProbe::proceed(const float *in, int nb_samples)
|
||||||
|
{
|
||||||
|
int decim = 1<<(m_spanLog2 - 1);
|
||||||
|
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||||
|
|
||||||
|
for (int i = 0; i < nb_samples; i++)
|
||||||
|
{
|
||||||
|
float cr = in[2*i+1];
|
||||||
|
float ci = in[2*i];
|
||||||
|
m_sum += std::complex<float>{cr, ci};
|
||||||
|
|
||||||
|
if (decim == 1)
|
||||||
|
{
|
||||||
|
m_sampleVector.push_back(Sample(cr*SDR_RX_SCALEF, ci*SDR_RX_SCALEF));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(m_undersampleCount++ & decim_mask))
|
||||||
|
{
|
||||||
|
float avgr = m_sum.real() / decim;
|
||||||
|
float avgi = m_sum.imag() / decim;
|
||||||
|
|
||||||
|
if (!m_dsb & !m_usb)
|
||||||
|
{ // invert spectrum for LSB
|
||||||
|
m_sampleVector.push_back(Sample(avgi*SDR_RX_SCALEF, avgr*SDR_RX_SCALEF));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_sampleVector.push_back(Sample(avgr*SDR_RX_SCALEF, avgi*SDR_RX_SCALEF));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WDSPRxSink::WDSPRxSink() :
|
||||||
|
m_squelchDelayLine(2*48000),
|
||||||
|
m_audioActive(false),
|
||||||
|
m_spectrumSink(nullptr),
|
||||||
|
m_spectrumProbe(m_sampleBuffer),
|
||||||
|
m_inCount(0),
|
||||||
|
m_audioFifo(24000),
|
||||||
|
m_audioSampleRate(48000)
|
||||||
|
{
|
||||||
|
m_Bandwidth = 5000;
|
||||||
|
m_channelSampleRate = 48000;
|
||||||
|
m_channelFrequencyOffset = 0;
|
||||||
|
|
||||||
|
m_audioBuffer.resize(m_audioSampleRate / 10);
|
||||||
|
m_audioBufferFill = 0;
|
||||||
|
m_undersampleCount = 0;
|
||||||
|
|
||||||
|
m_demodBuffer.resize(1<<12);
|
||||||
|
m_demodBufferFill = 0;
|
||||||
|
|
||||||
|
m_sAvg = 0.0;
|
||||||
|
m_sPeak = 0.0;
|
||||||
|
m_sCount = 1;
|
||||||
|
|
||||||
|
m_rxa = WDSP::RXA::create_rxa(
|
||||||
|
m_wdspSampleRate, // input samplerate
|
||||||
|
m_wdspSampleRate, // output samplerate
|
||||||
|
m_wdspSampleRate, // sample rate for mainstream dsp processing (dsp)
|
||||||
|
m_wdspBufSize // number complex samples processed per buffer in mainstream dsp processing
|
||||||
|
);
|
||||||
|
m_rxa->setSpectrumProbe(&m_spectrumProbe);
|
||||||
|
WDSP::RXA::SetPassband(*m_rxa, 0, m_Bandwidth);
|
||||||
|
WDSP::ANR::SetANRVals(*m_rxa, 64, 16, 16e-4, 10e-7);
|
||||||
|
|
||||||
|
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||||
|
applySettings(m_settings, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
WDSPRxSink::~WDSPRxSink()
|
||||||
|
{
|
||||||
|
WDSP::RXA::destroy_rxa(m_rxa);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end)
|
||||||
|
{
|
||||||
|
if (m_channelSampleRate == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Complex ci;
|
||||||
|
|
||||||
|
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||||
|
{
|
||||||
|
Complex c(it->real(), it->imag());
|
||||||
|
c *= m_nco.nextIQ();
|
||||||
|
|
||||||
|
if (m_interpolatorDistance < 1.0f) // interpolate
|
||||||
|
{
|
||||||
|
while (!m_interpolator.interpolate(&m_interpolatorDistanceRemain, c, &ci))
|
||||||
|
{
|
||||||
|
processOneSample(ci);
|
||||||
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
|
||||||
|
{
|
||||||
|
processOneSample(ci);
|
||||||
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::getMagSqLevels(double& avg, double& peak, int& nbSamples)
|
||||||
|
{
|
||||||
|
avg = m_sAvg;
|
||||||
|
peak = m_sPeak;
|
||||||
|
nbSamples = m_sCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::processOneSample(Complex &ci)
|
||||||
|
{
|
||||||
|
m_rxa->get_inbuff()[2*m_inCount] = ci.imag() / SDR_RX_SCALEF;
|
||||||
|
m_rxa->get_inbuff()[2*m_inCount+1] = ci.real() / SDR_RX_SCALEF;
|
||||||
|
|
||||||
|
if (++m_inCount == m_rxa->get_insize())
|
||||||
|
{
|
||||||
|
WDSP::RXA::xrxa(m_rxa);
|
||||||
|
|
||||||
|
m_sCount = m_wdspBufSize;
|
||||||
|
m_sAvg = WDSP::METER::GetMeter(*m_rxa, WDSP::RXA::RXA_S_AV);
|
||||||
|
m_sPeak = WDSP::METER::GetMeter(*m_rxa, WDSP::RXA::RXA_S_PK);
|
||||||
|
|
||||||
|
for (int i = 0; i < m_rxa->get_outsize(); i++)
|
||||||
|
{
|
||||||
|
if (m_settings.m_audioMute)
|
||||||
|
{
|
||||||
|
m_audioBuffer[m_audioBufferFill].r = 0;
|
||||||
|
m_audioBuffer[m_audioBufferFill].l = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const double& cr = m_rxa->get_outbuff()[2*i+1];
|
||||||
|
const double& ci = m_rxa->get_outbuff()[2*i];
|
||||||
|
qint16 zr = cr * 32768.0;
|
||||||
|
qint16 zi = ci * 32768.0;
|
||||||
|
m_audioBuffer[m_audioBufferFill].r = zr;
|
||||||
|
m_audioBuffer[m_audioBufferFill].l = zi;
|
||||||
|
|
||||||
|
if (m_settings.m_audioBinaural)
|
||||||
|
{
|
||||||
|
m_demodBuffer[m_demodBufferFill++] = zr;
|
||||||
|
m_demodBuffer[m_demodBufferFill++] = zi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Real demod = (zr + zi) * 0.7;
|
||||||
|
qint16 sample = (qint16)(demod);
|
||||||
|
m_demodBuffer[m_demodBufferFill++] = sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_demodBufferFill >= m_demodBuffer.size())
|
||||||
|
{
|
||||||
|
QList<ObjectPipe*> dataPipes;
|
||||||
|
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
|
||||||
|
|
||||||
|
if (dataPipes.size() > 0)
|
||||||
|
{
|
||||||
|
QList<ObjectPipe*>::iterator it = dataPipes.begin();
|
||||||
|
|
||||||
|
for (; it != dataPipes.end(); ++it)
|
||||||
|
{
|
||||||
|
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element);
|
||||||
|
|
||||||
|
if (fifo)
|
||||||
|
{
|
||||||
|
fifo->write(
|
||||||
|
(quint8*) &m_demodBuffer[0],
|
||||||
|
m_demodBuffer.size() * sizeof(qint16),
|
||||||
|
m_settings.m_audioBinaural ? DataFifo::DataTypeCI16 : DataFifo::DataTypeI16
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_demodBufferFill = 0;
|
||||||
|
}
|
||||||
|
} // audio sample
|
||||||
|
|
||||||
|
if (++m_audioBufferFill == m_audioBuffer.size())
|
||||||
|
{
|
||||||
|
std::size_t res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], std::min(m_audioBufferFill, m_audioBuffer.size()));
|
||||||
|
|
||||||
|
if (res != m_audioBufferFill) {
|
||||||
|
qDebug("WDSPRxSink::processOneSample: %lu/%lu samples written", res, m_audioBufferFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_audioBufferFill = 0;
|
||||||
|
}
|
||||||
|
} // result loop
|
||||||
|
|
||||||
|
if (m_spectrumSink && (m_sampleBuffer.size() != 0))
|
||||||
|
{
|
||||||
|
m_spectrumSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), !m_settings.m_dsb);
|
||||||
|
m_sampleBuffer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_inCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force)
|
||||||
|
{
|
||||||
|
qDebug() << "WDSPRxSink::applyChannelSettings:"
|
||||||
|
<< " channelSampleRate: " << channelSampleRate
|
||||||
|
<< " channelFrequencyOffset: " << channelFrequencyOffset;
|
||||||
|
|
||||||
|
if ((m_channelFrequencyOffset != channelFrequencyOffset) ||
|
||||||
|
(m_channelSampleRate != channelSampleRate) || force)
|
||||||
|
{
|
||||||
|
m_nco.setFreq(-channelFrequencyOffset, channelSampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_channelSampleRate != channelSampleRate) || force)
|
||||||
|
{
|
||||||
|
Real interpolatorBandwidth = (m_Bandwidth * 1.5f) > channelSampleRate ? channelSampleRate : (m_Bandwidth * 1.5f);
|
||||||
|
m_interpolator.create(16, channelSampleRate, interpolatorBandwidth, 2.0f);
|
||||||
|
m_interpolatorDistanceRemain = 0;
|
||||||
|
m_interpolatorDistance = (Real) channelSampleRate / (Real) m_wdspSampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_channelSampleRate = channelSampleRate;
|
||||||
|
m_channelFrequencyOffset = channelFrequencyOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::applyAudioSampleRate(int sampleRate)
|
||||||
|
{
|
||||||
|
qDebug("WDSPRxSink::applyAudioSampleRate: %d", sampleRate);
|
||||||
|
|
||||||
|
Real interpolatorBandwidth = (m_Bandwidth * 1.5f) > m_channelSampleRate ? m_channelSampleRate : (m_Bandwidth * 1.5f);
|
||||||
|
m_interpolator.create(16, m_channelSampleRate, interpolatorBandwidth, 2.0f);
|
||||||
|
m_interpolatorDistanceRemain = 0;
|
||||||
|
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) m_wdspSampleRate;
|
||||||
|
|
||||||
|
WDSP::RXA::setOutputSamplerate(m_rxa, sampleRate);
|
||||||
|
|
||||||
|
m_audioFifo.setSize(sampleRate);
|
||||||
|
m_audioSampleRate = sampleRate;
|
||||||
|
m_audioBuffer.resize(sampleRate / 10);
|
||||||
|
m_audioBufferFill = 0;
|
||||||
|
|
||||||
|
QList<ObjectPipe*> pipes;
|
||||||
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
|
||||||
|
|
||||||
|
if (pipes.size() > 0)
|
||||||
|
{
|
||||||
|
for (const auto& pipe : pipes)
|
||||||
|
{
|
||||||
|
MessageQueue* messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
|
||||||
|
if (messageQueue)
|
||||||
|
{
|
||||||
|
MainCore::MsgChannelDemodReport *msg = MainCore::MsgChannelDemodReport::create(m_channel, sampleRate);
|
||||||
|
messageQueue->push(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
|
||||||
|
{
|
||||||
|
qDebug() << "WDSPRxSink::applySettings:"
|
||||||
|
<< " m_demod: " << settings.m_demod
|
||||||
|
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||||
|
<< " m_profileIndex: " << settings.m_profileIndex
|
||||||
|
<< " m_spanLog2: " << settings.m_profiles[settings.m_profileIndex].m_spanLog2
|
||||||
|
<< " m_highCutoff: " << settings.m_profiles[settings.m_profileIndex].m_highCutoff
|
||||||
|
<< " m_lowCutoff: " << settings.m_profiles[settings.m_profileIndex].m_lowCutoff
|
||||||
|
<< " m_fftWindow: " << settings.m_profiles[settings.m_profileIndex].m_fftWindow << "]"
|
||||||
|
<< " m_volume: " << settings.m_volume
|
||||||
|
<< " m_audioBinaural: " << settings.m_audioBinaural
|
||||||
|
<< " m_audioFlipChannels: " << settings.m_audioFlipChannels
|
||||||
|
<< " m_dsb: " << settings.m_dsb
|
||||||
|
<< " m_audioMute: " << settings.m_audioMute
|
||||||
|
<< " m_agc: " << settings.m_agc
|
||||||
|
<< " m_agcMode: " << settings.m_agcMode
|
||||||
|
<< " m_agcGain: " << settings.m_agcGain
|
||||||
|
<< " m_agcSlope: " << settings.m_agcSlope
|
||||||
|
<< " m_agcHangThreshold: " << settings.m_agcHangThreshold
|
||||||
|
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
||||||
|
<< " m_anf: "<< settings.m_anf
|
||||||
|
<< " m_dnr: " << settings.m_dnr
|
||||||
|
<< " m_nrScheme: " << settings.m_nrScheme
|
||||||
|
<< " m_nrPosition: "<< settings.m_nrPosition
|
||||||
|
<< " m_nr2Gain: " << settings.m_nr2Gain
|
||||||
|
<< " m_nr2NPE: " << settings.m_nr2NPE
|
||||||
|
<< " m_nr2ArtifactReduction: " << settings.m_nr2ArtifactReduction
|
||||||
|
<< " m_streamIndex: " << settings.m_streamIndex
|
||||||
|
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||||
|
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||||
|
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
||||||
|
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
|
||||||
|
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
|
||||||
|
<< " force: " << force;
|
||||||
|
|
||||||
|
// Filter and mode
|
||||||
|
|
||||||
|
if((m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff != settings.m_profiles[settings.m_profileIndex].m_highCutoff) ||
|
||||||
|
(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff != settings.m_profiles[settings.m_profileIndex].m_lowCutoff) ||
|
||||||
|
(m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow != settings.m_profiles[settings.m_profileIndex].m_fftWindow) ||
|
||||||
|
(m_settings.m_demod != settings.m_demod) ||
|
||||||
|
(m_settings.m_dsb != settings.m_dsb) || force)
|
||||||
|
{
|
||||||
|
float band, low, high, fLow, fHigh;
|
||||||
|
bool usb, dsb;
|
||||||
|
|
||||||
|
band = settings.m_profiles[settings.m_profileIndex].m_highCutoff;
|
||||||
|
high = band;
|
||||||
|
low = settings.m_profiles[settings.m_profileIndex].m_lowCutoff;
|
||||||
|
|
||||||
|
if (band < 0)
|
||||||
|
{
|
||||||
|
band = -band;
|
||||||
|
m_spectrumProbe.setUSB(false);
|
||||||
|
usb = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_spectrumProbe.setUSB(true);
|
||||||
|
usb = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Bandwidth = band;
|
||||||
|
|
||||||
|
if (high < low)
|
||||||
|
{
|
||||||
|
if (settings.m_dsb)
|
||||||
|
{
|
||||||
|
fLow = high;
|
||||||
|
fHigh = -high;
|
||||||
|
m_spectrumProbe.setDSB(true);
|
||||||
|
dsb = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fLow = high;
|
||||||
|
fHigh = low;
|
||||||
|
m_spectrumProbe.setDSB(false);
|
||||||
|
dsb = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (settings.m_dsb)
|
||||||
|
{
|
||||||
|
fLow = -high;
|
||||||
|
fHigh = high;
|
||||||
|
m_spectrumProbe.setDSB(true);
|
||||||
|
dsb = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fLow = low;
|
||||||
|
fHigh = high;
|
||||||
|
m_spectrumProbe.setDSB(false);
|
||||||
|
dsb = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Real interpolatorBandwidth = (m_Bandwidth * 1.5f) > m_channelSampleRate ? m_channelSampleRate : (m_Bandwidth * 1.5f);
|
||||||
|
m_interpolator.create(16, m_channelSampleRate, interpolatorBandwidth, 2.0f);
|
||||||
|
m_interpolatorDistanceRemain = 0;
|
||||||
|
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) m_audioSampleRate;
|
||||||
|
|
||||||
|
WDSP::RXA::SetPassband(*m_rxa, fLow, fHigh);
|
||||||
|
WDSP::NBP::NBPSetWindow(*m_rxa, m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow);
|
||||||
|
|
||||||
|
if (settings.m_demod == WDSPRxProfile::DemodSSB)
|
||||||
|
{
|
||||||
|
if (dsb)
|
||||||
|
{
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_DSB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (usb) {
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_USB);
|
||||||
|
} else {
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_LSB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (settings.m_demod == WDSPRxProfile::DemodAM)
|
||||||
|
{
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_AM);
|
||||||
|
}
|
||||||
|
else if (settings.m_demod == WDSPRxProfile::DemodSAM)
|
||||||
|
{
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_SAM);
|
||||||
|
}
|
||||||
|
else if (settings.m_demod == WDSPRxProfile::DemodFMN)
|
||||||
|
{
|
||||||
|
WDSP::RXA::SetMode(*m_rxa, WDSP::RXA::RXA_FM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_profiles[settings.m_profileIndex].m_spanLog2 != settings.m_profiles[settings.m_profileIndex].m_spanLog2) || force) {
|
||||||
|
m_spectrumProbe.setSpanLog2(settings.m_profiles[settings.m_profileIndex].m_spanLog2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Noise Reduction
|
||||||
|
|
||||||
|
if ((m_settings.m_dnr != settings.m_dnr)
|
||||||
|
|| (m_settings.m_nrScheme != settings.m_nrScheme) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANR::SetANRRun(*m_rxa, 0);
|
||||||
|
WDSP::EMNR::SetEMNRRun(*m_rxa, 0);
|
||||||
|
|
||||||
|
if (settings.m_dnr)
|
||||||
|
{
|
||||||
|
switch (settings.m_nrScheme)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::NRSchemeNR:
|
||||||
|
WDSP::ANR::SetANRRun(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NRSchemeNR2:
|
||||||
|
WDSP::EMNR::SetEMNRRun(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nrPosition != settings.m_nrPosition) || force)
|
||||||
|
{
|
||||||
|
switch (settings.m_nrPosition)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::NRPositionPreAGC:
|
||||||
|
WDSP::ANR::SetANRPosition(*m_rxa, 0);
|
||||||
|
WDSP::EMNR::SetEMNRPosition(*m_rxa, 0);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NRPositionPostAGC:
|
||||||
|
WDSP::ANR::SetANRPosition(*m_rxa, 1);
|
||||||
|
WDSP::EMNR::SetEMNRPosition(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nr2Gain != settings.m_nr2Gain) || force)
|
||||||
|
{
|
||||||
|
switch (settings.m_nr2Gain)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::NR2GainLinear:
|
||||||
|
WDSP::EMNR::SetEMNRgainMethod(*m_rxa, 0);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NR2GainLog:
|
||||||
|
WDSP::EMNR::SetEMNRgainMethod(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NR2GainGamma:
|
||||||
|
WDSP::EMNR::SetEMNRgainMethod(*m_rxa, 2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nr2NPE != settings.m_nr2NPE) || force)
|
||||||
|
{
|
||||||
|
switch (settings.m_nr2NPE)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::NR2NPEOSMS:
|
||||||
|
WDSP::EMNR::SetEMNRnpeMethod(*m_rxa, 0);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NR2NPEMMSE:
|
||||||
|
WDSP::EMNR::SetEMNRnpeMethod(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nr2ArtifactReduction != settings.m_nr2ArtifactReduction) || force) {
|
||||||
|
WDSP::EMNR::SetEMNRaeRun(*m_rxa, settings.m_nr2ArtifactReduction ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_anf != settings.m_anf) || force) {
|
||||||
|
WDSP::ANF::SetANFRun(*m_rxa, settings.m_anf ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CW Peaking
|
||||||
|
|
||||||
|
if ((m_settings.m_cwPeaking != settings.m_cwPeaking) || force) {
|
||||||
|
WDSP::SPEAK::SetSPCWRun(*m_rxa, settings.m_cwPeaking ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_cwPeakFrequency != settings.m_cwPeakFrequency) || force) {
|
||||||
|
WDSP::SPEAK::SetSPCWFreq(*m_rxa, settings.m_cwPeakFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_cwBandwidth != settings.m_cwBandwidth) || force) {
|
||||||
|
WDSP::SPEAK::SetSPCWBandwidth(*m_rxa, settings.m_cwBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_cwGain != settings.m_cwGain) || force) {
|
||||||
|
WDSP::SPEAK::SetSPCWGain(*m_rxa, settings.m_cwGain);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Noise Blanker
|
||||||
|
|
||||||
|
if ((m_settings.m_dnb != settings.m_dnb)
|
||||||
|
|| (m_settings.m_nbScheme != settings.m_nbScheme) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBRun(*m_rxa, 0);
|
||||||
|
WDSP::NOB::SetNOBRun(*m_rxa, 0);
|
||||||
|
|
||||||
|
if (settings.m_dnb)
|
||||||
|
{
|
||||||
|
switch(settings.m_nbScheme)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::NBSchemeNB:
|
||||||
|
WDSP::ANB::SetANBRun(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::NBSchemeNB2:
|
||||||
|
WDSP::NOB::SetNOBRun(*m_rxa, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nbSlewTime != settings.m_nbSlewTime) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBTau(*m_rxa, settings.m_nbSlewTime * 0.001);
|
||||||
|
WDSP::NOB::SetNOBTau(*m_rxa, settings.m_nbSlewTime * 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nbLeadTime != settings.m_nbLeadTime) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBAdvtime(*m_rxa, settings.m_nbLeadTime * 0.001);
|
||||||
|
WDSP::NOB::SetNOBAdvtime(*m_rxa, settings.m_nbLeadTime * 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nbLagTime != settings.m_nbLagTime) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBHangtime(*m_rxa, settings.m_nbLagTime * 0.001);
|
||||||
|
WDSP::NOB::SetNOBHangtime(*m_rxa, settings.m_nbLagTime * 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nbThreshold != settings.m_nbThreshold) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBThreshold(*m_rxa, settings.m_nbThreshold);
|
||||||
|
WDSP::NOB::SetNOBThreshold(*m_rxa, settings.m_nbThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_nbAvgTime != settings.m_nbAvgTime) || force)
|
||||||
|
{
|
||||||
|
WDSP::ANB::SetANBBacktau(*m_rxa, settings.m_nbAvgTime * 0.001);
|
||||||
|
WDSP::NOB::SetNOBBacktau(*m_rxa, settings.m_nbAvgTime * 0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
// AM option
|
||||||
|
|
||||||
|
if ((m_settings.m_amFadeLevel != settings.m_amFadeLevel) || force) {
|
||||||
|
WDSP::AMD::SetAMDFadeLevel(*m_rxa, settings.m_amFadeLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FM options
|
||||||
|
|
||||||
|
if ((m_settings.m_fmDeviation != settings.m_fmDeviation) || force) {
|
||||||
|
WDSP::FMD::SetFMDeviation(*m_rxa, settings.m_fmDeviation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_fmAFLow != settings.m_fmAFLow)
|
||||||
|
|| (m_settings.m_fmAFHigh != settings.m_fmAFHigh) || force)
|
||||||
|
{
|
||||||
|
WDSP::FMD::SetFMAFFilter(*m_rxa, settings.m_fmAFLow, settings.m_fmAFHigh);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_fmAFLimiter != settings.m_fmAFLimiter) || force) {
|
||||||
|
WDSP::FMD::SetFMLimRun(*m_rxa, settings.m_fmAFLimiter ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_fmAFLimiterGain != settings.m_fmAFLimiterGain) || force) {
|
||||||
|
WDSP::FMD::SetFMLimGain(*m_rxa, settings.m_fmAFLimiterGain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_fmCTCSSNotch != settings.m_fmCTCSSNotch) || force) {
|
||||||
|
WDSP::FMD::SetCTCSSRun(*m_rxa, settings.m_fmCTCSSNotch ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_fmCTCSSNotchFrequency != settings.m_fmCTCSSNotchFrequency) || force) {
|
||||||
|
WDSP::FMD::SetCTCSSFreq(*m_rxa, settings.m_fmCTCSSNotchFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Squelch
|
||||||
|
|
||||||
|
if ((m_settings.m_squelch != settings.m_squelch)
|
||||||
|
|| (m_settings.m_squelchThreshold != settings.m_squelchThreshold)
|
||||||
|
|| (m_settings.m_squelchMode != settings.m_squelchMode) || force)
|
||||||
|
{
|
||||||
|
WDSP::SSQL::SetSSQLRun(*m_rxa, 0);
|
||||||
|
WDSP::AMSQ::SetAMSQRun(*m_rxa, 0);
|
||||||
|
WDSP::FMSQ::SetFMSQRun(*m_rxa, 0);
|
||||||
|
|
||||||
|
if (settings.m_squelch)
|
||||||
|
{
|
||||||
|
switch(settings.m_squelchMode)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::SquelchModeVoice:
|
||||||
|
{
|
||||||
|
WDSP::SSQL::SetSSQLRun(*m_rxa, 1);
|
||||||
|
double threshold = 0.0075 * settings.m_squelchThreshold;
|
||||||
|
WDSP::SSQL::SetSSQLThreshold(*m_rxa, threshold);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::SquelchModeAM:
|
||||||
|
{
|
||||||
|
WDSP::AMSQ::SetAMSQRun(*m_rxa, 1);
|
||||||
|
double threshold = ((settings.m_squelchThreshold / 100.0) * 160.0) - 160.0;
|
||||||
|
WDSP::AMSQ::SetAMSQThreshold(*m_rxa, threshold);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::SquelchModeFM:
|
||||||
|
{
|
||||||
|
WDSP::FMSQ::SetFMSQRun(*m_rxa, 1);
|
||||||
|
double threshold = pow(10.0, -2.0 * ((double) settings.m_squelchThreshold) / 100.0);
|
||||||
|
qDebug("WDSPRxSink::applySettings: FM squelch %lf", threshold);
|
||||||
|
WDSP::FMSQ::SetFMSQThreshold(*m_rxa, threshold);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_ssqlTauMute != settings.m_ssqlTauMute) || force) {
|
||||||
|
WDSP::SSQL::SetSSQLTauMute(*m_rxa, settings.m_ssqlTauMute);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_ssqlTauUnmute != settings.m_ssqlTauUnmute) || force) {
|
||||||
|
WDSP::SSQL::SetSSQLTauUnMute(*m_rxa, settings.m_ssqlTauUnmute);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_amsqMaxTail != settings.m_amsqMaxTail) || force) {
|
||||||
|
WDSP::AMSQ::SetAMSQMaxTail(*m_rxa, settings.m_amsqMaxTail);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Audio panel
|
||||||
|
|
||||||
|
if ((m_settings.m_volume != settings.m_volume) || force) {
|
||||||
|
WDSP::PANEL::SetPanelGain1(*m_rxa, settings.m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_audioBinaural != settings.m_audioBinaural) || force) {
|
||||||
|
WDSP::PANEL::SetPanelBinaural(*m_rxa, settings.m_audioBinaural ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_audioFlipChannels != settings.m_audioFlipChannels) || force) {
|
||||||
|
WDSP::PANEL::SetPanelCopy(*m_rxa, settings.m_audioFlipChannels ? 3 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// AGC
|
||||||
|
|
||||||
|
if ((m_settings.m_agc != settings.m_agc)
|
||||||
|
|| (m_settings.m_agcMode != settings.m_agcMode)
|
||||||
|
|| (m_settings.m_agcSlope != settings.m_agcSlope)
|
||||||
|
|| (m_settings.m_agcHangThreshold != settings.m_agcHangThreshold)
|
||||||
|
|| (m_settings.m_agcGain != settings.m_agcGain) || force)
|
||||||
|
{
|
||||||
|
WDSP::WCPAGC::SetAGCSlope(*m_rxa, settings.m_agcSlope); // SetRXAAGCSlope(id, rx->agc_slope);
|
||||||
|
WDSP::WCPAGC::SetAGCTop(*m_rxa, (float) settings.m_agcGain); // SetRXAAGCTop(id, rx->agc_gain);
|
||||||
|
|
||||||
|
if (settings.m_agc)
|
||||||
|
{
|
||||||
|
switch (settings.m_agcMode)
|
||||||
|
{
|
||||||
|
case WDSPRxProfile::WDSPRxAGCMode::AGCLong:
|
||||||
|
WDSP::WCPAGC::SetAGCMode(*m_rxa, 1);
|
||||||
|
WDSP::WCPAGC::SetAGCAttack(*m_rxa, 2); // SetRXAAGCAttack(id, 2);
|
||||||
|
WDSP::WCPAGC::SetAGCHang(*m_rxa, 2000); // SetRXAAGCHang(id, 2000);
|
||||||
|
WDSP::WCPAGC::SetAGCDecay(*m_rxa, 2000); // SetRXAAGCDecay(id, 2000);
|
||||||
|
WDSP::WCPAGC::SetAGCHangThreshold(*m_rxa, settings.m_agcHangThreshold); // SetRXAAGCHangThreshold(id, (int)rx->agc_hang_threshold);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::WDSPRxAGCMode::AGCSlow:
|
||||||
|
WDSP::WCPAGC::SetAGCMode(*m_rxa, 2);
|
||||||
|
WDSP::WCPAGC::SetAGCAttack(*m_rxa, 2); // SetRXAAGCAttack(id, 2);
|
||||||
|
WDSP::WCPAGC::SetAGCHang(*m_rxa, 1000); // SetRXAAGCHang(id, 1000);
|
||||||
|
WDSP::WCPAGC::SetAGCDecay(*m_rxa, 500); // SetRXAAGCDecay(id, 500);
|
||||||
|
WDSP::WCPAGC::SetAGCHangThreshold(*m_rxa, settings.m_agcHangThreshold); // SetRXAAGCHangThreshold(id, (int)rx->agc_hang_threshold);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::WDSPRxAGCMode::AGCMedium:
|
||||||
|
WDSP::WCPAGC::SetAGCMode(*m_rxa, 3);
|
||||||
|
WDSP::WCPAGC::SetAGCAttack(*m_rxa, 2); // SetRXAAGCAttack(id, 2);
|
||||||
|
WDSP::WCPAGC::SetAGCHang(*m_rxa, 0); // SetRXAAGCHang(id, 0);
|
||||||
|
WDSP::WCPAGC::SetAGCDecay(*m_rxa, 250); // SetRXAAGCDecay(id, 250);
|
||||||
|
WDSP::WCPAGC::SetAGCHangThreshold(*m_rxa, settings.m_agcHangThreshold); // SetRXAAGCHangThreshold(id, 100);
|
||||||
|
break;
|
||||||
|
case WDSPRxProfile::WDSPRxAGCMode::AGCFast:
|
||||||
|
WDSP::WCPAGC::SetAGCMode(*m_rxa, 4);
|
||||||
|
WDSP::WCPAGC::SetAGCAttack(*m_rxa, 2); // SetRXAAGCAttack(id, 2);
|
||||||
|
WDSP::WCPAGC::SetAGCHang(*m_rxa, 0); // SetRXAAGCHang(id, 0);
|
||||||
|
WDSP::WCPAGC::SetAGCDecay(*m_rxa, 50); // SetRXAAGCDecay(id, 50);
|
||||||
|
WDSP::WCPAGC::SetAGCHangThreshold(*m_rxa, settings.m_agcHangThreshold); // SetRXAAGCHangThreshold(id, 100);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WDSP::WCPAGC::SetAGCMode(*m_rxa, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings = settings;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user