1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-14 04:11:48 -05:00
sdrangel/wdsp/RXA.hpp
2024-07-29 23:31:43 +02:00

200 lines
5.4 KiB
C++

/* RXA.h
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2013, 2014, 2015, 2016 Warren Pratt, NR0V
Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel
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; either version 2
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
The author can be reached by email at
warren@wpratt.com
*/
#ifndef wdsp_rxa_h
#define wdsp_rxa_h
#include "comm.hpp"
#include "unit.hpp"
#include "export.h"
namespace WDSP {
class METER;
class SHIFT;
class RESAMPLE;
class BANDPASS;
class BPS;
class NOTCHDB;
class NBP;
class BPSNBA;
class SNBA;
class SENDER;
class AMSQ;
class AMD;
class FMD;
class FMSQ;
class EQP;
class ANF;
class ANR;
class EMNR;
class WCPAGC;
class SPEAK;
class MPEAK;
class PANEL;
class SIPHON;
class CBL;
class SSQL;
class ANB;
class NOB;
class BufferProbe;
class WDSP_API RXA : public Unit
{
public:
enum rxaMode
{
RXA_LSB,
RXA_USB,
RXA_DSB,
RXA_CWL,
RXA_CWU,
RXA_FM,
RXA_AM,
RXA_DIGU,
RXA_SPEC,
RXA_DIGL,
RXA_SAM,
RXA_DRM
};
enum rxaMeterType
{
RXA_S_PK,
RXA_S_AV,
RXA_ADC_PK,
RXA_ADC_AV,
RXA_AGC_GAIN,
RXA_AGC_PK,
RXA_AGC_AV,
RXA_METERTYPE_LAST
};
int mode;
double meter[RXA_METERTYPE_LAST];
ANB *anb;
NOB *nob;
SHIFT *shift;
RESAMPLE *rsmpin;
METER *adcmeter;
NOTCHDB *ndb;
NBP *nbp0;
BPSNBA *bpsnba;
SENDER *sender;
METER *smeter;
AMSQ *amsq;
AMD *amd;
FMD *fmd;
FMSQ *fmsq;
SNBA *snba;
EQP *eqp;
ANF *anf;
ANR *anr;
EMNR *emnr;
WCPAGC *agc;
METER *agcmeter;
BANDPASS *bp1;
BPS *bps1;
SIPHON *sip1;
CBL *cbl;
SPEAK *speak;
MPEAK *mpeak;
SSQL *ssql;
PANEL *panel;
RESAMPLE *rsmpout;
static RXA* create_rxa (
int in_rate, // input samplerate
int out_rate, // output samplerate
int dsp_rate, // sample rate for mainstream dsp processing
int dsp_size // number complex samples processed per buffer in mainstream dsp processing
);
static void destroy_rxa (RXA *rxa);
static void flush_rxa (RXA *rxa);
static void xrxa (RXA *rxa);
int get_insize() const { return dsp_insize; }
int get_outsize() const { return dsp_outsize; }
float *get_inbuff() { return inbuff; }
float *get_outbuff() { return outbuff; }
void setSpectrumProbe(BufferProbe *_spectrumProbe);
static void setInputSamplerate (RXA *rxa, int in_rate);
static void setOutputSamplerate (RXA *rxa, int out_rate);
static void setDSPSamplerate (RXA *rxa, int dsp_rate);
static void setDSPBuffsize (RXA *rxa, int dsp_size);
// RXA Properties
static void SetMode (RXA& rxa, int mode);
static void ResCheck (RXA& rxa);
static void bp1Check (RXA& rxa, int amd_run, int snba_run, int emnr_run, int anf_run, int anr_run);
static void bp1Set (RXA& rxa);
static void bpsnbaCheck (RXA& rxa, int mode, int notch_run);
static void bpsnbaSet (RXA& rxa);
// NOTCHDB, NBP, SNBA
static void UpdateNBPFiltersLightWeight (RXA& rxa);
static void UpdateNBPFilters(RXA& rxa);
static int NBPAddNotch (RXA& rxa, int notch, double fcenter, double fwidth, int active);
static int NBPGetNotch (RXA& rxa, int notch, double* fcenter, double* fwidth, int* active);
static int NBPDeleteNotch (RXA& rxa, int notch);
static int NBPEditNotch (RXA& rxa, int notch, double fcenter, double fwidth, int active);
static void NBPGetNumNotches (RXA& rxa, int* nnotches);
static void NBPSetTuneFrequency (RXA& rxa, double tunefreq);
static void NBPSetShiftFrequency (RXA& rxa, double shift);
static void NBPSetNotchesRun (RXA& rxa, int run);
static void NBPSetWindow (RXA& rxa, int wintype);
static void NBPSetAutoIncrease (RXA& rxa, int autoincr);
// AMD
static void SetAMDRun(RXA& rxa, int run);
// SNBA
static void SetSNBARun (RXA& rxa, int run);
// ANF
static void SetANFRun (RXA& rxa, int run);
static void SetANFPosition (RXA& rxa, int position);
// ANR
static void SetANRRun (RXA& rxa, int run);
static void SetANRPosition (RXA& rxa, int position);
// EMNR
static void SetEMNRRun (RXA& rxa, int run);
static void SetEMNRPosition (RXA& rxa, int position);
// WCPAGC
static void SetAGCThresh(RXA& rxa, double thresh, double size, double rate);
static void GetAGCThresh(RXA& rxa, double *thresh, double size, double rate);
// Collectives
static void SetPassband (RXA& rxa, float f_low, float f_high);
static void SetNC (RXA& rxa, int nc);
static void SetMP (RXA& rxa, int mp);
private:
float* inbuff;
float* midbuff;
float* outbuff;
};
} // namespace WDSP
#endif