1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2024-11-16 05:01:49 -05:00
xlxd/ambed/cagc.h

56 lines
1.9 KiB
C
Raw Normal View History

2020-01-28 15:06:43 -05:00
//
// cagc.h
// ambed
//
// Created by Jean-Luc Deltombe (LX3JL) on 26/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
//
// ----------------------------------------------------------------------------
// This file is part of ambed.
//
// xlxd is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// xlxd is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
// Geoffrey Merck F4FXL / KC3FRA AGC code largely inspired by Liquid DSP
2020-01-28 15:06:43 -05:00
// Only took the parts we need qnd recoeded it to be close the XLX coding style
2020-01-29 14:02:03 -05:00
// https://github.com/jgaeddert/liquid-dsp/blob/master/src/agc/src/agc.c
2020-01-28 15:06:43 -05:00
#ifndef cagc_h
#define cagc_h
#include "main.h"
class CAGC
{
public:
//Constructor
CAGC(float initialLeveldB);
//methods
void Apply(uint8 * voice, int size);
float GetGain();//gets current gain
2020-01-28 15:06:43 -05:00
private:
float m_Gain; // current gain value
float m_GainMax, m_GainMin; //gain clamping
float m_targetEnergy; // scale value for target energy
2020-01-28 15:06:43 -05:00
// gain control loop filter parameters
float m_Bandwidth; // bandwidth-time constant
float m_Alpha; // feed-back gain
2020-01-28 15:06:43 -05:00
// signal level estimate
float m_EnergyPrime; // filtered output signal energy estimate
2020-01-28 15:06:43 -05:00
};
#endif /* cgc_h */