8 #ifndef INCLUDE_GPL_DSP_AGC_H_ 9 #define INCLUDE_GPL_DSP_AGC_H_ 18 AGC(
int historySize,
double R);
21 void resize(
int historySize,
double R);
25 virtual void feed(
Complex& ci) = 0;
39 MagAGC(
int historySize,
double R,
double threshold);
42 void resize(
int historySize,
int stepLength,
Real R);
45 double feedAndGetValue(
const Complex& ci);
48 void setThresholdEnable(
bool enable);
49 void setGate(
int gate) { m_gate = gate; m_gateCounter = 0; m_count = 0; }
50 void setStepDownDelay(
int stepDownDelay) { m_stepDownDelay = stepDownDelay; m_gateCounter = 0; m_count = 0; }
54 float getStepValue()
const;
74 double hardLimiter(
double multiplier,
double magsq);
77 template<u
int32_t AvgSize>
84 m_moving_average(AvgSize, initial)
92 m_moving_average.resize(AvgSize, initial);
99 m_moving_average.resize(newSize, initial);
104 m_moving_average.fill(value);
109 if ((
Real) m_moving_average.average() > m_clip) {
110 return (
Real) m_moving_average.average();
118 if (value > m_cutoff) {
119 m_moving_average.feed(value);
int m_gate
power threshold gate in number of samples
int m_stepDownCounter
step down transition samples counter
void setSquared(bool squared)
void setHardLimiting(bool hardLimiting)
double m_threshold
squelch on magsq average
int m_historySize
Averaging length (attack)
virtual void feed(Complex &ci)=0
void resize(Real initial, Real cutoff=0, Real clip=0)
int m_count
Samples counter.
double m_R2
square of ordered magnitude
double m_clampMax
maximum to clamp to as power value
SimpleAGC(Real initial, Real cutoff=0, Real clip=0)
void resize(int historySize, double R)
bool m_clamping
clamping active
MovingAverage< double > m_moving_average
void setClampMax(double clampMax)
MovingAverage< double > m_moving_average
Averaging engine. The stack length conditions the smoothness of AGC.
double m_R
ordered magnitude
int m_gateCounter
threshold gate samples counter
int m_stepLength
transition step length in number of samples
bool m_squared
use squared magnitude (power) to compute AGC value
double m_magsq
current squared magnitude (power)
int getStepDownDelay() const
double m_stepDelta
transition step unit by sample
void resizeNew(uint32_t newSize, Real initial, Real cutoff=0, Real clip=0)
void setClamping(bool clamping)
void setThreshold(double threshold)
int m_stepDownDelay
delay in samples before cutoff (release)
void setStepDownDelay(int stepDownDelay)
int m_stepUpCounter
step up transition samples counter
std::complex< Real > Complex
bool m_thresholdEnable
enable squelch on power threshold
bool m_hardLimiting
hard limit multiplier so that resulting sample magnitude does not exceed 1.0