Wave Arts VQE  1.00
Voice Quality Enhancement
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
WaVQE Class Reference

Wave Arts VQE object. More...

#include <WaVQE.h>

Inheritance diagram for WaVQE:
WaAudioDevPortObj WaAudioDevPort

List of all members.

Public Member Functions

 WaVQE (WaAudioDevPort *devPort, VQEParam *vqeParam)
 WaVQE constructor.
 ~WaVQE ()
 destructor
VQEParamGetParam ()
 Get parameters.
int Open (WadParam *param, WadCallbackFn *inFn, WadCallbackFn *outFn, void *arg)
 Open devices for streaming.
void Close ()
 Close devices and release memory.
int InCallback (float *buf, int numFrames, int numChan)
 input callback
int OutCallback (float *buf, int numFrames, int numChan)
 output callback
void SetAecEnable (bool isAecEnabled)
 Enable or disable AEC.
void AutoGainSetFn (bool isIncr, float incr)
 Auto-gain callback function.
void SetAutoGainEnable (bool enable)
 Enable or disable auto-gain.
void SetDeclipEnable (bool enable)
 Enable or disable declip.
void SetInjectNoise (bool enable)
 Enable or disable noise injection.

Static Public Member Functions

static void GetDefaultParam (VQEParam *vqeParam)
 Get default VQE parameters.

Protected Member Functions

void Reset ()
 Reset AEC and other signal processing.
bool OpenDumpFile (AFileOut **pAfo, char *name, int sampRate, int numChan)
 Open a single dump file.
void OpenDumpFiles (WadParam *param)
 Open all dump files.
void PreProcess (float *buf, int numFrames, int numChan)
 Apply pre-processing, input signal before AEC.
void PostProcess (float *buf, int numFrames, int numChan)
 Apply post-processing, input signal after AEC.
void InjectShortNoise (short *buf, int n)
 Inject 16-bit integer noise.
void InjectFloatNoise (float *buf, int n)
 Inject 32-bit float noise.
bool DeliverInputBuf (float *buf)
 Deliver input buffer to application.
bool FetchOutputBuf (float *buf)
 Fetch an output buffer from application.
void MakeDumpPath (char *path, unsigned maxLen, char *name)
 Make dump file pathname.
void DumpResponse ()
 Dump the impulse response of the AEC.
void SetAecProcessor (AecProcessor *aec)
 change AEC algorithm, NULL means no AEC
void FillAecLatData (AecLatData *data)
 fill AecLatData with current device names and sample rate

Protected Attributes

WaAudioDevPortObjresPort
 resampled device port
WadParam param
 open parameters
VQEParam vqeParam
 parameters
bool syncBuffers
 T/F if synchronizing input and output for AEC alg.
AecLatCalObjectaecLatCal
 calibrator, or NULL if none
AecProcessoraecObj
 EC algorithm pointer, so it can be deleted.
AecProcessoraecProcessor
 EC to use, either aecLatCal or aecObj, don't delete.
WadCallbackFnappInFn
 original application input callback
WadCallbackFnappOutFn
 original application output callback
void * appArg
 application callback arg
bool isAecEnabled
 is AEC currently enabled?
AecInFifoinFifo
 fifo for input sample buffers
bool isInputReady
 is input fifo primed?
int overCount
 count of consecutive buffer overruns
int underCount
 count of consecutive buffer underruns
AFileOutafoIn0
 in pre AEC, i.e., recording after sample rate compensation
AFileOutafoIn1
 in post AEC, i.e., echo-cancelled recording, sent to far side
AFileOutafoOut0
 out pre AEC, i.e. (far) reference signal
AFileOutafoOut1
 out post AEC, i.e. sent to speaker
int numIn
 count of input callbacks since last output
int numOut
 count of output callbacks since last input
int inHist [kMaxBurst]
 histogram of input burst lengths
int outHist [kMaxBurst]
 histogram of output buffer burst lengths
int totalNumIn
 count of total input buffers for debugging
int totalNumOut
 count of total output buffers for debugging
int totalNumAppIn
 count of total application input callbacks for debugging
int totalNumAppOut
 count of total application output callbacks for debugging
