2024-06-16 05:31:13 -04:00
|
|
|
/* amsq.h
|
|
|
|
|
|
|
|
This file is part of a program that implements a Software-Defined Radio.
|
|
|
|
|
|
|
|
Copyright (C) 2013 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 _amsq_h
|
|
|
|
#define _amsq_h
|
|
|
|
|
|
|
|
#include "export.h"
|
|
|
|
|
|
|
|
namespace WDSP {
|
|
|
|
|
|
|
|
class RXA;
|
|
|
|
class TXA;
|
|
|
|
|
|
|
|
class WDSP_API AMSQ
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int run; // 0 if squelch system is OFF; 1 if it's ON
|
|
|
|
int size; // size of input/output buffers
|
2024-06-24 21:50:48 -04:00
|
|
|
float* in; // squelch input signal buffer
|
|
|
|
float* out; // squelch output signal buffer
|
|
|
|
float* trigger; // pointer to trigger data source
|
|
|
|
float* trigsig; // buffer containing trigger signal
|
2024-07-05 21:25:41 -04:00
|
|
|
double rate; // sample rate
|
|
|
|
double avtau; // time constant for averaging noise
|
|
|
|
double avm;
|
|
|
|
double onem_avm;
|
|
|
|
double avsig;
|
2024-06-16 05:31:13 -04:00
|
|
|
int state; // state machine control
|
|
|
|
int count;
|
2024-07-05 21:25:41 -04:00
|
|
|
double tup;
|
|
|
|
double tdown;
|
2024-06-16 05:31:13 -04:00
|
|
|
int ntup;
|
|
|
|
int ntdown;
|
2024-07-17 20:08:05 -04:00
|
|
|
double* cup;
|
|
|
|
double* cdown;
|
2024-07-05 21:25:41 -04:00
|
|
|
double tail_thresh;
|
|
|
|
double unmute_thresh;
|
|
|
|
double min_tail;
|
|
|
|
double max_tail;
|
|
|
|
double muted_gain;
|
|
|
|
|
2024-07-26 11:52:34 -04:00
|
|
|
AMSQ (
|
|
|
|
int _run,
|
|
|
|
int _size,
|
|
|
|
float* _in,
|
|
|
|
float* _out,
|
|
|
|
float* _trigger,
|
|
|
|
int _rate,
|
|
|
|
double _avtau,
|
|
|
|
double _tup,
|
|
|
|
double _tdown,
|
|
|
|
double _tail_thresh,
|
|
|
|
double _unmute_thresh,
|
|
|
|
double _min_tail,
|
|
|
|
double _max_tail,
|
|
|
|
double _muted_gain
|
2024-07-05 21:25:41 -04:00
|
|
|
);
|
2024-07-26 11:52:34 -04:00
|
|
|
~AMSQ();
|
|
|
|
|
|
|
|
void flush();
|
|
|
|
void execute();
|
|
|
|
void xcap();
|
|
|
|
void setBuffers(float* in, float* out, float* trigger);
|
|
|
|
void setSamplerate(int rate);
|
|
|
|
void setSize(int size);
|
2024-06-16 05:31:13 -04:00
|
|
|
// RXA Properties
|
2024-07-26 11:52:34 -04:00
|
|
|
void setRun(int run);
|
|
|
|
void setThreshold(double threshold);
|
|
|
|
void setMaxTail(double tail);
|
|
|
|
void setMutedGain(double dBlevel);
|
2024-06-16 05:31:13 -04:00
|
|
|
|
|
|
|
private:
|
2024-07-26 11:52:34 -04:00
|
|
|
void compute_slews();
|
|
|
|
void calc();
|
|
|
|
void decalc();
|
2024-06-16 05:31:13 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace WDSP
|
|
|
|
|
|
|
|
#endif
|