使用外部DAC,播放音乐时,插 拔耳机,耳机和外放上声音输出异常
[DESCRIPTION]
使用外部DAC,把情景模式中的提示音关掉,播放音乐时,从normal模式(有声音)切换到耳机模式,耳机里面无声
;同样,如果原来是耳机模式(有声音),拔出耳机,切换到normal模式,外放无声
[SOLUTION]
请在afe2.c中请做以下修改:
第一步:在afe结构体定义中以下位置添加:
#if defined(EXT_DAC_SUPPORT)
/// for controlling external DAC
kal_bool ext_dac_i2s_on;
kal_bool ext_dac_add_st;
kal_bool ext_dac_mute;
kal_int8 ext_dac_aud_func;
kal_uint8 ext_dac_aud_vol;
kal_uint16 ext_dac_freq;
kal_uint16 ext_dac_level_gain;
kal_uint8 ext_dac_old_out_dev; //添加这句
#endif
第二步:在AFE_Init如下位置添加:
#if defined(EXT_DAC_SUPPORT)
afe.ext_dac_i2s_on = KAL_FALSE;
afe.ext_dac_add_st = KAL_FALSE;
afe.ext_dac_aud_func = -1;
afe.ext_dac_level_gain = 0x8000;
afe.ext_dac_old_out_dev = -1;//添加这句
EXT_DAC_Init();
#endif
第三步:在AFE_Event_Handler函数的如下位置修改:
#if defined(EXT_DAC_SUPPORT)
if(a_lowest != -1 && !afe.ext_dac_mute && (afe.aud[a_lowest].out_dev & (L1SP_EXT_DAC_BUF0 |
L1SP_EXT_DAC_BUF1)))
{
if(afe.ext_dac_aud_func != a_lowest || (afe.ext_dac_aud_func == a_lowest &&
afe.ext_dac_old_out_dev != afe.aud[a_lowest].out_dev) )//修改这句
{
kal_uint8 out_spk;
afe.ext_dac_old_out_dev = afe.aud[a_lowest].out_dev;//添加这句
afe.ext_dac_aud_func = a_lowest;
out_spk = afe.aud[a_lowest].out_dev & (L1SP_EXT_DAC_BUF0|L1SP_EXT_DAC_BUF1);
......来自半导体社群