int numUnder
 number of underruns
int numOver
 number of overruns
short * shortOutBuf
 temp buffer
short * shortInBuf
 temp buffer
float * lastRefBuf
 last reference signal buffer
float * recBuf
 record buffer read from FIFO
AutoGainautoGain
 auto-gain object
bool isAutoGainEnabled
 is auto-gain currently enabled?
DeclipLpfdeclip
 declip object
bool isDeclipEnabled
 is declip currently enabled?
bool injectNoise
 T/F if injecting noise.
int mlsReg
 MLS register.
int mlsMask
 MLS generating mask.
int mlsMsbMask
 MSB mask.

Detailed Description

Wave Arts VQE object.

WaVQE is a device port (WaAudioDevPortObj) which handles AEC and other DSP processing. WaVQE may synchronize the audio stream sampling rates by using a WadResPort or WadResInPort, depending on the AecSyncParam passed in the VQEParam structure when WaVQE is created. WaVQE prepares associated input and output buffers for processing by an AEC algorithm. Input buffers are placed in the AecInFifo until a sufficient number have accumulated. During the output callback, the output buffer is paired with a buffer read from the fifo, and the AEC algorithm is called with the pair of buffers. WaVQE also supports pre and post processing of buffers. This is used to implement auto-gain and declip processing.

VQE should be opened with buffers that are a multiple of 10 msec, due to internal sample rate conversion that requires integer buffer lengths, and which may have to convert between 44.1 kHz and multiples of 8 kHz.


Constructor & Destructor Documentation

WaVQE::WaVQE ( WaAudioDevPort devPort,
VQEParam vqeParam 
)

WaVQE constructor.

Parameters:
[in]devPortdevice port
[in]vqeParamVQE parameters

Member Function Documentation

void WaVQE::AutoGainSetFn ( bool  isIncr,
float  incr 
)

Auto-gain callback function.

Parameters:
[in]isIncrtrue if incrementing gain, else false if decrementing gain
[in]incrvolume increment (always > 0)
void WaVQE::Close ( ) [virtual]

Close devices and release memory.

Close the devices and release all memory associated with streaming. Different devices can be re-opened with different parameters without having to recreate the WaAudioDev object.

Implements WaAudioDevPort.

void WaVQE::GetDefaultParam ( VQEParam vqeParam) [static]

Get default VQE parameters.

Parameters:
[out]vqeParampointer to parameter structure to be filled
int WaVQE::Open ( WadParam param,
WadCallbackFn inFn,
WadCallbackFn outFn,
void *  arg 
) [virtual]

Open devices for streaming.

Open devices for streaming with provided parameters. Asynchronous callbacks fetch and deliver sample buffers: inFn delivers input sample buffers and outFn fetches output sample buffers. Streaming directions are determined by valid device IDs in parameter structure, at least one direction must be enabled. Pass NULL for callback if that direction is not enabled.

Parameters:
[in]paramStream parameters
[in]inFnInput callback function, or NULL
[in]outFnOutput callback function, or NULL
[in]argArgument to callbacks

Implements WaAudioDevPort.

void WaVQE::SetAecEnable ( bool  isAecEnabled)

Enable or disable AEC.

Parameters:
[in]isAecEnabledtrue if enable, else false
void WaVQE::SetAutoGainEnable ( bool  enable)

Enable or disable auto-gain.

Parameters:
[in]enabletrue to enable, false to disable
void WaVQE::SetDeclipEnable ( bool  enable)

Enable or disable declip.

Parameters:
[in]enabletrue to enable, false to disable
void WaVQE::SetInjectNoise ( bool  enable)

Enable or disable noise injection.

Parameters:
[in]enabletrue to enable, false to disable

Noise injection injects low level MLS (maximum length sequence) noise into the output (error signal) of the echo canceller, after noise gating. This is useful to ensure there is always a low level signal coming out of the AEC. Many codecs do not have logic to handle denormalized arithmetic, so gating the signal to 0 in VQE may cause downstream codecs to burn huge amounts of CPU if demormalized numbers are created. The level of the noise is one LSB at 16-bits.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines