23 #ifndef INCLUDED_ANALOG_AGC2_H 24 #define INCLUDED_ANALOG_AGC2_H 54 float decay_rate = 1e-2,
55 float reference = 1.0,
58 : _attack_rate(attack_rate),
59 _decay_rate(decay_rate),
60 _reference(reference),
62 _max_gain(max_gain){};
67 float gain()
const {
return _gain; }
80 float tmp = -_reference +
81 sqrt(output.real() * output.real() + output.imag() * output.imag());
82 float rate = _decay_rate;
93 if (_max_gain > 0.0 && _gain > _max_gain) {
101 for (
unsigned i = 0; i < n; i++)
102 output[i] = scale(input[i]);
127 float decay_rate = 1e-2,
128 float reference = 1.0,
130 float max_gain = 0.0)
131 : _attack_rate(attack_rate),
132 _decay_rate(decay_rate),
133 _reference(reference),
135 _max_gain(max_gain){};
140 float gain()
const {
return _gain; }
151 float output = input * _gain;
153 float tmp = (fabsf(output)) - _reference;
154 float rate = _decay_rate;
155 if (fabsf(tmp) > _gain) {
164 if (_max_gain > 0.0 && _gain > _max_gain) {
170 void scaleN(
float output[],
const float input[],
unsigned n)
172 for (
unsigned i = 0; i < n; i++)
173 output[i] = scale(input[i]);
float gain() const
Definition: agc2.h:67
float decay_rate() const
Definition: agc2.h:138
void set_reference(float reference)
Definition: agc2.h:72
float _attack_rate
Definition: agc2.h:106
float reference() const
Definition: agc2.h:139
void set_attack_rate(float rate)
Definition: agc2.h:71
float _reference
Definition: agc2.h:179
high performance Automatic Gain Control class
Definition: agc2.h:41
void set_attack_rate(float rate)
Definition: agc2.h:143
gr_complex scale(gr_complex input)
Definition: agc2.h:76
float attack_rate() const
Definition: agc2.h:137
void set_reference(float reference)
Definition: agc2.h:145
void set_gain(float gain)
Definition: agc2.h:73
float _gain
Definition: agc2.h:180
std::complex< float > gr_complex
Definition: gr_complex.h:27
float _decay_rate
Definition: agc2.h:107
float _decay_rate
Definition: agc2.h:178
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
void set_decay_rate(float rate)
Definition: agc2.h:144
float _max_gain
Definition: agc2.h:110
float max_gain() const
Definition: agc2.h:141
float reference() const
Definition: agc2.h:66
agc2_ff(float attack_rate=1e-1, float decay_rate=1e-2, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc2.h:126
float scale(float input)
Definition: agc2.h:149
float _max_gain
Definition: agc2.h:181
void scaleN(gr_complex output[], const gr_complex input[], unsigned n)
Definition: agc2.h:99
agc2_cc(float attack_rate=1e-1, float decay_rate=1e-2, float reference=1.0, float gain=1.0, float max_gain=0.0)
Definition: agc2.h:53
void set_max_gain(float max_gain)
Definition: agc2.h:74
float _attack_rate
Definition: agc2.h:177
void set_decay_rate(float rate)
Definition: agc2.h:70
float decay_rate() const
Definition: agc2.h:64
void scaleN(float output[], const float input[], unsigned n)
Definition: agc2.h:170
float _gain
Definition: agc2.h:109
void set_max_gain(float max_gain)
Definition: agc2.h:147
float gain() const
Definition: agc2.h:140
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
float _reference
Definition: agc2.h:108
float max_gain() const
Definition: agc2.h:68
void set_gain(float gain)
Definition: agc2.h:146
float attack_rate() const
Definition: agc2.h:65