11 #ifndef INCLUDED_ANALOG_AGC_H
12 #define INCLUDED_ANALOG_AGC_H
41 float reference = 1.0,
44 : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){};
48 float rate()
const {
return _rate; }
50 float gain()
const {
return _gain; }
62 _gain += _rate * (_reference - std::sqrt(output.real() * output.real() +
63 output.imag() * output.imag()));
64 if (_max_gain > 0.0 && _gain > _max_gain) {
72 for (
unsigned i = 0; i < n; i++) {
73 output[i] = scale(input[i]);
101 float reference = 1.0,
103 float max_gain = 0.0)
104 : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){};
108 float rate()
const {
return _rate; }
110 float gain()
const {
return _gain; }
120 float output = input * _gain;
121 _gain += (_reference - fabsf(output)) * _rate;
122 if (_max_gain > 0.0 && _gain > _max_gain)
127 void scaleN(
float output[],
const float input[],
unsigned n)
129 for (
unsigned i = 0; i < n; i++)
130 output[i] = scale(input[i]);
high performance Automatic Gain Control class for complex signals.
Definition: agc.h:30
virtual ~agc_cc()
Definition: agc.h:46
agc_cc(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:40
float _max_gain
Definition: agc.h:81
float _gain
Definition: agc.h:80
gr_complex scale(gr_complex input)
Definition: agc.h:58
void set_gain(float gain)
Definition: agc.h:55
float _reference
Definition: agc.h:79
float rate() const
Definition: agc.h:48
void scaleN(gr_complex output[], const gr_complex input[], unsigned n)
Definition: agc.h:70
void set_rate(float rate)
Definition: agc.h:53
void set_reference(float reference)
Definition: agc.h:54
float _rate
Definition: agc.h:78
float gain() const
Definition: agc.h:50
float reference() const
Definition: agc.h:49
float max_gain() const
Definition: agc.h:51
void set_max_gain(float max_gain)
Definition: agc.h:56
high performance Automatic Gain Control class for float signals.
Definition: agc.h:90
float _gain
Definition: agc.h:136
float gain() const
Definition: agc.h:110
~agc_ff()
Definition: agc.h:106
void set_gain(float gain)
Definition: agc.h:115
float reference() const
Definition: agc.h:109
float _max_gain
Definition: agc.h:137
float _reference
Definition: agc.h:135
float rate() const
Definition: agc.h:108
float max_gain() const
Definition: agc.h:111
void scaleN(float output[], const float input[], unsigned n)
Definition: agc.h:127
void set_max_gain(float max_gain)
Definition: agc.h:116
agc_ff(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:100
float _rate
Definition: agc.h:134
void set_reference(float reference)
Definition: agc.h:114
void set_rate(float rate)
Definition: agc.h:113
float scale(float input)
Definition: agc.h:118
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:18
std::complex< float > gr_complex
Definition: gr_complex.h:15
GNU Radio logging wrapper.
Definition: basic_block.h:29