1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 18:43:28 -05:00

WDSP receiver: implemented AGC, Volume, Noise reduction and Noise blanker

This commit is contained in:
f4exb 2024-06-30 22:16:30 +02:00
parent 02a73de41b
commit 5a423e93ba
16 changed files with 514 additions and 141 deletions

View File

@ -77,6 +77,38 @@ void WDSPRxDNBDialog::setNBThreshold(int threshold)
m_nbThreshold = threshold;
}
void WDSPRxDNBDialog::setNB2SlewTime(double time)
{
ui->nb2SlewTime->blockSignals(true);
ui->nb2SlewTime->setValue(time);
ui->nb2SlewTime->blockSignals(false);
m_nb2SlewTime = time;
}
void WDSPRxDNBDialog::setNB2LeadTime(double time)
{
ui->nb2LeadTime->blockSignals(true);
ui->nb2LeadTime->setValue(time);
ui->nb2LeadTime->blockSignals(false);
m_nb2LeadTime = time;
}
void WDSPRxDNBDialog::setNB2LagTime(double time)
{
ui->nb2LagTime->blockSignals(true);
ui->nb2LagTime->setValue(time);
ui->nb2LagTime->blockSignals(false);
m_nb2LagTime = time;
}
void WDSPRxDNBDialog::setNB2Threshold(int threshold)
{
ui->nb2Threshold->blockSignals(true);
ui->nb2Threshold->setValue(threshold);
ui->nb2Threshold->blockSignals(false);
m_nb2Threshold = threshold;
}
void WDSPRxDNBDialog::on_nb_currentIndexChanged(int index)
{
m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) index;
@ -112,3 +144,27 @@ void WDSPRxDNBDialog::on_nbThreshold_valueChanged(int value)
m_nbThreshold = value;
emit valueChanged(ChangedNBThreshold);
}
void WDSPRxDNBDialog::on_nb2SlewTime_valueChanged(double value)
{
m_nb2SlewTime = value;
emit valueChanged(ChangedNB2SlewTime);
}
void WDSPRxDNBDialog::on_nb2LeadTime_valueChanged(double value)
{
m_nb2LeadTime = value;
emit valueChanged(ChangedNB2LeadTime);
}
void WDSPRxDNBDialog::on_nb2LagTime_valueChanged(double value)
{
m_nb2LagTime = value;
emit valueChanged(ChangedNB2LagTime);
}
void WDSPRxDNBDialog::on_nb2Threshold_valueChanged(int value)
{
m_nb2Threshold = value;
emit valueChanged(ChangedNB2Threshold);
}

View File

