23 #ifndef INCLUDED_ANALOG_AGC_H 24 #define INCLUDED_ANALOG_AGC_H 53 float reference = 1.0,
56 : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){};
60 float rate()
const {
return _rate; }
62 float gain()
const {
return _gain; }
74 _gain += _rate * (_reference - std::sqrt(output.real() * output.real() +
75 output.imag() * output.imag()));
76 if (_max_gain > 0.0 && _gain > _max_gain) {
84 for (
unsigned i = 0; i < n; i++) {
85 output[i] = scale(input[i]);
113 float reference = 1.0,
115 float max_gain = 0.0)
116 : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){};
120 float rate()
const {
return _rate; }
122 float gain()
const {
return _gain; }
132 float output = input * _gain;
133 _gain += (_reference - fabsf(output)) * _rate;
134 if (_max_gain > 0.0 && _gain > _max_gain)
139 void scaleN(
float output[],
const float input[],
unsigned n)
141 for (
unsigned i = 0; i < n; i++)
142 output[i] = scale(input[i]);
void set_rate(float rate)
Definition: agc.h:125
float _gain
Definition: agc.h:92
agc_cc(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:52
float max_gain() const
Definition: agc.h:63
void scaleN(float output[], const float input[], unsigned n)
Definition: agc.h:139
float gain() const
Definition: agc.h:62
float _max_gain
Definition: agc.h:93
void set_reference(float reference)
Definition: agc.h:66
float scale(float input)
Definition: agc.h:130
float _max_gain
Definition: agc.h:149
std::complex< float > gr_complex
Definition: gr_complex.h:27
void set_reference(float reference)
Definition: agc.h:126
high performance Automatic Gain Control class for complex signals.
Definition: agc.h:41
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
high performance Automatic Gain Control class for float signals.
Definition: agc.h:101
~agc_ff()
Definition: agc.h:118
gr_complex scale(gr_complex input)
Definition: agc.h:70
float rate() const
Definition: agc.h:120
void set_max_gain(float max_gain)
Definition: agc.h:128
float reference() const
Definition: agc.h:121
void set_gain(float gain)
Definition: agc.h:127
float rate() const
Definition: agc.h:60
agc_ff(float rate=1e-4, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc.h:112
float _gain
Definition: agc.h:148
float _reference
Definition: agc.h:147
float _rate
Definition: agc.h:146
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
float max_gain() const
Definition: agc.h:123
float gain() const
Definition: agc.h:122
float _rate
Definition: agc.h:90
float _reference
Definition: agc.h:91
float reference() const
Definition: agc.h:61
virtual ~agc_cc()
Definition: agc.h:58
void set_rate(float rate)
Definition: agc.h:65
void set_max_gain(float max_gain)
Definition: agc.h:68
void scaleN(gr_complex output[], const gr_complex input[], unsigned n)
Definition: agc.h:82
void set_gain(float gain)
Definition: agc.h:67