dsplib 1.1.0
C++ DSP library for MATLAB-like coding
Loading...
Searching...
No Matches
agc.h
1#pragma once
2
3#include <dsplib/array.h>
4#include <memory>
5
6namespace dsplib {
7
8struct AgcImpl;
9
10//Adaptively adjust gain for constant signal level output
11//TODO: make as template
12class Agc
13{
14public:
15 //target_level - target output power level
16 //max_gain - maximum power gain
17 //average_len - length of averaging window
18 //t_rise - step size for gain updates (rise)
19 //t_fall - step size for gain updates (fall)
20 explicit Agc(real_t target_level = 1, real_t max_gain = 60.0, int average_len = 100, real_t t_rise = 0.01,
21 real_t t_fall = 0.01);
22
23 template<typename T>
24 struct Result
25 {
26 base_array<T> out;
27 arr_real gain;
28 };
29
30 Result<real_t> process(span_real x);
31
32 Result<cmplx_t> process(span_cmplx x);
33
34 Result<real_t> operator()(span_real x) {
35 return this->process(x);
36 }
37
38 Result<cmplx_t> operator()(span_cmplx x) {
39 return this->process(x);
40 }
41
42private:
43 std::shared_ptr<AgcImpl> _d;
44};
45
46} // namespace dsplib
Definition agc.h:13
base dsplib array type
Definition array.h:25
Definition span.h:295
Definition agc.h:25