@ -36,6 +36,10 @@ public:
ChangedNBLeadTime,
ChangedNBLagTime,
ChangedNBThreshold,
ChangedNB2SlewTime,
ChangedNB2LeadTime,
ChangedNB2LagTime,
ChangedNB2Threshold,
};
explicit WDSPRxDNBDialog(QWidget* parent = nullptr);
@ -47,6 +51,10 @@ public:
void setNBLeadTime(double time);
void setNBLagTime(double time);
void setNBThreshold(int threshold);
void setNB2SlewTime(double time);
void setNB2LeadTime(double time);
void setNB2LagTime(double time);
void setNB2Threshold(int threshold);
WDSPRxProfile::WDSPRxNBScheme getNBScheme() const { return m_nbScheme; }
WDSPRxProfile::WDSPRxNB2Mode getNB2Mode() const { return m_nb2Mode; }
@ -54,6 +62,10 @@ public:
double getNBLeadTime() const { return m_nbLeadTime; }
double getNBLagTime() const { return m_nbLagTime; }
int getNBThreshold() const { return m_nbThreshold; }
double getNB2SlewTime() const { return m_nb2SlewTime; }
double getNB2LeadTime() const { return m_nb2LeadTime; }
double getNB2LagTime() const { return m_nb2LagTime; }
int getNB2Threshold() const { return m_nb2Threshold; }
signals:
void valueChanged(int valueChanged);
@ -66,6 +78,10 @@ private:
double m_nbLeadTime;
double m_nbLagTime;
int m_nbThreshold;
double m_nb2SlewTime;
double m_nb2LeadTime;
double m_nb2LagTime;
int m_nb2Threshold;
private slots:
void on_nb_currentIndexChanged(int index);
@ -74,6 +90,10 @@ private slots:
void on_nbLeadTime_valueChanged(double value);
void on_nbLagTime_valueChanged(double value);
void on_nbThreshold_valueChanged(int value);
void on_nb2SlewTime_valueChanged(double value);
void on_nb2LeadTime_valueChanged(double value);
void on_nb2LagTime_valueChanged(double value);
void on_nb2Threshold_valueChanged(int value);
};
#endif // INCLUDE_WDSPRXDNBDIALOG_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>445</width>
<height>197</height>
<width>510</width>
<height>271</height>
</rect>
</property>
<property name="windowTitle">
@ -54,31 +54,10 @@
</item>
<item>
<layout class="QGridLayout" name="nbLayout">
<item row="0" column="0">
<widget class="QLabel" name="nb2ModeLabel">
<property name="text">
<string>NB2 mode</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="nbLeadTimeLabel">
<property name="text">
<string>Lead time (ms)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="nbSlewTimeLabel">
<property name="text">
<string>Slew time (ms)</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="nbLeadTime">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="nb2SlewTime">
<property name="toolTip">
<string>Noise blanking lead time (ms)</string>
<string>Noise blanking slew time (ms)</string>
</property>
<property name="decimals">
<number>4</number>
@ -89,11 +68,21 @@
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="nb2ModeLabel">
<property name="text">
<string>NB2 mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="nb2Mode">
<property name="toolTip">
@ -126,6 +115,20 @@
</item>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="nbLeadTimeLabel">
<property name="text">
<string>NB Lead time (ms)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="nbSlewTimeLabel">
<property name="text">
<string>NB Slew time (ms)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="nbSlewTime">
<property name="toolTip">
@ -148,10 +151,78 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lagTimeLabel">
<item row="3" column="0">
<widget class="QLabel" name="nb2SlewTimeLabel">
<property name="text">
<string>Lag time (ms)</string>
<string>NB2 Slew time (ms)</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="nbThresholdLabel">
<property name="text">
<string>NB Threshold</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="nbLeadTime">
<property name="toolTip">
<string>Noise blanking lead time (ms)</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="nb2LeadTime">
<property name="toolTip">
<string>Noise blanking lead time (ms)</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="nbThreshold">
<property name="toolTip">
<string>Noise blanking threshold</string>
</property>
<property name="minimum">
<number>15</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="nb2LeadTimeLabel">
<property name="text">
<string>NB2 Lead time (ms)</string>
</property>
</widget>
</item>
@ -174,15 +245,48 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="nbThresholdLabel">
<item row="2" column="0">
<widget class="QLabel" name="nbLagTimeLabel">
<property name="text">
<string>Threshold</string>
<string>NB Lag time (ms)</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="nbThreshold">
<item row="4" column="0">
<widget class="QLabel" name="nb2lagTimeLabe">
<property name="text">
<string>NB2 Lag time (ms)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="nb2LagTime">
<property name="toolTip">
<string>Noise blanking lag time (ms)</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="nb2ThresholdLabel">
<property name="text">
<string>NB2 Threshold</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="nb2Threshold">
<property name="toolTip">
<string>Noise blanking threshold</string>
</property>

View File

