mirror of
https://git.vladimir.cc/vladimir/wdsp.git
synced 2026-08-25 17:27:33 +00:00
Model the pair on fmd.c / fmmod.c, but with the parts that a 75 kHz
deviation forces:
- the demodulator discriminates with arg(x[n] * conj(x[n-1])) rather
than a PLL; an omegaN in the tens of kHz cannot track 75 kHz.
- emphasis is a one-pole RC (tau 75 us) on both ends, not fmd's 1/f
fc_impulse FIR. A 1/f FIR from f_low = 20 Hz would sit ~+57 dB at
20 Hz, where broadcast FM specifies flat below the corner.
- TXA_WFM leaves the shared preemph block off; wfmmod carries its own.
- wfmmod clamps bp_fc = deviation + f_high to 0.45 * samplerate, since
+/-90 kHz exceeds Nyquist at the rates the narrowband modes use.
Scope is mono: no 19 kHz pilot, no 38 kHz stereo subcarrier, no RDS.
Both mode enums are appended to so the ABI stays stable for clients.
The JNI bindings are deliberately left alone.
Verified against a wfmmod -> wfmd loopback: the discriminator is exact,
the dc-removal one-pole tracks |H_lp(f)| * ain * sdelta to ratio 1.000,
and a 700 + 1900 Hz two-tone comes back with THD+N ~ 3e-5 % at +/-37.5
kHz deviation. Note the demodulator aliases unless samplerate exceeds
2 * deviation * |aud|max, so 192 kHz is the practical floor.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
232 lines
3.2 KiB
C
232 lines
3.2 KiB
C
/* RXA.h
|
|
|
|
This file is part of a program that implements a Software-Defined Radio.
|
|
|
|
Copyright (C) 2013, 2014, 2015, 2016, 2025 Warren Pratt, NR0V
|
|
|
|
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 _rxa_h
|
|
#define _rxa_h
|
|
#include "comm.h"
|
|
|
|
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,
|
|
RXA_WFM
|
|
};
|
|
|
|
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
|
|
};
|
|
|
|
struct _rxa
|
|
{
|
|
double* inbuff;
|
|
double* outbuff;
|
|
double* midbuff;
|
|
int mode;
|
|
double meter[RXA_METERTYPE_LAST];
|
|
CRITICAL_SECTION* pmtupdate[RXA_METERTYPE_LAST];
|
|
struct
|
|
{
|
|
METER p;
|
|
} smeter, adcmeter, agcmeter;
|
|
struct
|
|
{
|
|
SHIFT p;
|
|
} shift;
|
|
struct
|
|
{
|
|
RESAMPLE p;
|
|
} rsmpin, rsmpout;
|
|
struct
|
|
{
|
|
GEN p;
|
|
} gen0;
|
|
struct
|
|
{
|
|
BANDPASS p;
|
|
} bp1;
|
|
struct
|
|
{
|
|
NOTCHDB p;
|
|
} ndb;
|
|
struct
|
|
{
|
|
NBP p;
|
|
} nbp0;
|
|
struct
|
|
{
|
|
BPSNBA p;
|
|
} bpsnba;
|
|
struct
|
|
{
|
|
SNBA p;
|
|
} snba;
|
|
struct
|
|
{
|
|
SENDER p;
|
|
} sender;
|
|
struct
|
|
{
|
|
AMSQ p;
|
|
} amsq;
|
|
struct
|
|
{
|
|
AMD p;
|
|
} amd;
|
|
struct
|
|
{
|
|
FMD p;
|
|
} fmd;
|
|
struct
|
|
{
|
|
FMSQ p;
|
|
} fmsq;
|
|
struct
|
|
{
|
|
WFMD p;
|
|
} wfmd;
|
|
struct
|
|
{
|
|
EQP p;
|
|
} eqp;
|
|
struct
|
|
{
|
|
ANF p;
|
|
} anf;
|
|
struct
|
|
{
|
|
ANR p;
|
|
} anr;
|
|
struct
|
|
{
|
|
EMNR p;
|
|
} emnr;
|
|
struct
|
|
{
|
|
WCPAGC p;
|
|
} agc;
|
|
struct
|
|
{
|
|
APFSHADOW p;
|
|
} apfshadow;
|
|
struct
|
|
{
|
|
DOUBLEPOLE p;
|
|
} doublepole;
|
|
struct
|
|
{
|
|
MATCHED p;
|
|
} matched;
|
|
struct
|
|
{
|
|
GAUSSIAN p;
|
|
} gaussian;
|
|
struct
|
|
{
|
|
RNNR p; // NR3 + NR4 support (nr3)
|
|
} rnnr;
|
|
struct
|
|
{
|
|
SBNR p; // NR3 + NR4 support (nr4)
|
|
} sbnr;
|
|
|
|
struct
|
|
{
|
|
SPEAK p;
|
|
} speak;
|
|
struct
|
|
{
|
|
MPEAK p;
|
|
} mpeak;
|
|
struct
|
|
{
|
|
PANEL p;
|
|
} panel;
|
|
struct
|
|
{
|
|
SIPHON p;
|
|
} sip1;
|
|
struct
|
|
{
|
|
CBL p;
|
|
} cbl;
|
|
struct
|
|
{
|
|
SSQL p;
|
|
} ssql;
|
|
};
|
|
|
|
extern struct _rxa rxa[];
|
|
|
|
extern void create_rxa (int channel);
|
|
|
|
extern void destroy_rxa (int channel);
|
|
|
|
extern void flush_rxa (int channel);
|
|
|
|
extern void xrxa (int channel);
|
|
|
|
extern void setInputSamplerate_rxa (int channel);
|
|
|
|
extern void setOutputSamplerate_rxa (int channel);
|
|
|
|
extern void setDSPSamplerate_rxa (int channel);
|
|
|
|
extern void setDSPBuffsize_rxa (int channel);
|
|
|
|
// RXA Properties
|
|
|
|
extern __declspec (dllexport) void SetRXAMode (int channel, int mode);
|
|
|
|
extern void RXAResCheck (int channel);
|
|
|
|
extern void RXAbp1Check (int channel, int amd_run, int snba_run, int emnr_run, int anf_run, int anr_run, int rnnr_run, int sbnr_run); // NR3 + NR4 support
|
|
|
|
extern void RXAbp1Set (int channel);
|
|
|
|
extern void RXAbpsnbaCheck (int channel, int mode, int notch_run);
|
|
|
|
extern void RXAbpsnbaSet (int channel);
|
|
|
|
#endif
|