mirror of
https://github.com/ShaYmez/xlxd.git
synced 2024-12-23 18:15:46 -05:00
Avoid Exxposing a reference to the internal AGC, improve debug info
This commit is contained in:
parent
64f5fddf17
commit
658a47bc4e
@ -29,6 +29,7 @@
|
||||
#define cagc_h
|
||||
|
||||
#include "main.h"
|
||||
#include "math.h"
|
||||
|
||||
class CAGC
|
||||
{
|
||||
@ -38,10 +39,9 @@ public:
|
||||
|
||||
//methods
|
||||
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:
|
||||
// gain variables
|
||||
float m_g; // current gain value
|
||||
float m_scale; // output scale value
|
||||
|
||||
|
@ -152,9 +152,7 @@ void CUsb3xxxInterface::Task(void)
|
||||
{
|
||||
Queue = Channel->GetVoiceQueue();
|
||||
CVoicePacket *clone = new CVoicePacket(VoicePacket);
|
||||
CAGC agc = Channel->GetAGC();
|
||||
agc.Apply(clone->GetVoice(), clone->GetVoiceSize());
|
||||
std::cout << "Gain : " << agc.GetGain();
|
||||
Channel->ApplyAGC(*clone);
|
||||
//clone->ApplyGain(Channel->GetSpeechGain());
|
||||
Queue->push(clone);
|
||||
Channel->ReleaseVoiceQueue();
|
||||
|
@ -92,6 +92,12 @@ uint8 CVocodecChannel::GetCodecOut(void) const
|
||||
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
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "cpacketqueue.h"
|
||||
#include "cagc.h"
|
||||
#include "cvoicepacket.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// class
|
||||
@ -54,7 +55,9 @@ public:
|
||||
int GetChannelIn(void) const { return m_iChannelIn; }
|
||||
int GetChannelOut(void) const { return m_iChannelOut; }
|
||||
int GetSpeechGain(void) const { return m_iSpeechGain; }
|
||||
CAGC& GetAGC() { return m_AGC; };
|
||||
|
||||
//Processing
|
||||
void ApplyAGC(CVoicePacket& voicePacket);
|
||||
|
||||
// interfaces
|
||||
bool IsInterfaceIn(const CVocodecInterface *interface) { return (interface == m_InterfaceIn); }
|
||||
|
Loading…
Reference in New Issue
Block a user