@ -787,8 +787,13 @@ void WDSPRxGUI::dnbSetupDialog(const QPoint& p)
m_dnbDialog->setNBScheme(m_settings.m_nbScheme);
m_dnbDialog->setNB2Mode(m_settings.m_nb2Mode);
m_dnbDialog->setNBSlewTime(m_settings.m_nbSlewTime);
m_dnbDialog->setNBLeadTime(m_settings.m_nbLagTime);
m_dnbDialog->setNBLeadTime(m_settings.m_nbLeadTime);
m_dnbDialog->setNBLagTime(m_settings.m_nbLagTime);
m_dnbDialog->setNBThreshold(m_settings.m_nbThreshold);
m_dnbDialog->setNB2SlewTime(m_settings.m_nb2SlewTime);
m_dnbDialog->setNB2LeadTime(m_settings.m_nb2LeadTime);
m_dnbDialog->setNB2LagTime(m_settings.m_nb2LagTime);
m_dnbDialog->setNB2Threshold(m_settings.m_nb2Threshold);
QObject::connect(m_dnbDialog, &WDSPRxDNBDialog::valueChanged, this, &WDSPRxGUI::dnbSetup);
m_dnbDialog->exec();
QObject::disconnect(m_dnbDialog, &WDSPRxDNBDialog::valueChanged, this, &WDSPRxGUI::dnbSetup);
@ -836,6 +841,26 @@ void WDSPRxGUI::dnbSetup(int32_t iValueChanged)
m_settings.m_profiles[m_settings.m_profileIndex].m_nbThreshold = m_settings.m_nbThreshold;
applySettings();
break;
case WDSPRxDNBDialog::ValueChanged::ChangedNB2SlewTime:
m_settings.m_nb2SlewTime = m_dnbDialog->getNB2SlewTime();
m_settings.m_profiles[m_settings.m_profileIndex].m_nb2SlewTime = m_settings.m_nb2SlewTime;
applySettings();
break;
case WDSPRxDNBDialog::ValueChanged::ChangedNB2LeadTime:
m_settings.m_nb2LeadTime = m_dnbDialog->getNB2LeadTime();
m_settings.m_profiles[m_settings.m_profileIndex].m_nb2LeadTime = m_settings.m_nb2LeadTime;
applySettings();
break;
case WDSPRxDNBDialog::ValueChanged::ChangedNB2LagTime:
m_settings.m_nb2LagTime = m_dnbDialog->getNB2LagTime();
m_settings.m_profiles[m_settings.m_profileIndex].m_nb2LagTime = m_settings.m_nb2LagTime;
applySettings();
break;
case WDSPRxDNBDialog::ValueChanged::ChangedNB2Threshold:
m_settings.m_nb2Threshold = m_dnbDialog->getNB2Threshold();
m_settings.m_profiles[m_settings.m_profileIndex].m_nb2Threshold = m_settings.m_nb2Threshold;
applySettings();
break;
default:
break;
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>414</width>
<height>190</height>
<height>179</height>
</rect>
</property>
<property name="sizePolicy">
@ -777,10 +777,10 @@
<string>Audio volume in dB</string>
</property>
<property name="minimum">
<number>-10</number>
<number>-20</number>
</property>
<property name="maximum">
<number>40</number>
<number>20</number>
</property>
<property name="pageStep">
<number>1</number>
@ -829,7 +829,7 @@
</size>
</property>
<property name="toolTip">
<string>AGC time constant (ms in log2 steps)</string>
<string>AGC level</string>
</property>
<property name="minimum">
<number>-20</number>

View File

@ -215,28 +215,28 @@ bool WDSPRxSettings::deserialize(const QByteArray& data)
d.readS32( 14, &m_agcSlope, 35);
d.readS32( 15, &m_agcHangThreshold, 0);
// Noise blanker
d.readBool( 29, &m_dnb, false);
d.readS32( 24, &tmp, 2);
d.readBool( 20, &m_dnb, false);
d.readS32( 21, &tmp, 2);
m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) tmp;
d.readS32( 29, &tmp, 2);
d.readS32( 22, &tmp, 2);
m_nb2Mode = (WDSPRxProfile::WDSPRxNB2Mode) tmp;
d.readDouble(30, &m_nbSlewTime, 0.01);
d.readDouble(31, &m_nbLeadTime, 0.01);
d.readDouble(32, &m_nbLagTime, 0.01);
d.readS32( 33, &m_nbThreshold, 30);
d.readDouble(23, &m_nbSlewTime, 0.01);
d.readDouble(24, &m_nbLeadTime, 0.01);
d.readDouble(25, &m_nbLagTime, 0.01);
d.readS32( 26, &m_nbThreshold, 30);
// Nosie reduction
d.readBool( 29, &m_dnr, false);
d.readBool( 21, &m_snb, false);
d.readBool( 22, &m_anf, false);
d.readS32( 23, &tmp, 2);
d.readBool( 30, &m_dnr, false);
d.readBool( 31, &m_snb, false);
d.readBool( 32, &m_anf, false);
d.readS32( 33, &tmp, 2);
m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp;
d.readS32( 25, &tmp, 2);
d.readS32( 34, &tmp, 2);
m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp;
d.readS32( 26, &tmp, 2);
d.readS32( 35, &tmp, 2);
m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp;
d.readS32( 27, &tmp, 2);
d.readS32( 36, &tmp, 2);
m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp;
d.readBool( 28, &m_nr2ArtifactReduction, true);
d.readBool( 37, &m_nr2ArtifactReduction, true);
//
d.readString(70, &m_title, "WDSP Receiver");
d.readString(71, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);

