From 10c796f192ec9e4c9ec01594f2eda93c55c284d9 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Thu, 13 Feb 2020 20:34:51 +0100 Subject: [PATCH] Make AGC 25dB below saturation --- ambed/cagc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ambed/cagc.cpp b/ambed/cagc.cpp index d5cd58c..d5b2105 100644 --- a/ambed/cagc.cpp +++ b/ambed/cagc.cpp @@ -44,8 +44,10 @@ CAGC::CAGC(float initialLeveldB) m_EnergyPrime = 1.0f; // We do not target full scale to avoid stauration - m_targetEnergy = 32767.0f/2.0f;//TODO : Move to parameter ? + m_targetEnergy = 32767.0f * pow(10.0f, (initialLeveldB - 25.0)/20.0f);//25 dB below saturation as stated in docs + //we also substract our target gain + //this is the time constant of our AGC... m_Bandwidth = 1e-2f;//TODO : Move to parameter ? m_Alpha = m_Bandwidth; }