From 74cc488383185d64242b30808447fab00415826c Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 27 Jun 2024 03:39:25 +0200 Subject: [PATCH] WDSP Receiver: GUI updates --- plugins/channelrx/wdsprx/CMakeLists.txt | 9 + plugins/channelrx/wdsprx/wdsprx.cpp | 56 ++-- plugins/channelrx/wdsprx/wdsprxagcdialog.cpp | 76 ++++++ plugins/channelrx/wdsprx/wdsprxagcdialog.h | 65 +++++ plugins/channelrx/wdsprx/wdsprxagcdialog.ui | 222 +++++++++++++++ plugins/channelrx/wdsprx/wdsprxbaseband.cpp | 8 +- plugins/channelrx/wdsprx/wdsprxdnbdialog.cpp | 114 ++++++++ plugins/channelrx/wdsprx/wdsprxdnbdialog.h | 79 ++++++ plugins/channelrx/wdsprx/wdsprxdnbdialog.ui | 249 +++++++++++++++++ plugins/channelrx/wdsprx/wdsprxdnrdialog.cpp | 128 +++++++++ plugins/channelrx/wdsprx/wdsprxdnrdialog.h | 84 ++++++ plugins/channelrx/wdsprx/wdsprxdnrdialog.ui | 210 ++++++++++++++ plugins/channelrx/wdsprx/wdsprxgui.cpp | 272 ++++++++++++++----- plugins/channelrx/wdsprx/wdsprxgui.h | 15 +- plugins/channelrx/wdsprx/wdsprxgui.ui | 13 + plugins/channelrx/wdsprx/wdsprxsettings.cpp | 262 ++++++++++++------ plugins/channelrx/wdsprx/wdsprxsettings.h | 147 +++++++--- plugins/channelrx/wdsprx/wdsprxsink.cpp | 34 +-- 18 files changed, 1816 insertions(+), 227 deletions(-) create mode 100644 plugins/channelrx/wdsprx/wdsprxagcdialog.cpp create mode 100644 plugins/channelrx/wdsprx/wdsprxagcdialog.h create mode 100644 plugins/channelrx/wdsprx/wdsprxagcdialog.ui create mode 100644 plugins/channelrx/wdsprx/wdsprxdnbdialog.cpp create mode 100644 plugins/channelrx/wdsprx/wdsprxdnbdialog.h create mode 100644 plugins/channelrx/wdsprx/wdsprxdnbdialog.ui create mode 100644 plugins/channelrx/wdsprx/wdsprxdnrdialog.cpp create mode 100644 plugins/channelrx/wdsprx/wdsprxdnrdialog.h create mode 100644 plugins/channelrx/wdsprx/wdsprxdnrdialog.ui diff --git a/plugins/channelrx/wdsprx/CMakeLists.txt b/plugins/channelrx/wdsprx/CMakeLists.txt index bb3b9f1d5..fba4e9d31 100644 --- a/plugins/channelrx/wdsprx/CMakeLists.txt +++ b/plugins/channelrx/wdsprx/CMakeLists.txt @@ -26,12 +26,21 @@ include_directories( if(NOT SERVER_MODE) set(wdsprx_SOURCES ${wdsprx_SOURCES} + wdsprxagcdialog.cpp + wdsprxagcdialog.ui + wdsprxdnbdialog.cpp + wdsprxdnbdialog.ui + wdsprxdnrdialog.cpp + wdsprxdnrdialog.ui wdsprxgui.cpp wdsprxgui.ui ) set(wdsprx_HEADERS ${wdsprx_HEADERS} wdsprxgui.h + wdsprxagcdialog.h + wdsprxdnbdialog.h + wdsprxdnrdialog.h ) set(TARGET_NAME wdsprx) set(TARGET_LIB "Qt::Widgets") diff --git a/plugins/channelrx/wdsprx/wdsprx.cpp b/plugins/channelrx/wdsprx/wdsprx.cpp index 0f1149e40..ae9e3e47b 100644 --- a/plugins/channelrx/wdsprx/wdsprx.cpp +++ b/plugins/channelrx/wdsprx/wdsprx.cpp @@ -249,11 +249,11 @@ void WDSPRx::applySettings(const WDSPRxSettings& settings, bool force) { qDebug() << "WDSPRx::applySettings:" << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset - << " m_filterIndex: " << settings.m_filterIndex - << " [m_spanLog2: " << settings.m_filterBank[settings.m_filterIndex].m_spanLog2 - << " m_highCutoff: " << settings.m_filterBank[settings.m_filterIndex].m_highCutoff - << " m_lowCutoff: " << settings.m_filterBank[settings.m_filterIndex].m_lowCutoff - << " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]" + << " 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_audioBinaual: " << settings.m_audioBinaural << " m_audioFlipChannels: " << settings.m_audioFlipChannels @@ -278,19 +278,19 @@ void WDSPRx::applySettings(const WDSPRxSettings& settings, bool force) if ((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force) { reverseAPIKeys.append("inputFrequencyOffset"); } - if ((m_settings.m_filterIndex != settings.m_filterIndex) || force) { + if ((m_settings.m_profileIndex != settings.m_profileIndex) || force) { reverseAPIKeys.append("filterIndex"); } - if ((m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2 != settings.m_filterBank[settings.m_filterIndex].m_spanLog2) || force) { + if ((m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 != settings.m_profiles[settings.m_profileIndex].m_spanLog2) || force) { reverseAPIKeys.append("spanLog2"); } - if ((m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff != settings.m_filterBank[settings.m_filterIndex].m_highCutoff) || force) { + if ((m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff != settings.m_profiles[settings.m_profileIndex].m_highCutoff) || force) { reverseAPIKeys.append("rfBandwidth"); } - if ((m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff != settings.m_filterBank[settings.m_filterIndex].m_lowCutoff) || force) { + if ((m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff != settings.m_profiles[settings.m_profileIndex].m_lowCutoff) || force) { reverseAPIKeys.append("lowCutoff"); } - if ((m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow != settings.m_filterBank[settings.m_filterIndex].m_fftWindow) || force) { + if ((m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow != settings.m_profiles[settings.m_profileIndex].m_fftWindow) || force) { reverseAPIKeys.append("fftWindow"); } if ((m_settings.m_volume != settings.m_volume) || force) { @@ -331,12 +331,12 @@ void WDSPRx::applySettings(const WDSPRxSettings& settings, bool force) } if ((settings.m_dsb != m_settings.m_dsb) - || (settings.m_filterBank[settings.m_filterIndex].m_highCutoff != m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff) - || (settings.m_filterBank[settings.m_filterIndex].m_lowCutoff != m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff) || force) + || (settings.m_profiles[settings.m_profileIndex].m_highCutoff != m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff) + || (settings.m_profiles[settings.m_profileIndex].m_lowCutoff != m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff) || force) { SpectrumSettings spectrumSettings = m_spectrumVis.getSettings(); spectrumSettings.m_ssb = !settings.m_dsb; - spectrumSettings.m_usb = (settings.m_filterBank[settings.m_filterIndex].m_lowCutoff < settings.m_filterBank[settings.m_filterIndex].m_highCutoff); + spectrumSettings.m_usb = (settings.m_profiles[settings.m_profileIndex].m_lowCutoff < settings.m_profiles[settings.m_profileIndex].m_highCutoff); SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false); m_spectrumVis.getInputMessageQueue()->push(msg); } @@ -466,19 +466,19 @@ void WDSPRx::webapiUpdateChannelSettings( settings.m_inputFrequencyOffset = response.getSsbDemodSettings()->getInputFrequencyOffset(); } if (channelSettingsKeys.contains("filterIndex")) { - settings.m_filterIndex = response.getSsbDemodSettings()->getFilterIndex(); + settings.m_profileIndex = response.getSsbDemodSettings()->getFilterIndex(); } if (channelSettingsKeys.contains("spanLog2")) { - settings.m_filterBank[settings.m_filterIndex].m_spanLog2 = response.getSsbDemodSettings()->getSpanLog2(); + settings.m_profiles[settings.m_profileIndex].m_spanLog2 = response.getSsbDemodSettings()->getSpanLog2(); } if (channelSettingsKeys.contains("rfBandwidth")) { - settings.m_filterBank[settings.m_filterIndex].m_highCutoff = response.getSsbDemodSettings()->getRfBandwidth(); + settings.m_profiles[settings.m_profileIndex].m_highCutoff = response.getSsbDemodSettings()->getRfBandwidth(); } if (channelSettingsKeys.contains("lowCutoff")) { - settings.m_filterBank[settings.m_filterIndex].m_lowCutoff = response.getSsbDemodSettings()->getLowCutoff(); + settings.m_profiles[settings.m_profileIndex].m_lowCutoff = response.getSsbDemodSettings()->getLowCutoff(); } if (channelSettingsKeys.contains("fftWimdow")) { - settings.m_filterBank[settings.m_filterIndex].m_fftWindow = (FFTWindow::Function) response.getSsbDemodSettings()->getFftWindow(); + settings.m_profiles[settings.m_profileIndex].m_fftWindow = (FFTWindow::Function) response.getSsbDemodSettings()->getFftWindow(); } if (channelSettingsKeys.contains("volume")) { settings.m_volume = response.getSsbDemodSettings()->getVolume(); @@ -551,11 +551,11 @@ void WDSPRx::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon { response.getSsbDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0); response.getSsbDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); - response.getSsbDemodSettings()->setFilterIndex(settings.m_filterIndex); - response.getSsbDemodSettings()->setSpanLog2(settings.m_filterBank[settings.m_filterIndex].m_spanLog2); - response.getSsbDemodSettings()->setRfBandwidth(settings.m_filterBank[settings.m_filterIndex].m_highCutoff); - response.getSsbDemodSettings()->setLowCutoff(settings.m_filterBank[settings.m_filterIndex].m_lowCutoff); - response.getSsbDemodSettings()->setFftWindow((int) settings.m_filterBank[settings.m_filterIndex].m_fftWindow); + response.getSsbDemodSettings()->setFilterIndex(settings.m_profileIndex); + response.getSsbDemodSettings()->setSpanLog2(settings.m_profiles[settings.m_profileIndex].m_spanLog2); + response.getSsbDemodSettings()->setRfBandwidth(settings.m_profiles[settings.m_profileIndex].m_highCutoff); + response.getSsbDemodSettings()->setLowCutoff(settings.m_profiles[settings.m_profileIndex].m_lowCutoff); + response.getSsbDemodSettings()->setFftWindow((int) settings.m_profiles[settings.m_profileIndex].m_fftWindow); response.getSsbDemodSettings()->setVolume(settings.m_volume); response.getSsbDemodSettings()->setAudioBinaural(settings.m_audioBinaural ? 1 : 0); response.getSsbDemodSettings()->setAudioFlipChannels(settings.m_audioFlipChannels ? 1 : 0); @@ -720,19 +720,19 @@ void WDSPRx::webapiFormatChannelSettings( swgSSBDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); } if (channelSettingsKeys.contains("filteIndex") || force) { - swgSSBDemodSettings->setFilterIndex(settings.m_filterIndex); + swgSSBDemodSettings->setFilterIndex(settings.m_profileIndex); } if (channelSettingsKeys.contains("spanLog2") || force) { - swgSSBDemodSettings->setSpanLog2(settings.m_filterBank[settings.m_filterIndex].m_spanLog2); + swgSSBDemodSettings->setSpanLog2(settings.m_profiles[settings.m_profileIndex].m_spanLog2); } if (channelSettingsKeys.contains("rfBandwidth") || force) { - swgSSBDemodSettings->setRfBandwidth(settings.m_filterBank[settings.m_filterIndex].m_highCutoff); + swgSSBDemodSettings->setRfBandwidth(settings.m_profiles[settings.m_profileIndex].m_highCutoff); } if (channelSettingsKeys.contains("lowCutoff") || force) { - swgSSBDemodSettings->setLowCutoff(settings.m_filterBank[settings.m_filterIndex].m_lowCutoff); + swgSSBDemodSettings->setLowCutoff(settings.m_profiles[settings.m_profileIndex].m_lowCutoff); } if (channelSettingsKeys.contains("fftWindow") || force) { - swgSSBDemodSettings->setLowCutoff(settings.m_filterBank[settings.m_filterIndex].m_fftWindow); + swgSSBDemodSettings->setLowCutoff(settings.m_profiles[settings.m_profileIndex].m_fftWindow); } if (channelSettingsKeys.contains("volume") || force) { swgSSBDemodSettings->setVolume(settings.m_volume); diff --git a/plugins/channelrx/wdsprx/wdsprxagcdialog.cpp b/plugins/channelrx/wdsprx/wdsprxagcdialog.cpp new file mode 100644 index 000000000..c910366df --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxagcdialog.cpp @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// + +#include "wdsprxagcdialog.h" +#include "ui_wdsprxagcdialog.h" + +WDSPRxAGCDialog::WDSPRxAGCDialog(QWidget* parent) : + QDialog(parent), + ui(new Ui::WDSPRxAGCDialog) +{ + ui->setupUi(this); +} + +WDSPRxAGCDialog::~WDSPRxAGCDialog() +{ + delete ui; +} + +void WDSPRxAGCDialog::setAGCMode(WDSPRxProfile::WDSPRxAGCMode mode) +{ + ui->agcMode->blockSignals(true); + ui->agcMode->setCurrentIndex((int) mode); + ui->agcMode->blockSignals(false); + m_agcMode = mode; +} + +void WDSPRxAGCDialog::setAGCSlope(int slope) +{ + ui->agcSlope->blockSignals(true); + ui->agcSlope->setValue(slope); + ui->agcSlopeText->setText(tr("%1 dB").arg(slope/10.0, 0, 'f', 1)); + ui->agcSlope->blockSignals(false); + m_agcSlope = slope; +} + +void WDSPRxAGCDialog::setAGCHangThreshold(int hangThreshold) +{ + ui->agcHangThreshold->blockSignals(true); + ui->agcHangThreshold->setValue(hangThreshold); + ui->agcHangThresholdText->setText(tr("%1").arg(hangThreshold)); + ui->agcHangThreshold->blockSignals(false); +} + +void WDSPRxAGCDialog::on_agcMode_currentIndexChanged(int index) +{ + m_agcMode = (WDSPRxProfile::WDSPRxAGCMode) index; + emit valueChanged(ChangedMode); +} + +void WDSPRxAGCDialog::on_agcSlope_valueChanged(int value) +{ + m_agcSlope = value; + ui->agcSlopeText->setText(tr("%1 dB").arg(value/10.0, 0, 'f', 1)); + emit valueChanged(ChangedSlope); +} + +void WDSPRxAGCDialog::on_agcHangThreshold_valueChanged(int value) +{ + m_agcHangThreshold = value; + ui->agcHangThresholdText->setText(tr("%1").arg(value)); + emit valueChanged(ChangedHangThreshold); +} diff --git a/plugins/channelrx/wdsprx/wdsprxagcdialog.h b/plugins/channelrx/wdsprx/wdsprxagcdialog.h new file mode 100644 index 000000000..8a9c44842 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxagcdialog.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDE_WDSPRXAGCDIALOG_H +#define INCLUDE_WDSPRXAGCDIALOG_H + +#include + +#include "export.h" +#include "wdsprxsettings.h" + +namespace Ui { + class WDSPRxAGCDialog; +} + +class SDRGUI_API WDSPRxAGCDialog : public QDialog { + Q_OBJECT +public: + enum ValueChanged { + ChangedMode, + ChangedSlope, + ChangedHangThreshold, + }; + + explicit WDSPRxAGCDialog(QWidget* parent = nullptr); + ~WDSPRxAGCDialog(); + + void setAGCMode(WDSPRxProfile::WDSPRxAGCMode mode); + void setAGCSlope(int slope); + void setAGCHangThreshold(int hangThreshold); + + WDSPRxProfile::WDSPRxAGCMode getAGCMode() const { return m_agcMode; } + int getAGCSlope() const { return m_agcSlope; } + int getAGCHangThreshold() const { return m_agcHangThreshold; } + +signals: + void valueChanged(int valueChanged); + +private: + Ui::WDSPRxAGCDialog *ui; + WDSPRxProfile::WDSPRxAGCMode m_agcMode; + int m_agcSlope; // centi-Bels 0 - 200 + int m_agcHangThreshold; // 0 - 100 + +private slots: + void on_agcMode_currentIndexChanged(int index); + void on_agcSlope_valueChanged(int value); + void on_agcHangThreshold_valueChanged(int value); +}; + +#endif // INCLUDE_WDSPRXAGCDIALOG_H + diff --git a/plugins/channelrx/wdsprx/wdsprxagcdialog.ui b/plugins/channelrx/wdsprx/wdsprxagcdialog.ui new file mode 100644 index 000000000..9c92dc952 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxagcdialog.ui @@ -0,0 +1,222 @@ + + + WDSPRxAGCDialog + + + + 0 + 0 + 400 + 116 + + + + AGC + + + + + + + + AGC Mode + + + + + + + AGC Mode + + + + Long + + + + + Slow + + + + + Medium + + + + + Fast + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Slope + + + + + + + + 24 + 24 + + + + AGC Slope + + + 0 + + + 200 + + + 1 + + + 35 + + + + + + + AGC Slope value + + + 20.0 dB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Hang Threshold + + + + + + + + 24 + 24 + + + + Hang Threshold + + + 0 + + + 100 + + + 1 + + + 1 + + + 0 + + + + + + + Hang Threshold value + + + 100 + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + WDSPRxAGCDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WDSPRxAGCDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/plugins/channelrx/wdsprx/wdsprxbaseband.cpp b/plugins/channelrx/wdsprx/wdsprxbaseband.cpp index c0696d50b..b079bd566 100644 --- a/plugins/channelrx/wdsprx/wdsprxbaseband.cpp +++ b/plugins/channelrx/wdsprx/wdsprxbaseband.cpp @@ -163,7 +163,7 @@ bool WDSPRxBaseband::handleMessage(const Message& cmd) if (m_spectrumVis) { - DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); } } @@ -190,11 +190,11 @@ void WDSPRxBaseband::applySettings(const WDSPRxSettings& settings, bool force) } } - if ((settings.m_filterBank[settings.m_filterIndex].m_spanLog2 != m_settings.m_filterBank[settings.m_filterIndex].m_spanLog2) || force) + if ((settings.m_profiles[settings.m_profileIndex].m_spanLog2 != m_settings.m_profiles[settings.m_profileIndex].m_spanLog2) || force) { if (m_spectrumVis) { - DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); } } @@ -221,7 +221,7 @@ void WDSPRxBaseband::applySettings(const WDSPRxSettings& settings, bool force) if (m_spectrumVis) { - DSPSignalNotification *msg = new DSPSignalNotification(m_audioSampleRate/(1<getInputMessageQueue()->push(msg); } } diff --git a/plugins/channelrx/wdsprx/wdsprxdnbdialog.cpp b/plugins/channelrx/wdsprx/wdsprxdnbdialog.cpp new file mode 100644 index 000000000..4259b4756 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnbdialog.cpp @@ -0,0 +1,114 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// +#include "wdsprxdnbdialog.h" +#include "ui_wdsprxdnbdialog.h" + +WDSPRxDNBDialog::WDSPRxDNBDialog(QWidget* parent) : + QDialog(parent), + ui(new Ui::WDSPRxDNBDialog) +{ + ui->setupUi(this); +} + +WDSPRxDNBDialog::~WDSPRxDNBDialog() +{ + delete ui; +} + +void WDSPRxDNBDialog::setNBScheme(WDSPRxProfile::WDSPRxNBScheme scheme) +{ + ui->nb->blockSignals(true); + ui->nb->setCurrentIndex((int) scheme); + ui->nb->blockSignals(false); + m_nbScheme = scheme; +} + +void WDSPRxDNBDialog::setNB2Mode(WDSPRxProfile::WDSPRxNB2Mode mode) +{ + ui->nb2Mode->blockSignals(true); + ui->nb2Mode->setCurrentIndex((int) mode); + ui->nb2Mode->blockSignals(false); + m_nb2Mode = mode; +} + +void WDSPRxDNBDialog::setNBSlewTime(double time) +{ + ui->nbSlewTime->blockSignals(true); + ui->nbSlewTime->setValue(time); + ui->nbSlewTime->blockSignals(false); + m_nbSlewTime = time; +} + +void WDSPRxDNBDialog::setNBLeadTime(double time) +{ + ui->nbLeadTime->blockSignals(true); + ui->nbLeadTime->setValue(time); + ui->nbLeadTime->blockSignals(false); + m_nbLeadTime = time; +} + +void WDSPRxDNBDialog::setNBLagTime(double time) +{ + ui->nbLagTime->blockSignals(true); + ui->nbLagTime->setValue(time); + ui->nbLagTime->blockSignals(false); + m_nbLagTime = time; +} + +void WDSPRxDNBDialog::setNBThreshold(int threshold) +{ + ui->nbThreshold->blockSignals(true); + ui->nbThreshold->setValue(threshold); + ui->nbThreshold->blockSignals(false); + m_nbThreshold = threshold; +} + +void WDSPRxDNBDialog::on_nb_currentIndexChanged(int index) +{ + m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) index; + emit valueChanged(ChangedNB); +} + +void WDSPRxDNBDialog::on_nb2Mode_currentIndexChanged(int index) +{ + m_nb2Mode = (WDSPRxProfile::WDSPRxNB2Mode) index; + emit valueChanged(ChangedNB2Mode); +} + +void WDSPRxDNBDialog::on_nbSlewTime_valueChanged(double value) +{ + m_nbSlewTime = value; + emit valueChanged(ChangedNBSlewTime); +} + +void WDSPRxDNBDialog::on_nbLeadTime_valueChanged(double value) +{ + m_nbLeadTime = value; + emit valueChanged(ChangedNBLeadTime); +} + +void WDSPRxDNBDialog::on_nbLagTime_valueChanged(double value) +{ + m_nbLagTime = value; + emit valueChanged(ChangedNBLagTime); +} + +void WDSPRxDNBDialog::on_nbThreshold_valueChanged(int value) +{ + m_nbThreshold = value; + emit valueChanged(ChangedNBThreshold); +} diff --git a/plugins/channelrx/wdsprx/wdsprxdnbdialog.h b/plugins/channelrx/wdsprx/wdsprxdnbdialog.h new file mode 100644 index 000000000..9fa4489a9 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnbdialog.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDE_WDSPRXDNBDIALOG_H +#define INCLUDE_WDSPRXDNBDIALOG_H + +#include + +#include "export.h" +#include "wdsprxsettings.h" + +namespace Ui { + class WDSPRxDNBDialog; +} + +class SDRGUI_API WDSPRxDNBDialog : public QDialog { + Q_OBJECT +public: + enum ValueChanged { + ChangedNB, + ChangedNB2Mode, + ChangedNBSlewTime, + ChangedNBLeadTime, + ChangedNBLagTime, + ChangedNBThreshold, + }; + + explicit WDSPRxDNBDialog(QWidget* parent = nullptr); + ~WDSPRxDNBDialog(); + + void setNBScheme(WDSPRxProfile::WDSPRxNBScheme scheme); + void setNB2Mode(WDSPRxProfile::WDSPRxNB2Mode mode); + void setNBSlewTime(double time); + void setNBLeadTime(double time); + void setNBLagTime(double time); + void setNBThreshold(int threshold); + + WDSPRxProfile::WDSPRxNBScheme getNBScheme() const { return m_nbScheme; } + WDSPRxProfile::WDSPRxNB2Mode getNB2Mode() const { return m_nb2Mode; } + double getNBSlewTime() const { return m_nbSlewTime; } + double getNBLeadTime() const { return m_nbLeadTime; } + double getNBLagTime() const { return m_nbLagTime; } + int getNBThreshold() const { return m_nbThreshold; } + +signals: + void valueChanged(int valueChanged); + +private: + Ui::WDSPRxDNBDialog *ui; + WDSPRxProfile::WDSPRxNBScheme m_nbScheme; + WDSPRxProfile::WDSPRxNB2Mode m_nb2Mode; + double m_nbSlewTime; + double m_nbLeadTime; + double m_nbLagTime; + int m_nbThreshold; + +private slots: + void on_nb_currentIndexChanged(int index); + void on_nb2Mode_currentIndexChanged(int index); + void on_nbSlewTime_valueChanged(double value); + void on_nbLeadTime_valueChanged(double value); + void on_nbLagTime_valueChanged(double value); + void on_nbThreshold_valueChanged(int value); +}; + +#endif // INCLUDE_WDSPRXDNBDIALOG_H diff --git a/plugins/channelrx/wdsprx/wdsprxdnbdialog.ui b/plugins/channelrx/wdsprx/wdsprxdnbdialog.ui new file mode 100644 index 000000000..812d5b88f --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnbdialog.ui @@ -0,0 +1,249 @@ + + + WDSPRxDNBDialog + + + + 0 + 0 + 445 + 197 + + + + Noise Blanker + + + + + + + + Scheme + + + + + + + + NB + + + + + NB2 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + NB2 mode + + + + + + + Lead time (ms) + + + + + + + Slew time (ms) + + + + + + + Noise blanking lead time (ms) + + + 4 + + + 1.000000000000000 + + + 0.000100000000000 + + + 0.010000000000000 + + + + + + + Noise blanking #2 mode + + + + Zero + + + + + Sample&Hold + + + + + Mean Hold + + + + + Hold Sample + + + + + Interpolate + + + + + + + + Noise blanking slew time (ms) + + + 4 + + + 1.000000000000000 + + + 0.000100000000000 + + + QAbstractSpinBox::DefaultStepType + + + 0.010000000000000 + + + + + + + Lag time (ms) + + + + + + + Noise blanking lag time (ms) + + + 4 + + + 1.000000000000000 + + + 0.000100000000000 + + + 0.010000000000000 + + + + + + + Threshold + + + + + + + Noise blanking threshold + + + 15 + + + 500 + + + 30 + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + WDSPRxDNBDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WDSPRxDNBDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/plugins/channelrx/wdsprx/wdsprxdnrdialog.cpp b/plugins/channelrx/wdsprx/wdsprxdnrdialog.cpp new file mode 100644 index 000000000..d48ad9143 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnrdialog.cpp @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// +#include "wdsprxdnrdialog.h" +#include "ui_wdsprxdnrdialog.h" + +WDSPRxDNRDialog::WDSPRxDNRDialog(QWidget* parent) : + QDialog(parent), + ui(new Ui::WDSPRxDNRDialog) +{ + ui->setupUi(this); +} + +WDSPRxDNRDialog::~WDSPRxDNRDialog() +{ + 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) +{ + ui->anf->blockSignals(true); + ui->anf->setChecked(anf); + ui->anf->blockSignals(false); + m_anf = anf; +} + +void WDSPRxDNRDialog::setNRScheme(WDSPRxProfile::WDSPRxNRScheme scheme) +{ + ui->nr->blockSignals(true); + ui->nr->setCurrentIndex((int) scheme); + ui->nr->blockSignals(false); + m_nrScheme = scheme; +} + +void WDSPRxDNRDialog::setNR2Gain(WDSPRxProfile::WDSPRxNR2Gain gain) +{ + ui->nr2Gain->blockSignals(true); + ui->nr2Gain->setCurrentIndex((int) gain); + ui->nr2Gain->blockSignals(false); + m_nr2Gain = gain; +} + +void WDSPRxDNRDialog::setNR2NPE(WDSPRxProfile::WDSPRxNR2NPE nr2NPE) +{ + ui->nr2NPE->blockSignals(true); + ui->nr2NPE->setCurrentIndex((int) nr2NPE); + ui->nr2NPE->blockSignals(false); + m_nr2NPE = nr2NPE; +} + +void WDSPRxDNRDialog::setNRPosition(WDSPRxProfile::WDSPRxNRPosition position) +{ + ui->nrPosition->blockSignals(true); + ui->nrPosition->setCurrentIndex((int) position); + ui->nrPosition->blockSignals(false); + m_nrPosition = position; +} + +void WDSPRxDNRDialog::setNR2ArtifactReduction(bool nr2ArtifactReducion) +{ + ui->nr2ArtifactReduction->blockSignals(true); + ui->nr2ArtifactReduction->setChecked(nr2ArtifactReducion); + ui->nr2ArtifactReduction->blockSignals(false); + m_nr2ArtifactReduction = nr2ArtifactReducion; +} + +void WDSPRxDNRDialog::on_snb_clicked(bool checked) +{ + m_snb = checked; + emit valueChanged(ChangedSNB); +} + +void WDSPRxDNRDialog::on_anf_clicked(bool checked) +{ + m_anf = checked; + emit valueChanged(ChangedANF); +} + +void WDSPRxDNRDialog::on_nr_currentIndexChanged(int index) +{ + m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) index; + emit valueChanged(ChangedNR); +} + +void WDSPRxDNRDialog::on_nr2Gain_currentIndexChanged(int index) +{ + m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) index; + emit valueChanged(ChangedNR2Gain); +} + +void WDSPRxDNRDialog::on_nr2NPE_currentIndexChanged(int index) +{ + m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) index; + emit valueChanged(ChangedNR2NPE); +} + +void WDSPRxDNRDialog::on_nrPosition_currentIndexChanged(int index) +{ + m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) index; + emit valueChanged(ChangedNRPosition); +} + +void WDSPRxDNRDialog::on_nr2ArtifactReduction_clicked(bool checked) +{ + m_nr2ArtifactReduction = checked; + emit valueChanged(ChangedNR2Artifacts); +} diff --git a/plugins/channelrx/wdsprx/wdsprxdnrdialog.h b/plugins/channelrx/wdsprx/wdsprxdnrdialog.h new file mode 100644 index 000000000..24d4aa129 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnrdialog.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2024 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////////// +#ifndef INCLUDE_WDSPRXDNRDIALOG_H +#define INCLUDE_WDSPRXDNRDIALOG_H + +#include + +#include "export.h" +#include "wdsprxsettings.h" + +namespace Ui { + class WDSPRxDNRDialog; +} + +class SDRGUI_API WDSPRxDNRDialog : public QDialog { + Q_OBJECT +public: + enum ValueChanged { + ChangedSNB, + ChangedANF, + ChangedNR, + ChangedNR2Gain, + ChangedNR2NPE, + ChangedNRPosition, + ChangedNR2Artifacts, + }; + + explicit WDSPRxDNRDialog(QWidget* parent = nullptr); + ~WDSPRxDNRDialog(); + + void setSNB(bool snb); + void setANF(bool anf); + void setNRScheme(WDSPRxProfile::WDSPRxNRScheme scheme); + void setNR2Gain(WDSPRxProfile::WDSPRxNR2Gain gain); + void setNR2NPE(WDSPRxProfile::WDSPRxNR2NPE nr2NPE); + void setNRPosition(WDSPRxProfile::WDSPRxNRPosition position); + void setNR2ArtifactReduction(bool nr2ArtifactReducion); + + bool getSNB() const { return m_snb; } + bool getANF() const { return m_anf; } + WDSPRxProfile::WDSPRxNRScheme getNRScheme() const { return m_nrScheme; } + WDSPRxProfile::WDSPRxNR2Gain getNR2Gain() const { return m_nr2Gain; } + WDSPRxProfile::WDSPRxNR2NPE getNR2NPE() const { return m_nr2NPE; } + WDSPRxProfile::WDSPRxNRPosition getNRPosition() const { return m_nrPosition; } + bool getNR2ArtifactReduction() const { return m_nr2ArtifactReduction; } + +signals: + void valueChanged(int valueChanged); + +private: + Ui::WDSPRxDNRDialog *ui; + bool m_snb; + bool m_anf; + WDSPRxProfile::WDSPRxNRScheme m_nrScheme; + WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain; + WDSPRxProfile::WDSPRxNR2NPE m_nr2NPE; + WDSPRxProfile::WDSPRxNRPosition m_nrPosition; + bool m_nr2ArtifactReduction; + +private slots: + void on_snb_clicked(bool checked); + void on_anf_clicked(bool checked); + void on_nr_currentIndexChanged(int index); + void on_nr2Gain_currentIndexChanged(int index); + void on_nr2NPE_currentIndexChanged(int index); + void on_nrPosition_currentIndexChanged(int index); + void on_nr2ArtifactReduction_clicked(bool checked); +}; + +#endif // INCLUDE_WDSPRXDNRDIALOG_H diff --git a/plugins/channelrx/wdsprx/wdsprxdnrdialog.ui b/plugins/channelrx/wdsprx/wdsprxdnrdialog.ui new file mode 100644 index 000000000..bc55ab5d5 --- /dev/null +++ b/plugins/channelrx/wdsprx/wdsprxdnrdialog.ui @@ -0,0 +1,210 @@ + + + WDSPRxDNRDialog + + + + 0 + 0 + 365 + 160 + + + + Noise Reduction + + + + + + + + Scheme + + + + + + + Noise reduction scheme + + + + NR + + + + + NR2 + + + + + + + + Spectral Noise Blanker + + + SNB + + + + + + + Automatic Notch Filter + + + ANF + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + NR2 Gain + + + + + + + Noise reduction 2 artifact reduction + + + NR2 Art + + + + + + + Position + + + + + + + NR2 NPE + + + + + + + Noise reduction position + + + + Pre AGC + + + + + Post AGC + + + + + + + + + Linear + + + + + Log + + + + + Gamma + + + + + + + + + OSMS + + + + + MMSE + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + WDSPRxDNRDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WDSPRxDNRDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/plugins/channelrx/wdsprx/wdsprxgui.cpp b/plugins/channelrx/wdsprx/wdsprxgui.cpp index 3106be386..072dc205c 100644 --- a/plugins/channelrx/wdsprx/wdsprxgui.cpp +++ b/plugins/channelrx/wdsprx/wdsprxgui.cpp @@ -37,6 +37,9 @@ #include "gui/dialogpositioner.h" #include "maincore.h" #include "wdsprx.h" +#include "wdsprxagcdialog.h" +#include "wdsprxdnbdialog.h" +#include "wdsprxdnrdialog.h" WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) { @@ -68,7 +71,7 @@ bool WDSPRxGUI::deserialize(const QByteArray& data) ui->lowCut->setMaximum(480); ui->lowCut->setMinimum(-480); displaySettings(); - applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2, true); // does applySettings(true) return true; } else @@ -79,7 +82,7 @@ bool WDSPRxGUI::deserialize(const QByteArray& data) ui->lowCut->setMaximum(480); ui->lowCut->setMinimum(-480); displaySettings(); - applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2, true); // does applySettings(true) return false; } } @@ -201,12 +204,15 @@ void WDSPRxGUI::on_volume_valueChanged(int value) void WDSPRxGUI::on_agc_toggled(bool checked) { m_settings.m_agc = checked; + m_settings.m_profiles[m_settings.m_profileIndex].m_agc = m_settings.m_agc; applySettings(); } -void WDSPRxGUI::on_dnr_toggled(bool) +void WDSPRxGUI::on_dnr_toggled(bool checked) { - // TBD + m_settings.m_dnr = checked; + m_settings.m_profiles[m_settings.m_profileIndex].m_dnr = m_settings.m_dnr; + applySettings(); } void WDSPRxGUI::on_agcGain_valueChanged(int value) @@ -214,6 +220,7 @@ void WDSPRxGUI::on_agcGain_valueChanged(int value) QString s = QString::number(value, 'f', 0); ui->agcGainText->setText(s); m_settings.m_agcGain = value; + m_settings.m_profiles[m_settings.m_profileIndex].m_agcGain = m_settings.m_agcGain; applySettings(); } @@ -246,30 +253,45 @@ void WDSPRxGUI::on_flipSidebands_clicked(bool checked) void WDSPRxGUI::on_fftWindow_currentIndexChanged(int index) { - m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow = index; + m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow = index; applySettings(); } -void WDSPRxGUI::on_filterIndex_valueChanged(int value) +void WDSPRxGUI::on_profileIndex_valueChanged(int value) { if ((value < 0) || (value >= 10)) { return; } ui->filterIndexText->setText(tr("%1").arg(value)); - m_settings.m_filterIndex = value; + m_settings.m_profileIndex = value; + // Bandwidth setup ui->BW->setMaximum(480); ui->BW->setMinimum(-480); ui->lowCut->setMaximum(480); ui->lowCut->setMinimum(-480); - m_settings.m_dnr = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnr; - m_settings.m_dnrScheme = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrScheme; - m_settings.m_dnrAboveAvgFactor = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrAboveAvgFactor; - m_settings.m_dnrSigmaFactor = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrSigmaFactor; - m_settings.m_dnrNbPeaks = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrNbPeaks; - m_settings.m_dnrAlpha = m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrAlpha; + // AGC setup + m_settings.m_agc = m_settings.m_profiles[m_settings.m_profileIndex].m_agc; + m_settings.m_agcGain = m_settings.m_profiles[m_settings.m_profileIndex].m_agcGain; + // Noise blanking + m_settings.m_dnb = m_settings.m_profiles[m_settings.m_profileIndex].m_dnb; + m_settings.m_nbScheme = m_settings.m_profiles[m_settings.m_profileIndex].m_nbScheme; + m_settings.m_nb2Mode = m_settings.m_profiles[m_settings.m_profileIndex].m_nb2Mode; + m_settings.m_nbSlewTime = m_settings.m_profiles[m_settings.m_profileIndex].m_nbSlewTime; + m_settings.m_nbLeadTime = m_settings.m_profiles[m_settings.m_profileIndex].m_nbLeadTime; + m_settings.m_nbLagTime = m_settings.m_profiles[m_settings.m_profileIndex].m_nbLagTime; + m_settings.m_nbThreshold = m_settings.m_profiles[m_settings.m_profileIndex].m_nbThreshold; + // Noise reduction + 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_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_nr2NPE = m_settings.m_profiles[m_settings.m_profileIndex].m_nr2NPE; + m_settings.m_nrPosition = m_settings.m_profiles[m_settings.m_profileIndex].m_nrPosition; + m_settings.m_nr2ArtifactReduction = m_settings.m_profiles[m_settings.m_profileIndex].m_nr2ArtifactReduction; displaySettings(); - applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2, true); // does applySettings(true) } void WDSPRxGUI::onMenuDialogCalled(const QPoint &p) @@ -344,7 +366,9 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam m_audioMute(false), m_squelchOpen(false), m_audioSampleRate(-1), - m_fftNRDialog(nullptr) + m_agcDialog(nullptr), + m_dnbDialog(nullptr), + m_dnrDialog(nullptr) { setAttribute(Qt::WA_DeleteOnClose, true); m_helpURL = "plugins/channelrx/demodssb/readme.md"; @@ -363,6 +387,12 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute); connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &))); + CRightClickEnabler *agcRightClickEnabler = new CRightClickEnabler(ui->agc); + connect(agcRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(agcSetupDialog(const QPoint &))); + + CRightClickEnabler *dnbRightClickEnabler = new CRightClickEnabler(ui->dnb); + connect(dnbRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(dnbSetupDialog(const QPoint &))); + CRightClickEnabler *dnrRightClickEnabler = new CRightClickEnabler(ui->dnr); connect(dnrRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(dnrSetupDialog(const QPoint &))); @@ -416,7 +446,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam displaySettings(); makeUIConnections(); - applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true) + applyBandwidths(m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2, true); // does applySettings(true) DialPopup::addPopupsToChildDials(this); m_resizer.enableChildMouseTracking(); } @@ -568,9 +598,9 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force) ui->channelPowerMeter->setRange(WDSPRxSettings::m_minPowerThresholdDB, 0); m_settings.m_dsb = dsb; - m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2 = spanLog2; - m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff = bw * 100; - m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff = lw * 100; + m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2; + m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = bw * 100; + m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = lw * 100; applySettings(force); @@ -586,9 +616,9 @@ void WDSPRxGUI::displaySettings() { m_channelMarker.blockSignals(true); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); - m_channelMarker.setBandwidth(m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff * 2); + m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2); m_channelMarker.setTitle(m_settings.m_title); - m_channelMarker.setLowCutoff(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff); + m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff); if (m_deviceUISet->m_deviceMIMOEngine) { @@ -604,7 +634,7 @@ void WDSPRxGUI::displaySettings() } else { - if (m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff < 0) + if (m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff < 0) { m_channelMarker.setSidebands(ChannelMarker::lsb); ui->dsb->setIcon(m_iconDSBLSB); @@ -636,7 +666,7 @@ void WDSPRxGUI::displaySettings() ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels); ui->audioMute->setChecked(m_settings.m_audioMute); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); - ui->fftWindow->setCurrentIndex(m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); + ui->fftWindow->setCurrentIndex(m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow); // Prevent uncontrolled triggering of applyBandwidths ui->spanLog2->blockSignals(true); @@ -644,14 +674,14 @@ void WDSPRxGUI::displaySettings() ui->BW->blockSignals(true); ui->filterIndex->blockSignals(true); - ui->filterIndex->setValue(m_settings.m_filterIndex); - ui->filterIndexText->setText(tr("%1").arg(m_settings.m_filterIndex)); + ui->filterIndex->setValue(m_settings.m_profileIndex); + ui->filterIndexText->setText(tr("%1").arg(m_settings.m_profileIndex)); ui->dsb->setChecked(m_settings.m_dsb); - ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2); + ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2); - ui->BW->setValue(m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff / 100.0); - s = QString::number(m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff/1000.0, 'f', 1); + ui->BW->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff / 100.0); + s = QString::number(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff/1000.0, 'f', 1); if (m_settings.m_dsb) { ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(s)); @@ -666,8 +696,8 @@ void WDSPRxGUI::displaySettings() // The only one of the four signals triggering applyBandwidths will trigger it once only with all other values // set correctly and therefore validate the settings and apply them to dependent widgets - ui->lowCut->setValue(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff / 100.0); - ui->lowCutText->setText(tr("%1k").arg(m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff / 1000.0)); + ui->lowCut->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 100.0); + ui->lowCutText->setText(tr("%1k").arg(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 1000.0)); int volume = CalcDb::dbPower(m_settings.m_volume); ui->volume->setValue(volume); @@ -680,11 +710,6 @@ void WDSPRxGUI::displaySettings() blockApplySettings(false); } -void WDSPRxGUI::agcSetupDialog() -{ - // TODO -} - void WDSPRxGUI::leaveEvent(QEvent* event) { m_channelMarker.setHighlighted(false); @@ -711,55 +736,172 @@ void WDSPRxGUI::audioSelect(const QPoint& p) } } +void WDSPRxGUI::agcSetupDialog(const QPoint& p) +{ + m_agcDialog = new WDSPRxAGCDialog(); + m_agcDialog->move(p); + m_agcDialog->setAGCMode(m_settings.m_agcMode); + m_agcDialog->setAGCSlope(m_settings.m_agcSlope); + m_agcDialog->setAGCHangThreshold(m_settings.m_agcHangThreshold); + QObject::connect(m_agcDialog, &WDSPRxAGCDialog::valueChanged, this, &WDSPRxGUI::agcSetup); + m_agcDialog->exec(); + QObject::disconnect(m_agcDialog, &WDSPRxAGCDialog::valueChanged, this, &WDSPRxGUI::agcSetup); + m_agcDialog->deleteLater(); + m_agcDialog = nullptr; +} + +void WDSPRxGUI::agcSetup(int iValueChanged) +{ + if (!m_agcDialog) { + return; + } + + WDSPRxAGCDialog::ValueChanged valueChanged = (WDSPRxAGCDialog::ValueChanged) iValueChanged; + + switch (valueChanged) + { + case WDSPRxAGCDialog::ValueChanged::ChangedMode: + m_settings.m_agcMode = m_agcDialog->getAGCMode(); + m_settings.m_profiles[m_settings.m_profileIndex].m_agcMode = m_settings.m_agcMode; + applySettings(); + break; + case WDSPRxAGCDialog::ValueChanged::ChangedSlope: + m_settings.m_agcSlope = m_agcDialog->getAGCSlope(); + m_settings.m_profiles[m_settings.m_profileIndex].m_agcSlope = m_settings.m_agcSlope; + applySettings(); + break; + case WDSPRxAGCDialog::ValueChanged::ChangedHangThreshold: + m_settings.m_agcHangThreshold = m_agcDialog->getAGCHangThreshold(); + m_settings.m_profiles[m_settings.m_profileIndex].m_agcHangThreshold = m_settings.m_agcHangThreshold; + applySettings(); + break; + default: + break; + } +} + +void WDSPRxGUI::dnbSetupDialog(const QPoint& p) +{ + m_dnbDialog = new WDSPRxDNBDialog(); + m_dnbDialog->move(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->setNBThreshold(m_settings.m_nbThreshold); + QObject::connect(m_dnbDialog, &WDSPRxDNBDialog::valueChanged, this, &WDSPRxGUI::dnbSetup); + m_dnbDialog->exec(); + QObject::disconnect(m_dnbDialog, &WDSPRxDNBDialog::valueChanged, this, &WDSPRxGUI::dnbSetup); + m_dnbDialog->deleteLater(); + m_dnbDialog = nullptr; +} + +void WDSPRxGUI::dnbSetup(int32_t iValueChanged) +{ + if (!m_dnbDialog) { + return; + } + + WDSPRxDNBDialog::ValueChanged valueChanged = (WDSPRxDNBDialog::ValueChanged) iValueChanged; + + switch (valueChanged) + { + case WDSPRxDNBDialog::ValueChanged::ChangedNB: + m_settings.m_nbScheme = m_dnbDialog->getNBScheme(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nbScheme = m_settings.m_nbScheme; + applySettings(); + break; + case WDSPRxDNBDialog::ValueChanged::ChangedNB2Mode: + m_settings.m_nb2Mode = m_dnbDialog->getNB2Mode(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nb2Mode = m_settings.m_nb2Mode; + applySettings(); + break; + case WDSPRxDNBDialog::ValueChanged::ChangedNBSlewTime: + m_settings.m_nbSlewTime = m_dnbDialog->getNBSlewTime(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nbSlewTime = m_settings.m_nbSlewTime; + applySettings(); + break; + case WDSPRxDNBDialog::ValueChanged::ChangedNBLeadTime: + m_settings.m_nbLeadTime = m_dnbDialog->getNBLeadTime(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nbLeadTime = m_settings.m_nbLeadTime; + applySettings(); + break; + case WDSPRxDNBDialog::ValueChanged::ChangedNBLagTime: + m_settings.m_nbLagTime = m_dnbDialog->getNBLagTime(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nbLagTime = m_settings.m_nbLagTime; + applySettings(); + break; + case WDSPRxDNBDialog::ValueChanged::ChangedNBThreshold: + m_settings.m_nbThreshold = m_dnbDialog->getNBThreshold(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nbThreshold = m_settings.m_nbThreshold; + applySettings(); + break; + default: + break; + } +} + void WDSPRxGUI::dnrSetupDialog(const QPoint& p) { - m_fftNRDialog = new FFTNRDialog(); - m_fftNRDialog->move(p); - QObject::connect(m_fftNRDialog, &FFTNRDialog::valueChanged, this, &WDSPRxGUI::dnrSetup); - m_fftNRDialog->setScheme((FFTNoiseReduction::Scheme) m_settings.m_dnrScheme); - m_fftNRDialog->setAboveAvgFactor(m_settings.m_dnrAboveAvgFactor); - m_fftNRDialog->setSigmaFactor(m_settings.m_dnrSigmaFactor); - m_fftNRDialog->setNbPeaks(m_settings.m_dnrNbPeaks); - m_fftNRDialog->setAlpha(m_settings.m_dnrAlpha, 2048, m_audioSampleRate); - m_fftNRDialog->exec(); - QObject::disconnect(m_fftNRDialog, &FFTNRDialog::valueChanged, this, &WDSPRxGUI::dnrSetup); - m_fftNRDialog->deleteLater(); - m_fftNRDialog = nullptr; + m_dnrDialog = new WDSPRxDNRDialog(); + m_dnrDialog->move(p); + m_dnrDialog->setSNB(m_settings.m_snb); + m_dnrDialog->setANF(m_settings.m_anf); + m_dnrDialog->setNRScheme(m_settings.m_nrScheme); + m_dnrDialog->setNR2Gain(m_settings.m_nr2Gain); + m_dnrDialog->setNR2NPE(m_settings.m_nr2NPE); + m_dnrDialog->setNRPosition(m_settings.m_nrPosition); + m_dnrDialog->setNR2ArtifactReduction(m_settings.m_nr2ArtifactReduction); + QObject::connect(m_dnrDialog, &WDSPRxDNRDialog::valueChanged, this, &WDSPRxGUI::dnrSetup); + m_dnrDialog->exec(); + QObject::disconnect(m_dnrDialog, &WDSPRxDNRDialog::valueChanged, this, &WDSPRxGUI::dnrSetup); + m_dnrDialog->deleteLater(); + m_dnrDialog = nullptr; } void WDSPRxGUI::dnrSetup(int32_t iValueChanged) { - if (!m_fftNRDialog) { + if (!m_dnrDialog) { return; } - FFTNRDialog::ValueChanged valueChanged = (FFTNRDialog::ValueChanged) iValueChanged; + WDSPRxDNRDialog::ValueChanged valueChanged = (WDSPRxDNRDialog::ValueChanged) iValueChanged; switch (valueChanged) { - case FFTNRDialog::ValueChanged::ChangedScheme: - m_settings.m_dnrScheme = m_fftNRDialog->getScheme(); - m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrScheme = m_settings.m_dnrScheme; + 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 FFTNRDialog::ValueChanged::ChangedAboveAvgFactor: - m_settings.m_dnrAboveAvgFactor = m_fftNRDialog->getAboveAvgFactor(); - m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrAboveAvgFactor = m_settings.m_dnrAboveAvgFactor; + case WDSPRxDNRDialog::ValueChanged::ChangedANF: + m_settings.m_anf = m_dnrDialog->getANF(); + m_settings.m_profiles[m_settings.m_profileIndex].m_anf = m_settings.m_anf; applySettings(); break; - case FFTNRDialog::ValueChanged::ChangedSigmaFactor: - m_settings.m_dnrSigmaFactor = m_fftNRDialog->getSigmaFactor(); - m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrSigmaFactor = m_settings.m_dnrSigmaFactor; + case WDSPRxDNRDialog::ValueChanged::ChangedNR: + m_settings.m_nrScheme = m_dnrDialog->getNRScheme(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nrScheme = m_settings.m_nrScheme; applySettings(); break; - case FFTNRDialog::ValueChanged::ChangedNbPeaks: - m_settings.m_dnrNbPeaks = m_fftNRDialog->getNbPeaks(); - m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrNbPeaks = m_settings.m_dnrNbPeaks; + case WDSPRxDNRDialog::ValueChanged::ChangedNR2Gain: + m_settings.m_nr2Gain = m_dnrDialog->getNR2Gain(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nr2Gain = m_settings.m_nr2Gain; applySettings(); break; - case FFTNRDialog::ValueChanged::ChangedAlpha: - m_settings.m_dnrAlpha = m_fftNRDialog->getAlpha(); - m_settings.m_filterBank[m_settings.m_filterIndex].m_dnrAlpha = m_settings.m_dnrAlpha; + case WDSPRxDNRDialog::ValueChanged::ChangedNR2NPE: + m_settings.m_nr2NPE = m_dnrDialog->getNR2NPE(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nr2NPE = m_settings.m_nr2NPE; + applySettings(); + break; + case WDSPRxDNRDialog::ValueChanged::ChangedNRPosition: + m_settings.m_nrPosition = m_dnrDialog->getNRPosition(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nrPosition = m_settings.m_nrPosition; + applySettings(); + break; + case WDSPRxDNRDialog::ValueChanged::ChangedNR2Artifacts: + m_settings.m_nr2ArtifactReduction = m_dnrDialog->getNR2ArtifactReduction(); + m_settings.m_profiles[m_settings.m_profileIndex].m_nr2ArtifactReduction = m_settings.m_nr2ArtifactReduction; applySettings(); break; default: @@ -818,7 +960,7 @@ void WDSPRxGUI::makeUIConnections() QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &WDSPRxGUI::on_spanLog2_valueChanged); QObject::connect(ui->flipSidebands, &QPushButton::clicked, this, &WDSPRxGUI::on_flipSidebands_clicked); QObject::connect(ui->fftWindow, QOverload::of(&QComboBox::currentIndexChanged), this, &WDSPRxGUI::on_fftWindow_currentIndexChanged); - QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &WDSPRxGUI::on_filterIndex_valueChanged); + QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &WDSPRxGUI::on_profileIndex_valueChanged); } void WDSPRxGUI::updateAbsoluteCenterFrequency() diff --git a/plugins/channelrx/wdsprx/wdsprxgui.h b/plugins/channelrx/wdsprx/wdsprxgui.h index 9b7a6178b..18dafe211 100644 --- a/plugins/channelrx/wdsprx/wdsprxgui.h +++ b/plugins/channelrx/wdsprx/wdsprxgui.h @@ -34,6 +34,9 @@ class DeviceUISet; class AudioFifo; class WDSPRx; +class WDSPRxAGCDialog; +class WDSPRxDNBDialog; +class WDSPRxDNRDialog; class SpectrumVis; class BasebandSampleSink; @@ -89,7 +92,9 @@ private: WDSPRx* m_wdspRx; SpectrumVis* m_spectrumVis; MessageQueue m_inputMessageQueue; - FFTNRDialog* m_fftNRDialog; + WDSPRxAGCDialog* m_agcDialog; + WDSPRxDNBDialog* m_dnbDialog; + WDSPRxDNRDialog* m_dnrDialog; QIcon m_iconDSBUSB; QIcon m_iconDSBLSB; @@ -120,19 +125,23 @@ private slots: void on_volume_valueChanged(int value); void on_agc_toggled(bool checked); void on_dnr_toggled(bool checked); + // void on_dnb_toggled(bool checked); void on_agcGain_valueChanged(int value); void on_audioMute_toggled(bool checked); void on_spanLog2_valueChanged(int value); void on_flipSidebands_clicked(bool checked); void on_fftWindow_currentIndexChanged(int index); - void on_filterIndex_valueChanged(int value); + void on_profileIndex_valueChanged(int value); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); void handleInputMessages(); void audioSelect(const QPoint& p); + void agcSetupDialog(const QPoint& p); + void agcSetup(int valueChanged); + void dnbSetupDialog(const QPoint& p); + void dnbSetup(int valueChanged); void dnrSetupDialog(const QPoint& p); void dnrSetup(int valueChanged); - void agcSetupDialog(); void tick(); }; diff --git a/plugins/channelrx/wdsprx/wdsprxgui.ui b/plugins/channelrx/wdsprx/wdsprxgui.ui index 2dd18eee0..a294e2c3a 100644 --- a/plugins/channelrx/wdsprx/wdsprxgui.ui +++ b/plugins/channelrx/wdsprx/wdsprxgui.ui @@ -877,6 +877,19 @@ + + + + Toggle Digital Noise Blanker + + + NB + + + true + + + diff --git a/plugins/channelrx/wdsprx/wdsprxsettings.cpp b/plugins/channelrx/wdsprx/wdsprxsettings.cpp index 8a3e4aead..87d04368d 100644 --- a/plugins/channelrx/wdsprx/wdsprxsettings.cpp +++ b/plugins/channelrx/wdsprx/wdsprxsettings.cpp @@ -35,7 +35,7 @@ WDSPRxSettings::WDSPRxSettings() : m_spectrumGUI(nullptr), m_rollupState(nullptr) { - m_filterBank.resize(10); + m_profiles.resize(10); resetToDefaults(); } @@ -45,11 +45,30 @@ void WDSPRxSettings::resetToDefaults() m_audioFlipChannels = false; m_dsb = false; m_audioMute = false; - m_agc = true; - m_agcMode = AGCMedium; + // 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.01; + m_nbLeadTime = 0.01; + m_nbLagTime = 0.01; + m_nbThreshold = 30; + // Noise reduction + m_dnr = false; + m_snb = false; + m_anf = false; + m_nrScheme = WDSPRxProfile::NRSchemeNR; + m_nr2Gain = WDSPRxProfile::NR2GainGamma; + m_nr2NPE = WDSPRxProfile::NR2NPEOSMS; + m_nrPosition = WDSPRxProfile::NRPositionPreAGC; + m_nr2ArtifactReduction = true; + // m_volume = 1.0; m_inputFrequencyOffset = 0; m_rgbColor = QColor(0, 255, 0).rgb(); @@ -63,58 +82,95 @@ void WDSPRxSettings::resetToDefaults() m_reverseAPIChannelIndex = 0; m_workspaceIndex = 0; m_hidden = false; - m_filterIndex = 0; + m_profileIndex = 0; } QByteArray WDSPRxSettings::serialize() const { SimpleSerializer s(1); - s.writeS32(1, m_inputFrequencyOffset); - s.writeS32(3, m_volume * 10.0); + s.writeS32( 1, m_inputFrequencyOffset); + 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); - 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); - s.writeString(16, m_title); - s.writeString(17, m_audioDeviceName); - s.writeBool(18, m_useReverseAPI); - s.writeString(19, m_reverseAPIAddress); - s.writeU32(20, m_reverseAPIPort); - s.writeU32(21, m_reverseAPIDeviceIndex); - s.writeU32(22, m_reverseAPIChannelIndex); - s.writeS32(23, m_streamIndex); + 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); + // Noise reduction + s.writeBool( 30, m_dnr); + s.writeBool( 31, m_snb); + 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); + // + 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(24, m_rollupState->serialize()); + s.writeBlob(78, m_rollupState->serialize()); } - s.writeS32(25, m_workspaceIndex); - s.writeBlob(26, m_geometryBytes); - s.writeBool(27, m_hidden); - s.writeU32(29, m_filterIndex); + 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++) + for (unsigned int i = 0; i < 10; i++) { - s.writeS32(100 + 10*i, m_filterBank[i].m_spanLog2); - s.writeS32(101 + 10*i, m_filterBank[i].m_highCutoff / 100.0); - s.writeS32(102 + 10*i, m_filterBank[i].m_lowCutoff / 100.0); - s.writeS32(103 + 10*i, (int) m_filterBank[i].m_fftWindow); - s.writeBool(104 + 10*i, m_filterBank[i].m_dnr); - s.writeS32(105 + 10*i, m_filterBank[i].m_dnrScheme); - s.writeFloat(106 + 10*i, m_filterBank[i].m_dnrAboveAvgFactor); - s.writeFloat(107 + 10*i, m_filterBank[i].m_dnrSigmaFactor); - s.writeS32(108 + 10*i, m_filterBank[i].m_dnrNbPeaks); - s.writeFloat(109 + 10*i, m_filterBank[i].m_dnrAlpha); + // Filter + s.writeS32 (100 + 50*i, m_profiles[i].m_spanLog2); + s.writeS32 (101 + 50*i, m_profiles[i].m_highCutoff / 100.0); + s.writeS32 (102 + 50*i, m_profiles[i].m_lowCutoff / 100.0); + s.writeS32 (103 + 50*i, m_profiles[i].m_fftWindow); + // AGC + s.writeBool (110 + 50*i, m_profiles[i].m_agc); + s.writeS32 (111 + 50*i, (int) m_profiles[i].m_agcMode); + s.writeS32 (112 + 50*i, m_profiles[i].m_agcGain); + s.writeS32 (113 + 50*i, m_profiles[i].m_agcSlope); + s.writeS32 (114 + 50*i, m_profiles[i].m_agcHangThreshold); + // Noise blanjer + s.writeBool (120 + 50*i, m_profiles[i].m_dnb); + s.writeS32 (121 + 50*i, (int) m_profiles[i].m_nbScheme); + s.writeS32 (122 + 50*i, (int) m_profiles[i].m_nb2Mode); + s.writeDouble(123 + 50*i, m_profiles[i].m_nbSlewTime); + s.writeDouble(124 + 50*i, m_profiles[i].m_nbLeadTime); + s.writeDouble(125 + 50*i, m_profiles[i].m_nbLagTime); + s.writeS32 (126 + 50*i, m_profiles[i].m_nbThreshold); + // 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); + s.writeS32 (135 + 50*i, (int) m_profiles[i].m_nr2NPE); + s.writeS32 (136 + 50*i, (int) m_profiles[i].m_nrPosition); + s.writeBool (137 + 50*i, m_profiles[i].m_nr2ArtifactReduction); } return s.final(); @@ -137,8 +193,8 @@ bool WDSPRxSettings::deserialize(const QByteArray& data) uint32_t utmp; QString strtmp; - d.readS32(1, &m_inputFrequencyOffset, 0); - d.readS32(3, &tmp, 30); + d.readS32( 1, &m_inputFrequencyOffset, 0); + d.readS32( 3, &tmp, 30); m_volume = tmp / 10.0; if (m_spectrumGUI) @@ -147,21 +203,46 @@ bool WDSPRxSettings::deserialize(const QByteArray& data) 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); - d.readBool(11, &m_agc, true); - d.readS32(12, &tmp, 2); - m_agcMode = (AGCMode) tmp; - d.readS32(13, &m_agcGain, 80); - d.readS32(14, &m_agcSlope, 35); - d.readS32(15, &m_agcHangThreshold, 0); - d.readString(16, &m_title, "WDSP Receiver"); - d.readString(17, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName); - d.readBool(18, &m_useReverseAPI, false); - d.readString(19, &m_reverseAPIAddress, "127.0.0.1"); - d.readU32(20, &utmp, 0); + 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( 29, &m_dnb, false); + d.readS32( 24, &tmp, 2); + m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) tmp; + d.readS32( 29, &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); + // 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); + m_nrScheme = (WDSPRxProfile::WDSPRxNRScheme) tmp; + d.readS32( 25, &tmp, 2); + m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp; + d.readS32( 26, &tmp, 2); + m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp; + d.readS32( 27, &tmp, 2); + m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp; + d.readBool( 28, &m_nr2ArtifactReduction, true); + // + 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; @@ -169,40 +250,63 @@ bool WDSPRxSettings::deserialize(const QByteArray& data) m_reverseAPIPort = 8888; } - d.readU32(21, &utmp, 0); + d.readU32( 75, &utmp, 0); m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; - d.readU32(22, &utmp, 0); + d.readU32( 76, &utmp, 0); m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp; - d.readS32(23, &m_streamIndex, 0); + d.readS32( 77, &m_streamIndex, 0); if (m_rollupState) { - d.readBlob(24, &bytetmp); + d.readBlob(78, &bytetmp); m_rollupState->deserialize(bytetmp); } - d.readS32(25, &m_workspaceIndex, 0); - d.readBlob(26, &m_geometryBytes); - d.readBool(27, &m_hidden, false); - d.readU32(29, &utmp, 0); - m_filterIndex = utmp < 10 ? utmp : 0; + 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(100 + 10*i, &m_filterBank[i].m_spanLog2, 3); - d.readS32(101 + 10*i, &tmp, 30); - m_filterBank[i].m_highCutoff = tmp * 100.0; - d.readS32(102+ 10*i, &tmp, 3); - m_filterBank[i].m_lowCutoff = tmp * 100.0; - d.readS32(103 + 10*i, &tmp, (int) FFTWindow::Blackman); - m_filterBank[i].m_fftWindow = - (FFTWindow::Function) (tmp < 0 ? 0 : tmp > (int) FFTWindow::BlackmanHarris7 ? (int) FFTWindow::BlackmanHarris7 : tmp); - d.readBool(104 + 10*i, &m_filterBank[i].m_dnr, false); - d.readS32(105 + 10*i, &m_filterBank[i].m_dnrScheme, 0); - d.readFloat(106 + 10*i, &m_filterBank[i].m_dnrAboveAvgFactor, 20.0f); - d.readFloat(107 + 10*i, &m_filterBank[i].m_dnrSigmaFactor, 4.0f); - d.readS32(108 + 10*i, &m_filterBank[i].m_dnrNbPeaks, 10); - d.readFloat(109 + 10*i, &m_filterBank[i].m_dnrAlpha, 0.95f); + // Filter + d.readS32 (100 + 50*i, &m_profiles[i].m_spanLog2, 3); + d.readS32 (101 + 50*i, &tmp, 30); + m_profiles[i].m_highCutoff = tmp * 100.0; + d.readS32 (102 + 50*i, &tmp, 3); + m_profiles[i].m_lowCutoff = tmp * 100.0; + d.readS32 (103 + 50*i, &m_profiles[i].m_fftWindow, 0); + // AGC + d.readBool( 110, &m_profiles[i].m_agc, true); + d.readS32( 111, &tmp, 2); + m_profiles[i].m_agcMode = (WDSPRxProfile::WDSPRxAGCMode) tmp; + d.readS32( 112, &m_profiles[i].m_agcGain, 80); + d.readS32( 113, &m_profiles[i].m_agcSlope, 35); + d.readS32( 114, &m_profiles[i].m_agcHangThreshold, 0); + // Noise blanker + d.readBool (120 + 50*i, &m_profiles[i].m_dnb, false); + d.readS32 (121 + 50*i, &tmp); + m_profiles[i].m_nbScheme = (WDSPRxProfile::WDSPRxNBScheme) tmp; + d.readS32 (122 + 50*i, &tmp); + m_profiles[i].m_nb2Mode = (WDSPRxProfile::WDSPRxNB2Mode) tmp; + d.readDouble(123 + 50*i, &m_profiles[i].m_nbSlewTime, 0.01); + d.readDouble(124 + 50*i, &m_profiles[i].m_nbLeadTime, 0.01); + d.readDouble(125 + 50*i, &m_profiles[i].m_nbLagTime, 0.01); + d.readS32 (126 + 50*i, &m_profiles[i].m_nbThreshold, 40); + // 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; + d.readS32 (134 + 50*i, &tmp); + m_profiles[i].m_nr2Gain = (WDSPRxProfile::WDSPRxNR2Gain) tmp; + d.readS32 (135 + 50*i, &tmp); + m_profiles[i].m_nr2NPE = (WDSPRxProfile::WDSPRxNR2NPE) tmp; + d.readS32 (136 + 50*i, &tmp); + m_profiles[i].m_nrPosition = (WDSPRxProfile::WDSPRxNRPosition) tmp; + d.readBool (137 + 50*i, &m_profiles[i].m_nr2ArtifactReduction); } return true; diff --git a/plugins/channelrx/wdsprx/wdsprxsettings.h b/plugins/channelrx/wdsprx/wdsprxsettings.h index 1b3e64237..6b88852b4 100644 --- a/plugins/channelrx/wdsprx/wdsprxsettings.h +++ b/plugins/channelrx/wdsprx/wdsprxsettings.h @@ -25,37 +25,110 @@ class Serializable; -struct WDSPRxFilterSettings -{ - int m_spanLog2; - Real m_highCutoff; - Real m_lowCutoff; - int m_fftWindow; // 0: 4-term Blackman-Harris, 1: 7-term Blackman-Harris - bool m_dnr; - int m_dnrScheme; - float m_dnrAboveAvgFactor; - float m_dnrSigmaFactor; - int m_dnrNbPeaks; - float m_dnrAlpha; - WDSPRxFilterSettings() : - m_spanLog2(3), - m_highCutoff(3000), - m_lowCutoff(300), - m_fftWindow(0) - {} -}; - -struct WDSPRxSettings +struct WDSPRxProfile { - enum AGCMode + enum WDSPRxAGCMode { AGCLong, AGCSlow, AGCMedium, AGCFast, }; + enum WDSPRxNRScheme + { + NRSchemeNR, + NRSchemeNR2, + }; + enum WDSPRxNBScheme + { + NBSchemeNB, + NBSchemeNB2, + }; + enum WDSPRxNR2Gain + { + NR2GainLinear, + NR2GainLog, + NR2GainGamma, + }; + enum WDSPRxNR2NPE + { + NR2NPEOSMS, + NR2NPEMMSE, + }; + enum WDSPRxNRPosition + { + NRPositionPreAGC, + NRPositionPostAGC, + }; + enum WDSPRxNB2Mode + { + NB2ModeZero, + NB2ModeSampleAndHold, + NB2ModeMeanHold, + NB2ModeHoldSample, + NB2ModeInterpolate, + }; + // 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; + double m_nbLeadTime; + double m_nbLagTime; + int m_nbThreshold; + // Noise rediction + bool m_dnr; + bool m_snb; + bool m_anf; + WDSPRxNRScheme m_nrScheme; + WDSPRxNR2Gain m_nr2Gain; + WDSPRxNR2NPE m_nr2NPE; + WDSPRxNRPosition m_nrPosition; + bool m_nr2ArtifactReduction; + + WDSPRxProfile() : + 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.01), + m_nbLeadTime(0.01), + m_nbLagTime(0.01), + m_nbThreshold(30), + m_dnr(false), + m_snb(false), + m_anf(false), + m_nrScheme(NRSchemeNR), + m_nr2Gain(NR2GainGamma), + m_nr2NPE(NR2NPEOSMS), + m_nrPosition(NRPositionPreAGC), + m_nr2ArtifactReduction(true) + {} +}; + +struct WDSPRxSettings +{ qint32 m_inputFrequencyOffset; // Real m_highCutoff; // Real m_lowCutoff; @@ -65,17 +138,30 @@ struct WDSPRxSettings bool m_audioFlipChannels; bool m_dsb; bool m_audioMute; + // AGC bool m_agc; - AGCMode m_agcMode; + 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; + // Noise reduction bool m_dnr; - int m_dnrScheme; - float m_dnrAboveAvgFactor; - float m_dnrSigmaFactor; - int m_dnrNbPeaks; - float m_dnrAlpha; + bool m_snb; + bool m_anf; + WDSPRxProfile::WDSPRxNRScheme m_nrScheme; + WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain; + WDSPRxProfile::WDSPRxNR2NPE m_nr2NPE; + WDSPRxProfile::WDSPRxNRPosition m_nrPosition; + bool m_nr2ArtifactReduction; + quint32 m_rgbColor; QString m_title; QString m_audioDeviceName; @@ -88,9 +174,8 @@ struct WDSPRxSettings int m_workspaceIndex; QByteArray m_geometryBytes; bool m_hidden; - // FFTWindow::Function m_fftWindow; - std::vector m_filterBank; - unsigned int m_filterIndex; + std::vector m_profiles; + unsigned int m_profileIndex; Serializable *m_channelMarker; Serializable *m_spectrumGUI; diff --git a/plugins/channelrx/wdsprx/wdsprxsink.cpp b/plugins/channelrx/wdsprx/wdsprxsink.cpp index 4a9c310ab..594d2b3f4 100644 --- a/plugins/channelrx/wdsprx/wdsprxsink.cpp +++ b/plugins/channelrx/wdsprx/wdsprxsink.cpp @@ -322,11 +322,11 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force) { qDebug() << "WDSPRxSink::applySettings:" << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset - << " m_filterIndex: " << settings.m_filterIndex - << " m_spanLog2: " << settings.m_filterBank[settings.m_filterIndex].m_spanLog2 - << " m_highCutoff: " << settings.m_filterBank[settings.m_filterIndex].m_highCutoff - << " m_lowCutoff: " << settings.m_filterBank[settings.m_filterIndex].m_lowCutoff - << " m_fftWindow: " << settings.m_filterBank[settings.m_filterIndex].m_fftWindow << "]" + << " 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 @@ -346,16 +346,16 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force) << " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex << " force: " << force; - if((m_settings.m_filterBank[m_settings.m_filterIndex].m_highCutoff != settings.m_filterBank[settings.m_filterIndex].m_highCutoff) || - (m_settings.m_filterBank[m_settings.m_filterIndex].m_lowCutoff != settings.m_filterBank[settings.m_filterIndex].m_lowCutoff) || - (m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow != settings.m_filterBank[settings.m_filterIndex].m_fftWindow) || + 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_dsb != settings.m_dsb) || force) { float band, low, high, fLow, fHigh; - band = settings.m_filterBank[settings.m_filterIndex].m_highCutoff; + band = settings.m_profiles[settings.m_profileIndex].m_highCutoff; high = band; - low = settings.m_filterBank[settings.m_filterIndex].m_lowCutoff; + low = settings.m_profiles[settings.m_profileIndex].m_lowCutoff; if (band < 0) { @@ -406,11 +406,11 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force) m_interpolatorDistance = (Real) m_channelSampleRate / (Real) m_audioSampleRate; WDSP::RXA::SetPassband(*m_rxa, fLow, fHigh); - WDSP::NBP::NBPSetWindow(*m_rxa, m_settings.m_filterBank[m_settings.m_filterIndex].m_fftWindow); + WDSP::NBP::NBPSetWindow(*m_rxa, m_settings.m_profiles[m_settings.m_profileIndex].m_fftWindow); } - if ((m_settings.m_filterBank[settings.m_filterIndex].m_spanLog2 != settings.m_filterBank[settings.m_filterIndex].m_spanLog2) || force) { - m_spectrumProbe.setSpanLog2(settings.m_filterBank[settings.m_filterIndex].m_spanLog2); + 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); } if ((m_settings.m_agc != settings.m_agc) @@ -427,25 +427,25 @@ void WDSPRxSink::applySettings(const WDSPRxSettings& settings, bool force) { switch (settings.m_agcMode) { - case WDSPRxSettings::AGCMode::AGCLong: + 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); break; - case WDSPRxSettings::AGCMode::AGCSlow: + 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); break; - case WDSPRxSettings::AGCMode::AGCMedium: + 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 WDSPRxSettings::AGCMode::AGCFast: + 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);