View File

@ -85,10 +85,14 @@ struct WDSPRxProfile
bool m_dnb;
WDSPRxNBScheme m_nbScheme;
WDSPRxNB2Mode m_nb2Mode;
double m_nbSlewTime;
double m_nbSlewTime; // a.k.a tau
double m_nbLeadTime;
double m_nbLagTime;
int m_nbThreshold;
double m_nb2SlewTime; // a.k.a tau
double m_nb2LeadTime;
double m_nb2LagTime;
int m_nb2Threshold;
// Noise rediction
bool m_dnr;
bool m_snb;
@ -116,6 +120,10 @@ struct WDSPRxProfile
m_nbLeadTime(0.01),
m_nbLagTime(0.01),
m_nbThreshold(30),
m_nb2SlewTime(0.01),
m_nb2LeadTime(0.01),
m_nb2LagTime(0.01),
m_nb2Threshold(30),
m_dnr(false),
m_snb(false),
m_anf(false),
@ -152,6 +160,10 @@ struct WDSPRxSettings
double m_nbLeadTime;
double m_nbLagTime;
int m_nbThreshold;
double m_nb2SlewTime;
double m_nb2LeadTime;
double m_nb2LagTime;
int m_nb2Threshold;
// Noise reduction
bool m_dnr;
bool m_snb;

View File

