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

272 lines
7.8 KiB
C
Raw Normal View History

///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2024 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_
#define PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_
#include <QByteArray>
#include <QString>
#include "dsp/fftwindow.h"
class Serializable;
2024-06-26 21:39:25 -04:00
struct WDSPRxProfile
{
enum WDSPRxDemod
{
DemodSSB,
DemodAM,
DemodSAM,
DemodFMN,
};
2024-06-26 21:39:25 -04:00
enum WDSPRxAGCMode
{
AGCLong,
AGCSlow,
AGCMedium,
AGCFast,
};
enum WDSPRxNRScheme
{
NRSchemeNR,
NRSchemeNR2,
};
enum WDSPRxNBScheme
{
NBSchemeNB, //!< Preemptive Wideband Blanker (ANB)
NBSchemeNB2, //!< Interpolating Wideband Blanker (NOB)
2024-06-26 21:39:25 -04:00
};
enum WDSPRxNR2Gain
{
NR2GainLinear,
NR2GainLog,
NR2GainGamma,
};
enum WDSPRxNR2NPE
{
NR2NPEOSMS,
NR2NPEMMSE,
};
enum WDSPRxNRPosition
{
NRPositionPreAGC,
NRPositionPostAGC,
};
enum WDSPRxNB2Mode
{
NB2ModeZero,
NB2ModeSampleAndHold,
NB2ModeMeanHold,
NB2ModeHoldSample,
NB2ModeInterpolate,
};
enum WDSPRxSquelchMode
{
SquelchModeVoice,
SquelchModeAM,
SquelchModeFM,
};
2024-06-26 21:39:25 -04:00
WDSPRxDemod m_demod;
2024-06-26 21:39:25 -04:00
// Filter
int m_spanLog2;
Real m_highCutoff;
Real m_lowCutoff;
int m_fftWindow; // 0: 4-term Blackman-Harris, 1: 7-term Blackman-Harris
// AGC
bool m_agc;
WDSPRxAGCMode m_agcMode;
int m_agcGain; //!< Fixed gain if AGC is off else top gain
int m_agcSlope;
int m_agcHangThreshold;
// Noise blanker
bool m_dnb;
WDSPRxNBScheme m_nbScheme;
WDSPRxNB2Mode m_nb2Mode;
double m_nbSlewTime; // a.k.a tau
double m_nbLeadTime; // a.k.a adv time
double m_nbLagTime; // a.k.a hang time
2024-06-26 21:39:25 -04:00
int m_nbThreshold;
double m_nbAvgTime; // a.k.a back tau
2024-06-26 21:39:25 -04:00
// Noise rediction
bool m_dnr;
2024-06-26 21:39:25 -04:00
bool m_anf;
WDSPRxNRScheme m_nrScheme;
WDSPRxNR2Gain m_nr2Gain;
WDSPRxNR2NPE m_nr2NPE;
WDSPRxNRPosition m_nrPosition;
bool m_nr2ArtifactReduction;
// Demods
bool m_amFadeLevel;
bool m_cwPeaking;
double m_cwPeakFrequency;
double m_cwBandwidth;
double m_cwGain;
2024-07-04 15:37:56 -04:00
double m_fmDeviation;
double m_fmAFLow;
double m_fmAFHigh;
bool m_fmAFLimiter;
double m_fmAFLimiterGain;
bool m_fmCTCSSNotch;
double m_fmCTCSSNotchFrequency;
// Squelch
bool m_squelch;
int m_squelchThreshold;
WDSPRxSquelchMode m_squelchMode;
double m_ssqlTauMute; //!< Voice squelch tau mute
double m_ssqlTauUnmute; //!< Voice squelch tau unmute
double m_amsqMaxTail;
2024-06-26 21:39:25 -04:00
WDSPRxProfile() :
m_demod(DemodSSB),
m_spanLog2(3),
2024-06-24 04:20:14 -04:00
m_highCutoff(3000),
m_lowCutoff(300),
2024-06-26 21:39:25 -04:00
m_fftWindow(0),
m_agc(false),
m_agcMode(AGCMedium),
m_agcGain(80),
m_agcSlope(35),
m_agcHangThreshold(0),
m_dnb(false),
m_nbScheme(NBSchemeNB),
m_nb2Mode(NB2ModeZero),
m_nbSlewTime(0.1),
m_nbLeadTime(0.1),
m_nbLagTime(0.1),
2024-06-26 21:39:25 -04:00
m_nbThreshold(30),
m_nbAvgTime(50.0),
2024-06-26 21:39:25 -04:00
m_dnr(false),
m_anf(false),
m_nrScheme(NRSchemeNR),
m_nr2Gain(NR2GainGamma),
m_nr2NPE(NR2NPEOSMS),
m_nrPosition(NRPositionPreAGC),
m_nr2ArtifactReduction(true),
m_amFadeLevel(false),
m_cwPeaking(false),
m_cwPeakFrequency(600.0),
m_cwBandwidth(100.0),
2024-07-04 15:37:56 -04:00
m_cwGain(2.0),
m_fmDeviation(2500.0),
m_fmAFLow(300.0),
m_fmAFHigh(3000.0),
m_fmAFLimiter(false),
m_fmAFLimiterGain(10.0),
m_fmCTCSSNotch(false),
m_fmCTCSSNotchFrequency(67.0),
m_squelch(false),
m_squelchThreshold(3),
m_squelchMode(SquelchModeVoice),
m_ssqlTauMute(0.1),
m_ssqlTauUnmute(0.1),
m_amsqMaxTail(1.5)
{}
};
struct WDSPRxSettings
{
WDSPRxProfile::WDSPRxDemod m_demod;
qint32 m_inputFrequencyOffset;
2024-06-24 04:20:14 -04:00
// Real m_highCutoff;
// Real m_lowCutoff;
Real m_volume;
// int m_spanLog2;
bool m_audioBinaural;
bool m_audioFlipChannels;
bool m_dsb;
bool m_audioMute;
2024-06-26 21:39:25 -04:00
// AGC
bool m_agc;
2024-06-26 21:39:25 -04:00
WDSPRxProfile::WDSPRxAGCMode m_agcMode;
2024-06-24 04:20:14 -04:00
int m_agcGain; //!< Fixed gain if AGC is off else top gain
int m_agcSlope;
int m_agcHangThreshold;
2024-06-26 21:39:25 -04:00
// Noise blanker
bool m_dnb;
WDSPRxProfile::WDSPRxNBScheme m_nbScheme;
WDSPRxProfile::WDSPRxNB2Mode m_nb2Mode;
double m_nbSlewTime;
double m_nbLeadTime;
double m_nbLagTime;
int m_nbThreshold;
double m_nbAvgTime;
2024-06-26 21:39:25 -04:00
// Noise reduction
bool m_dnr;
2024-06-26 21:39:25 -04:00
bool m_anf;
WDSPRxProfile::WDSPRxNRScheme m_nrScheme;
WDSPRxProfile::WDSPRxNR2Gain m_nr2Gain;
WDSPRxProfile::WDSPRxNR2NPE m_nr2NPE;
WDSPRxProfile::WDSPRxNRPosition m_nrPosition;
bool m_nr2ArtifactReduction;
// Demods
bool m_amFadeLevel;
bool m_cwPeaking;
double m_cwPeakFrequency;
double m_cwBandwidth;
double m_cwGain;
2024-07-04 15:37:56 -04:00
double m_fmDeviation;
double m_fmAFLow;
double m_fmAFHigh;
bool m_fmAFLimiter;
double m_fmAFLimiterGain;
bool m_fmCTCSSNotch;
double m_fmCTCSSNotchFrequency;
// Squelch
bool m_squelch;
int m_squelchThreshold;
WDSPRxProfile::WDSPRxSquelchMode m_squelchMode;
double m_ssqlTauMute; //!< Voice squelch tau mute
double m_ssqlTauUnmute; //!< Voice squelch tau unmute
double m_amsqMaxTail;
2024-06-26 21:39:25 -04:00
quint32 m_rgbColor;
QString m_title;
QString m_audioDeviceName;
int m_streamIndex; //!< MIMO channel. Not relevant when connected to SI (single Rx).
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
uint16_t m_reverseAPIChannelIndex;
int m_workspaceIndex;
QByteArray m_geometryBytes;
bool m_hidden;
2024-06-26 21:39:25 -04:00
std::vector<WDSPRxProfile> m_profiles;
unsigned int m_profileIndex;
Serializable *m_channelMarker;
Serializable *m_spectrumGUI;
Serializable *m_rollupState;
WDSPRxSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
static const int m_minPowerThresholdDB;
static const float m_mminPowerThresholdDBf;
};
#endif /* PLUGINS_CHANNELRX_WDSPRX_WDSPRXSETTINGS_H_ */