23 #ifndef INCLUDED_ANALOG_AGC_H 24 #define INCLUDED_ANALOG_AGC_H 52 agc_cc(
float rate = 1e-4,
float reference = 1.0,
53 float gain = 1.0,
float max_gain = 0.0)
54 : _rate(rate), _reference(reference),
55 _gain(gain), _max_gain(max_gain) {};
59 float rate()
const {
return _rate; }
61 float gain()
const {
return _gain; }
73 _gain += _rate * (_reference - std::sqrt(output.real()*output.real() +
74 output.imag()*output.imag()));
75 if(_max_gain > 0.0 && _gain > _max_gain) {
83 for(
unsigned i = 0; i < n; i++) {
84 output[i] = scale (input[i]);
111 agc_ff(
float rate = 1e-4,
float reference = 1.0,
112 float gain = 1.0,
float max_gain = 0.0)
113 : _rate(rate), _reference(reference), _gain(gain),
114 _max_gain(max_gain) {};
118 float rate ()
const {
return _rate; }
120 float gain ()
const {
return _gain; }
130 float output = input * _gain;
131 _gain += (_reference - fabsf (output)) * _rate;
132 if(_max_gain > 0.0 && _gain > _max_gain)
137 void scaleN(
float output[],
const float input[],
unsigned n)
139 for(
unsigned i = 0; i < n; i++)
140 output[i] = scale (input[i]);
void set_rate(float rate)
Definition: agc.h:123
float _gain
Definition: agc.h:91
agc_cc(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:52
float rate() const
Definition: agc.h:118
float reference() const
Definition: agc.h:119
void scaleN(float output[], const float input[], unsigned n)
Definition: agc.h:137
float rate() const
Definition: agc.h:59
float _max_gain
Definition: agc.h:92
float gain() const
Definition: agc.h:120
void set_reference(float reference)
Definition: agc.h:65
float scale(float input)
Definition: agc.h:128
float _max_gain
Definition: agc.h:147
std::complex< float > gr_complex
Definition: gr_complex.h:27
void set_reference(float reference)
Definition: agc.h:124
high performance Automatic Gain Control class for complex signals.
Definition: agc.h:41
Include this header to use the message passing features.
Definition: logger.h:695
high performance Automatic Gain Control class for float signals.
Definition: agc.h:100
float gain() const
Definition: agc.h:61
~agc_ff()
Definition: agc.h:116
gr_complex scale(gr_complex input)
Definition: agc.h:69
void set_max_gain(float max_gain)
Definition: agc.h:126
void set_gain(float gain)
Definition: agc.h:125
agc_ff(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:111
float _gain
Definition: agc.h:146
float _reference
Definition: agc.h:145
float max_gain() const
Definition: agc.h:62
float max_gain() const
Definition: agc.h:121
float _rate
Definition: agc.h:144
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
float _rate
Definition: agc.h:89
float _reference
Definition: agc.h:90
virtual ~agc_cc()
Definition: agc.h:57
void set_rate(float rate)
Definition: agc.h:64
void set_max_gain(float max_gain)
Definition: agc.h:67
void scaleN(gr_complex output[], const gr_complex input[], unsigned n)
Definition: agc.h:81
float reference() const
Definition: agc.h:60
void set_gain(float gain)
Definition: agc.h:66