@ -30,6 +30,12 @@
#include "meter.hpp"
#include "patchpanel.hpp"
#include "wcpAGC.hpp"
#include "anr.hpp"
#include "emnr.hpp"
#include "snb.hpp"
#include "anf.hpp"
#include "anb.hpp"
#include "nob.hpp"
#include "wdsprxsink.h"
@ -97,7 +103,6 @@ WDSPRxSink::WDSPRxSink() :
m_audioSampleRate(48000)
{
m_Bandwidth = 5000;
m_volume = 2.0;
m_channelSampleRate = 48000;
m_channelFrequencyOffset = 0;
@ -195,18 +200,18 @@ void WDSPRxSink::processOneSample(Complex &ci)
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_volume;
m_audioBuffer[m_audioBufferFill].l = zi * m_volume;
m_audioBuffer[m_audioBufferFill].r = zr;
m_audioBuffer[m_audioBufferFill].l = zi;
if (m_settings.m_audioBinaural)
{
m_demodBuffer[m_demodBufferFill++] = zr * m_volume;
m_demodBuffer[m_demodBufferFill++] = zi * m_volume;
m_demodBuffer[m_demodBufferFill++] = zr;
m_demodBuffer[m_demodBufferFill++] = zi;
}
else
{
Real demod = (zr + zi) * 0.7;
qint16 sample = (qint16)(demod * m_volume);
qint16 sample = (qint16)(demod);
m_demodBuffer[m_demodBufferFill++] = sample;
}
@ -346,6 +351,8 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
<< " force: " << force;
// Filter
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) ||
@ -413,60 +420,160 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force)
m_spectrumProbe.setSpanLog2(settings.m_profiles[settings.m_profileIndex].m_spanLog2);
}
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::SetAGCMode(*m_rxa, settings.m_agc ? (int) settings.m_agcMode + 1 : 0); // SetRXAAGCMode(id, agc);
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);
// Noise Reduction
if (settings.m_agc)
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_agcMode)
switch (settings.m_nrScheme)
{
case WDSPRxProfile::WDSPRxAGCMode::AGCLong:
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);
case WDSPRxProfile::NRSchemeNR:
WDSP::ANR::SetANRRun(*m_rxa, 1);
break;
case WDSPRxProfile::WDSPRxAGCMode::AGCSlow:
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);
case WDSPRxProfile::NRSchemeNR2:
WDSP::EMNR::SetEMNRRun(*m_rxa, 1);
break;
case WDSPRxProfile::WDSPRxAGCMode::AGCMedium:
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::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);
default:
break;
}
WDSP::WCPAGC::SetAGCFixed(*m_rxa, 60.0f); // default
}
else
{
WDSP::WCPAGC::SetAGCFixed(*m_rxa, (float) settings.m_agcGain);
}
}
if ((m_settings.m_volume != settings.m_volume) || force)
if ((m_settings.m_nrPosition != settings.m_nrPosition) || force)
{
m_volume = settings.m_volume;
m_volume /= 4.0; // for 3276.8
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_snb != settings.m_snb) || force) {
WDSP::SNBA::SetSNBARun(*m_rxa, settings.m_snb ? 1 : 0);
}
if ((m_settings.m_anf != settings.m_anf) || force) {
WDSP::ANF::SetANFRun(*m_rxa, settings.m_anf ? 1 : 0);
}
// 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);
}
if ((m_settings.m_nbLeadTime != settings.m_nbLeadTime) || force) {
WDSP::ANB::SetANBAdvtime(*m_rxa, settings.m_nbLeadTime);
}
if ((m_settings.m_nbLagTime != settings.m_nbLagTime) || force) {
WDSP::ANB::SetANBHangtime(*m_rxa, settings.m_nbLagTime);
}
if ((m_settings.m_nbThreshold != settings.m_nbThreshold) || force) {
WDSP::ANB::SetANBThreshold(*m_rxa, settings.m_nbThreshold);
}
if ((m_settings.m_nb2SlewTime != settings.m_nb2SlewTime) || force) {
WDSP::NOB::SetNOBTau(*m_rxa, settings.m_nb2SlewTime);
}
if ((m_settings.m_nb2LeadTime != settings.m_nb2LeadTime) || force) {
WDSP::NOB::SetNOBAdvtime(*m_rxa, settings.m_nb2LeadTime);
}
if ((m_settings.m_nb2LagTime != settings.m_nb2LagTime) || force) {
WDSP::NOB::SetNOBHangtime(*m_rxa, settings.m_nb2LagTime);
}
if ((m_settings.m_nb2Threshold != settings.m_nb2Threshold) || force) {
WDSP::NOB::SetNOBThreshold(*m_rxa, settings.m_nb2Threshold);
}
// Audio panel
if ((m_settings.m_volume != settings.m_volume) || force) {
WDSP::PANEL::SetPanelGain1(*m_rxa, settings.m_volume);
}
// if ((m_settings.m_volume != settings.m_volume) || force)
// {
// m_volume = settings.m_volume;
// m_volume /= 4.0; // for 3276.8
// }
if ((m_settings.m_audioBinaural != settings.m_audioBinaural) || force) {
WDSP::PANEL::SetPanelBinaural(*m_rxa, settings.m_audioBinaural ? 1 : 0);
}
@ -475,5 +582,56 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool 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;
}

View File

@ -89,7 +89,6 @@ private:
ChannelAPI *m_channel;
Real m_Bandwidth;
Real m_volume;
int m_undersampleCount;
int m_channelSampleRate;
int m_channelFrequencyOffset;

View File

