icfans

插耳机响铃时外放存在杂音

0
阅读(409) 评论(0)

MT6276平台,正常播放音乐及铃声时候无异常,在插入耳机时候,去预览铃声或者来电时候,会出现外放有杂音的
现象。
[SOLUTION]
该问题是由于在插入耳机后使用的是耳机模式的音频参数,如果应用到外放上就会有上述的问题,所以需要修改插
入耳机来电铃声这种特殊的情况,插入耳机外放也用同时响。
修改方法如下:
static void mmi_prof_preview_play_tone(void)
{
。。。
if (is_DRM_support == MMI_TRUE)
{
mdi_audio_loudness_turn_on(); //add this line
result = mdi_audio_play_file_with_vol_path(
(void *)path_file_name,
DEVICE_AUDIO_PLAY_INFINITE,
NULL,
mmi_prof_preview_tone_callback,
NULL,
MDI_AUD_VOL_MUTE((U8)g_prof_mem_p->volume),
MDI_DEVICE_SPEAKER2);
}
。。。
}
static void mmi_prof_preview_tone_callback(mdi_result result, void *user_data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_MEDIA_TRC_G2_APP, MMI_PROF_TRC_PLAY_CALLBACK, result);
mdi_audio_loudness_turn_off();//add this line
if (g_prof_mem_p == NULL)
{
return;
}
if (result == MDI_AUDIO_TERMINATED)
{
g_prof_mem_p->is_playing = MMI_FALSE;
}
}
void aud_audio_set_melody_path_volume(kal_uint8 audio_mode)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
kal_uint8 audio_path = 0;
kal_uint8 gain_audio_mode;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
AUD_FUNC_ENTRY(AUD_AUDIO_SET_MELODY_PATH_VOLUME);
switch (audio_mode)
{
。。。
case AUD_MODE_HEADSET:
#if defined(AUDIO_COMPENSATION_ENABLE) ||
defined(__AUDIO_COMPENSATION_SW_VERSION__)
/* Update compensation filter */
if (aud_context_p->loudness_on) //add this line
{ //add this line
Media_SelectAudioCompensation(MEDIA_AUD_COMP_LOUDSPEAKER_RINGTONE);
//add this line
} //add this line
else //add this line
{
Media_SelectAudioCompensation(MEDIA_AUD_COMP_EARPHONE);
}
#endif /* AUDIO_COMPENSATION_ENABLE || __AUDIO_COMPENSATION_SW_VERSION__ */
/* Set media path */
if (!aud_is_set_melody_path_volume_by_bt(AUD_MEDIA_PATH_BT_BOTH))
{
aud_melody_set_output_device(custom_cfg_hw_aud_output_path(aud_context_p
->melody_output_device));
}
#ifndef __GAIN_TABLE_SUPPORT__
/* if it's headset mode and output to both earphone & loud speaker, use
normal mode gain value */
if (aud_context_p->melody_output_device == AUDIO_DEVICE_SPEAKER_BOTH)
{
gain_audio_mode = VOL_NORMAL;
}
else
{
gain_audio_mode = VOL_HEADSET;
}
if(!aud_context_p->audio_mute)
{
aud_melody_set_volume_by_mode(gain_audio_mode,
current_playing_melody_volume_level);
}
#endif /* __GAIN_TABLE_SUPPORT__ */
break;
default:
ASSERT(0);
break;
}
} 来自半导体社区