芯方式

[COMMON]设置side tone后,通话接通的瞬间有POP音

0
阅读(212) 评论(0)

[DESCRIPTION]
– 如果将SIDE TONE 设为0,电话接通瞬间听不到Pop Noise – 如果将SIDE TONE设为非0,电话接通时会有Pop
Noise,同时pop 强度跟 sidetone 大小有关;
主要是開啟 microphone 時會有 pop noise – 如果 side tone 設為非 0 值,此 pop noise 會loopback 回
voice/audio downlink,就會透過 receiver 或 earphone 被聽到
[SOLUTION]
在afe2.c中进行修改:
1.struct{
..........
//添加如下
kal_uint32 tune_gain_gpt;
kal_bool tune_gain_gpt_on;
kal_bool tune_gain_ctrl_enable;
kal_bool tune_gain_flag;
//添加如上
} afe;
2.//添加函数
static void Tune_Gain_On( void *data )
{
afe.tune_gain_ctrl_enable= 1;
afe.tune_gain_gpt_on = KAL_FALSE;
L1Audio_SetEvent(afe.aud_id, NULL);
}
#define TUNE_GAIN_DELAY 23 //230 ms, unit: 10ms
3.static AFE_STATE_T _AfeStateOnHandler(kal_int16 old_a_status, kal_int16 old_v_status,
kal_int16 a_lowest, kal_int16 v_lowest) {
。。。。。。。。
if( v_lowest >= 0 ) {
/// If there exists an aud function (v_lowest) which wants to output through
/// Voice Amp-0 or Voice Amp-1
。。。。。。。。。
//添加如下
if( (v_lowest==L1SP_SPEECH) && (afe.tune_gain_flag==KAL_TRUE) )
{
SGPT_CTRL_START_T start;
*DP_SIDETONE_VOL = 0;
if(afe.tune_gain_gpt_on==KAL_TRUE)
{
DclSGPT_Control( afe.tune_gain_gpt, SGPT_CMD_STOP, 0);
afe.tune_gain_gpt_on = KAL_FALSE;
}
start.u2Tick = TUNE_GAIN_DELAY;
start.pfCallback = Tune_Gain_On;
start.vPara = 0;
DclSGPT_Control(afe.tune_gain_gpt, SGPT_CMD_START, (DCL_CTRL_DATA_T*)&start);
afe.tune_gain_gpt_on = KAL_TRUE;
afe.tune_gain_ctrl_enable = 0;
afe.tune_gain_flag = KAL_FALSE;
}
else
{
afe.tune_gain_ctrl_enable = 1;
}
//添加如上
UpdateVGain( v_lowest );
。。。。。。。。。。。。。。
else if( a_lowest >= 0 ) {
。。。。。。。。。。。。。
//添加如下
if( (a_lowest==L1SP_SPEECH) && (afe.tune_gain_flag==KAL_TRUE) )
{
SGPT_CTRL_START_T start;
*DP_SIDETONE_VOL = 0;
if(afe.tune_gain_gpt_on==KAL_TRUE)
{
DclSGPT_Control( afe.tune_gain_gpt, SGPT_CMD_STOP, 0);
afe.tune_gain_gpt_on = KAL_FALSE;
}
start.u2Tick = TUNE_GAIN_DELAY;
start.pfCallback = Tune_Gain_On;
start.vPara = 0;
DclSGPT_Control(afe.tune_gain_gpt, SGPT_CMD_START, (DCL_CTRL_DATA_T*)&start);
afe.tune_gain_gpt_on = KAL_TRUE;
afe.tune_gain_ctrl_enable = 0;
afe.tune_gain_flag = KAL_FALSE;
}
else
{
afe.tune_gain_ctrl_enable = 1;
}
//添加如上
#if defined(MT6253E) || defined(MT6253L) || defined(MT6252H) || defined(MT6252)
if(((SND_SRC_MAP>>a_lowest*2)&3)!=SRC_EXT_INPUT)
#endif
UpdateAGain( a_lowest );
。。。。。。。。。。。
}
else // a_lowest < 0 && v_lowest < 0 , Prepare to turn off ..
{
//添加如下
if(afe.tune_gain_gpt_on==KAL_TRUE)
{
DclSGPT_Control( afe.tune_gain_gpt, SGPT_CMD_STOP, 0);
afe.tune_gain_gpt_on = KAL_FALSE;
}
afe.tune_gain_ctrl_enable = 1;
//添加如上
if ((old_v_status >= 0) && (v_lowest < 0)) // Turn off voice DAC
{
eAfeState = AFE_STATE_OFF;
afe_prompt_trace( MOD_L1SP, "Turn off voice DAC");
}
。。。。。。。。。。。。。。
4.void AFE_TurnOnMicrophone( kal_uint8 aud_func ) {
。。。。。。。。。。
//添加如下
if(aud_func==L1SP_SPEECH)
afe.tune_gain_flag = KAL_TRUE;
//添加如上
。。。。。。。。。
}
5.static void UpdateVGain( kal_uint8 aud_func ) { ...............
if( aud_func == L1SP_SPEECH ) {
if(afe.tune_gain_ctrl_enable){//添加此行
UpdateSidetone( (kal_int8)(vol >> 4) );
}
}
else
*DP_SIDETONE_VOL = 0;
}
6.void UpdateAGainRampUp( kal_uint8 aud_func ) {
。。。。。。。。。。。
if( aud_func == L1SP_SPEECH ){
if(afe.tune_gain_ctrl_enable){//添加此行
UpdateSidetone( (kal_int8)(vol >> 4) );
}
}
else
*DP_SIDETONE_VOL = 0;
}
7.void afe_init()
{
。。。。。。。。。。。。。。
if (KAL_FALSE == afe_initialized) {
afe.aud_id = L1Audio_GetAudioID();
/// make sure AFE_Manager has the highest priority in the event group
// ASSERT(0 == afe.aud_id);
#if defined(__MT6253_AUD_DELAY_OFF_SUPPORT__) || defined(__MT6236_AUD_DELAY_OFF_SUPPORT__)
L1Audio_SetEventHandler( afe.aud_id, AFE_Event_Handler_MT6253 );
#else
L1Audio_SetEventHandler( afe.aud_id, AFE_Event_Handler );
#endif
afe_initialized = KAL_TRUE;
afe.tune_gain_gpt = DclSGPT_Open( DCL_GPT_CB, 0);//添加此行
}
。。。。。。。。。。。。。。
//添加如下
afe.tune_gain_gpt_on = KAL_FALSE;
afe.tune_gain_ctrl_enable = 1;
afe.tune_gain_flag = KAL_FALSE;
//添加如上
}
来自半导体社区