@ -98,7 +98,7 @@ RXA* RXA::create_rxa (
0.0001, // hang time
0.0001, // advance time
0.05, // back tau
30.0 // thershold
30 // thershold
);
// Noise blanker (NOB or "NB2")
rxa->nob.p = NOB::create_nob(

View File

@ -42,7 +42,6 @@ class RESAMPLE;
class GEN;
class BANDPASS;
class BPS;
class SNB;
class NOTCHDB;
class NBP;
class BPSNBA;

View File

@ -209,7 +209,7 @@ void ANB::setSize_anb (ANB *a, int size)
* *
********************************************************************************************************/
void ANB::SetRXAANBRun (RXA& rxa, int run)
void ANB::SetANBRun (RXA& rxa, int run)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -217,7 +217,7 @@ void ANB::SetRXAANBRun (RXA& rxa, int run)
a->cs_update.unlock();
}
void ANB::SetRXAANBBuffsize (RXA& rxa, int size)
void ANB::SetANBBuffsize (RXA& rxa, int size)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -225,7 +225,7 @@ void ANB::SetRXAANBBuffsize (RXA& rxa, int size)
a->cs_update.unlock();
}
void ANB::SetRXAANBSamplerate (RXA& rxa, int rate)
void ANB::SetANBSamplerate (RXA& rxa, int rate)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -234,7 +234,7 @@ void ANB::SetRXAANBSamplerate (RXA& rxa, int rate)
a->cs_update.unlock();
}
void ANB::SetRXAANBTau (RXA& rxa, double tau)
void ANB::SetANBTau (RXA& rxa, double tau)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -243,7 +243,7 @@ void ANB::SetRXAANBTau (RXA& rxa, double tau)
a->cs_update.unlock();
}
void ANB::SetRXAANBHangtime (RXA& rxa, double time)
void ANB::SetANBHangtime (RXA& rxa, double time)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -252,7 +252,7 @@ void ANB::SetRXAANBHangtime (RXA& rxa, double time)
a->cs_update.unlock();
}
void ANB::SetRXAANBAdvtime (RXA& rxa, double time)
void ANB::SetANBAdvtime (RXA& rxa, double time)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -261,7 +261,7 @@ void ANB::SetRXAANBAdvtime (RXA& rxa, double time)
a->cs_update.unlock();
}
void ANB::SetRXAANBBacktau (RXA& rxa, double tau)
void ANB::SetANBBacktau (RXA& rxa, double tau)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();
@ -270,7 +270,7 @@ void ANB::SetRXAANBBacktau (RXA& rxa, double tau)
a->cs_update.unlock();
}
void ANB::SetRXAANBThreshold (RXA& rxa, double thresh)
void ANB::SetANBThreshold (RXA& rxa, double thresh)
{
ANB *a = rxa.anb.p;
a->cs_update.lock();

View File

@ -89,14 +89,14 @@ public:
static void setSamplerate_anb (ANB *a, int rate);
static void setSize_anb (ANB *a, int size);
// RXA
static void SetRXAANBRun (RXA& rxa, int run);
static void SetRXAANBBuffsize (RXA& rxa, int size);
static void SetRXAANBSamplerate (RXA& rxa, int rate);
static void SetRXAANBTau (RXA& rxa, double tau);
static void SetRXAANBHangtime (RXA& rxa, double time);
static void SetRXAANBAdvtime (RXA& rxa, double time);
static void SetRXAANBBacktau (RXA& rxa, double tau);
static void SetRXAANBThreshold (RXA& rxa, double thresh);
static void SetANBRun (RXA& rxa, int run);
static void SetANBBuffsize (RXA& rxa, int size);
static void SetANBSamplerate (RXA& rxa, int rate);
static void SetANBTau (RXA& rxa, double tau);
static void SetANBHangtime (RXA& rxa, double time);
static void SetANBAdvtime (RXA& rxa, double time);
static void SetANBBacktau (RXA& rxa, double tau);
static void SetANBThreshold (RXA& rxa, double thresh);
private:
static void initBlanker(ANB *a); //////////// legacy interface - remove

View File

@ -519,7 +519,7 @@ void NOB::setSize_nob (NOB *a, int size)
* *
********************************************************************************************************/
void NOB::SetRXANOBRun (RXA& rxa, int run)
void NOB::SetNOBRun (RXA& rxa, int run)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -527,7 +527,7 @@ void NOB::SetRXANOBRun (RXA& rxa, int run)
a->cs_update.unlock();
}
void NOB::SetRXANOBMode (RXA& rxa, int mode)
void NOB::SetNOBMode (RXA& rxa, int mode)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -535,7 +535,7 @@ void NOB::SetRXANOBMode (RXA& rxa, int mode)
a->cs_update.unlock();
}
void NOB::SetRXANOBBuffsize (RXA& rxa, int size)
void NOB::SetNOBBuffsize (RXA& rxa, int size)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -543,7 +543,7 @@ void NOB::SetRXANOBBuffsize (RXA& rxa, int size)
a->cs_update.unlock();
}
void NOB::SetRXANOBSamplerate (RXA& rxa, int rate)
void NOB::SetNOBSamplerate (RXA& rxa, int rate)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -552,7 +552,7 @@ void NOB::SetRXANOBSamplerate (RXA& rxa, int rate)
a->cs_update.unlock();
}
void NOB::SetRXANOBTau (RXA& rxa, double tau)
void NOB::SetNOBTau (RXA& rxa, double tau)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -562,7 +562,7 @@ void NOB::SetRXANOBTau (RXA& rxa, double tau)
a->cs_update.unlock();
}
void NOB::SetRXANOBHangtime (RXA& rxa, double time)
void NOB::SetNOBHangtime (RXA& rxa, double time)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -571,7 +571,7 @@ void NOB::SetRXANOBHangtime (RXA& rxa, double time)
a->cs_update.unlock();
}
void NOB::SetRXANOBAdvtime (RXA& rxa, double time)
void NOB::SetNOBAdvtime (RXA& rxa, double time)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -580,7 +580,7 @@ void NOB::SetRXANOBAdvtime (RXA& rxa, double time)
a->cs_update.unlock();
}
void NOB::SetRXANOBBacktau (RXA& rxa, double tau)
void NOB::SetNOBBacktau (RXA& rxa, double tau)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();
@ -589,7 +589,7 @@ void NOB::SetRXANOBBacktau (RXA& rxa, double tau)
a->cs_update.unlock();
}
void NOB::SetRXANOBThreshold (RXA& rxa, double thresh)
void NOB::SetNOBThreshold (RXA& rxa, double thresh)
{
NOB *a = rxa.nob.p;
a->cs_update.lock();

View File

@ -109,15 +109,15 @@ public:
static void setSamplerate_nob (NOB *a, int rate);
static void setSize_nob (NOB *a, int size);
// RXA
static void SetRXANOBRun (RXA& rxa, int run);
static void SetRXANOBMode (RXA& rxa, int mode);
static void SetRXANOBBuffsize (RXA& rxa, int size);
static void SetRXANOBSamplerate (RXA& rxa, int size);
static void SetRXANOBTau (RXA& rxa, double tau);
static void SetRXANOBHangtime (RXA& rxa, double time);
static void SetRXANOBAdvtime (RXA& rxa, double time);
static void SetRXANOBBacktau (RXA& rxa, double tau);
static void SetRXANOBThreshold (RXA& rxa, double thresh);
static void SetNOBRun (RXA& rxa, int run);
static void SetNOBMode (RXA& rxa, int mode);
static void SetNOBBuffsize (RXA& rxa, int size);
static void SetNOBSamplerate (RXA& rxa, int size);
static void SetNOBTau (RXA& rxa, double tau);
static void SetNOBHangtime (RXA& rxa, double time);
static void SetNOBAdvtime (RXA& rxa, double time);
static void SetNOBBacktau (RXA& rxa, double tau);
static void SetNOBThreshold (RXA& rxa, double thresh);
private:
static void init_nob (NOB *a);

View File

@ -49,7 +49,7 @@ public:
float* in;
float* out;
int io_buffsize;
float sample_rate;
double sample_rate;
double tau_attack;
double tau_decay;
@ -106,7 +106,6 @@ public:
double hang_decay_mult;
int decay_type;
static void loadWcpAGC (WCPAGC *a);
static void xwcpagc (WCPAGC *a);
static WCPAGC* create_wcpagc (
int run,
@ -167,6 +166,7 @@ public:
static void SetALCMaxGain (TXA& txa, float maxgain);
private:
static void loadWcpAGC (WCPAGC *a);
static void calc_wcpagc (WCPAGC *a);
static void decalc_wcpagc (WCPAGC *a);
};