1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Fixed some AGC issues

This commit is contained in:
f4exb 2023-12-11 01:12:03 +01:00
parent 4e25f4d678
commit f98800702c
2 changed files with 3 additions and 7 deletions

View File

@ -63,7 +63,6 @@ MagAGC::MagAGC(int historySize, double R, double threshold) :
m_stepDownCounter(0),
m_gateCounter(0),
m_stepDownDelay(historySize),
m_R2(R*R),
m_hardLimiting(false)
{}
@ -72,20 +71,18 @@ MagAGC::~MagAGC()
void MagAGC::resize(int historySize, int stepLength, Real R)
{
m_R2 = R*R;
m_stepLength = stepLength;
m_stepDelta = 1.0 / m_stepLength;
m_stepUpCounter = 0;
m_stepDownCounter = 0;
AGC::resize(historySize, R);
m_moving_average.fill(0);
m_moving_average.fill(m_squared ? R : R*R);
}
void MagAGC::setOrder(double R)
{
m_R2 = R*R;
AGC::setOrder(R);
m_moving_average.fill(0);
m_moving_average.fill(m_squared ? R : R*R);
}
void MagAGC::setThresholdEnable(bool enable)

View File

@ -39,7 +39,7 @@ protected:
double m_u0; //!< AGC factor
double m_R; //!< ordered magnitude
MovingAverage<double> m_moving_average; //!< Averaging engine. The stack length conditions the smoothness of AGC.
int m_historySize; //!< Averaging length (attack)
int m_historySize; //!< Averaging length (the longer the slower the AGC)
int m_count; //!< Samples counter
};
@ -76,7 +76,6 @@ private:
int m_stepDownCounter; //!< step down transition samples counter
int m_gateCounter; //!< threshold gate samples counter
int m_stepDownDelay; //!< delay in samples before cutoff (release)
double m_R2; //!< square of ordered magnitude
bool m_hardLimiting; //!< hard limit multiplier so that resulting sample magnitude does not exceed 1.0
double hardLimiter(double multiplier, double magsq);