Avoid Exxposing a reference to the internal AGC, improve debug info

pull/1/head
Geoffrey Merck 6 years ago
parent 64f5fddf17
commit 658a47bc4e

@ -29,6 +29,7 @@
#define cagc_h #define cagc_h
#include "main.h" #include "main.h"
#include "math.h"
class CAGC class CAGC
{ {
@ -38,10 +39,9 @@ public:
//methods //methods
void Apply(uint8 * voice, int size); void Apply(uint8 * voice, int size);
float GetGain(){ return m_scale; }//gets current gain (linear) float GetGain(){ return -20.0f*log10(m_g); }//gets current gain
private: private:
// gain variables
float m_g; // current gain value float m_g; // current gain value
float m_scale; // output scale value float m_scale; // output scale value

@ -152,9 +152,7 @@ void CUsb3xxxInterface::Task(void)
{ {
Queue = Channel->GetVoiceQueue(); Queue = Channel->GetVoiceQueue();
CVoicePacket *clone = new CVoicePacket(VoicePacket); CVoicePacket *clone = new CVoicePacket(VoicePacket);
CAGC agc = Channel->GetAGC(); Channel->ApplyAGC(*clone);
agc.Apply(clone->GetVoice(), clone->GetVoiceSize());
std::cout << "Gain : " << agc.GetGain();
//clone->ApplyGain(Channel->GetSpeechGain()); //clone->ApplyGain(Channel->GetSpeechGain());
Queue->push(clone); Queue->push(clone);
Channel->ReleaseVoiceQueue(); Channel->ReleaseVoiceQueue();

@ -92,6 +92,12 @@ uint8 CVocodecChannel::GetCodecOut(void) const
return m_InterfaceOut->GetChannelCodec(m_iChannelOut); return m_InterfaceOut->GetChannelCodec(m_iChannelOut);
} }
void CVocodecChannel::ApplyAGC(CVoicePacket& voicePacket)
{
m_AGC.Apply(voicePacket.GetVoice(), voicePacket.GetVoiceSize());
std::cout << "Gain : " << m_AGC.GetGain() << "\n";
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// queues helpers // queues helpers

@ -28,6 +28,7 @@
#include "cpacketqueue.h" #include "cpacketqueue.h"
#include "cagc.h" #include "cagc.h"
#include "cvoicepacket.h"
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// class // class
@ -54,7 +55,9 @@ public:
int GetChannelIn(void) const { return m_iChannelIn; } int GetChannelIn(void) const { return m_iChannelIn; }
int GetChannelOut(void) const { return m_iChannelOut; } int GetChannelOut(void) const { return m_iChannelOut; }
int GetSpeechGain(void) const { return m_iSpeechGain; } int GetSpeechGain(void) const { return m_iSpeechGain; }
CAGC& GetAGC() { return m_AGC; };
//Processing
void ApplyAGC(CVoicePacket& voicePacket);
// interfaces // interfaces
bool IsInterfaceIn(const CVocodecInterface *interface) { return (interface == m_InterfaceIn); } bool IsInterfaceIn(const CVocodecInterface *interface) { return (interface == m_InterfaceIn); }

Loading…
Cancel
Save

Powered by TurnKey Linux.