电子产品世界 » 论坛首页 » 嵌入式开发 » ARM » 三合一喇叭实现边播音乐边实现震动功能


共2条 1/1 1 跳转至

三合一喇叭实现边播音乐边实现震动功能

菜鸟
2018-08-02 19:09:16    评分

三合一喇叭实现边播音乐边实现震动功能,即随着音乐节奏的变动而产生对应的震动


[SOLUTION]

MT6260的修改方法:


1,在apm_comp.c中函数BLOUD_Set_FixFreq中将下面的code移掉

#if defined(__VIBRATION_SPEAKER_SUPPORT__)

{

// Vibration Filter

for (i = 0; i < 2; i++)

{

memcpy(&p_fix->q2p14[idx_Q2p14++], VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[i][sr_idx],

sizeof(BLOUD_Coef_Q2p14));

}

}

#endif


2,在pcmRouteService.c中函数

static void PcmRut_PutData( kal_uint16 *pSampleBuf )移掉下面的code


#if defined(__VIBRATION_SPEAKER_SUPPORT__)

if(AFE_IsAudioLoudSpk())

{

kal_uint32 smpl_rate_val = Media_GetSampleRate();

kal_uint32 smpl_rate_idx = Media_GetSamplingRateIndex(smpl_rate_val);

kal_int32 is_stereo = 1;

kal_int32 buffer_size_in_bytes = pcmRut.dataLen_put << 1;

Vibration_Notch_Filter_16Bit(pSampleBuf, pSampleBuf, is_stereo, buffer_size_in_bytes, (kal_int32

*)&Vibr_Filter_Stack[0][0], (kal_uint32

*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[0][smpl_rate_idx][0]);

Vibration_Notch_Filter_16Bit(pSampleBuf, pSampleBuf, is_stereo, buffer_size_in_bytes, (kal_int32

*)&Vibr_Filter_Stack[1][0], (kal_uint32*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[1][smpl_rate_idx][0]);

}

#endif


3,在PcmSink.c中函数


static kal_uint32 pcmsink_Hisr_SoundData()移掉下面的code


#if defined(__VIBRATION_SPEAKER_SUPPORT__)

if(AFE_IsAudioLoudSpk())

{

kal_uint32 smpl_rate_idx = Media_GetSamplingRateIndex(PcmSink.uSampleRate);

Vibration_Notch_Filter(PcmSinkStatic.pSoundBuffer,icfans PcmSinkStatic.pSoundBuffer, 1, uSpace << 2,

(kal_int32 *)&Vibr_Filter_Stack[0][0], (kal_uint32

*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[0][smpl_rate_idx][0]);

Vibration_Notch_Filter(PcmSinkStatic.pSoundBuffer, PcmSinkStatic.pSoundBuffer, 1, uSpace << 2,

(kal_int32 *)&Vibr_Filter_Stack[1][0], (kal_uint32

*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[1][smpl_rate_idx][0]);

}

#endif


4,在PcmSink.c中函数


static kal_uint32 pcmsink_WriteDataToDsp(kal_uint16 *pSrc16, kal_uint32 uSrcWord, kal_boolfMono2Stereo)移掉下面的code


#if defined(__VIBRATION_SPEAKER_SUPPORT__)

if (AFE_IsAudioLoudSpk())

{

kal_uint32 smpl_rate_val = Media_GetSampleRate();

kal_uint32 smpl_rate_idx = Media_GetSamplingRateIndex(smpl_rate_val);

kal_int32 is_stereo = (kal_int32)(fMono2Stereo ? KAL_FALSE : KAL_TRUE);

kal_int32 buffer_size_in_bytes = fMono2Stereo ? uDspWord : uDspWord << 1;

Vibration_Notch_Filter_16Bit(pSrc16, pSrc16, is_stereo, buffer_size_in_bytes, (kal_int32

*)&Vibr_Filter_Stack[0][0], (kal_uint32

*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[0][smpl_rate_idx][0]);

Vibration_Notch_Filter_16Bit(pSrc16, pSrc16, is_stereo, buffer_size_in_bytes, (kal_int32

*)&Vibr_Filter_Stack[1][0], (kal_uint32

*)&VIBR_NVRAM_DATA.VIBR_NVRAM_LOUD_FILTER_COEF[1][smpl_rate_idx][0]);

}

#endif


如果代码中没有看到第2,4步中对应的code,则只需修改第1,3步即可。MT6250的修改方法:


1,在media.c文件中函数Media_SetOutputDevice中将VIBR_Filter_Activate()注释掉;


2,在am.c中函数AM_AudioPlaybackOn中将VIBR_Filter_Activate()注释掉。





关键词: 三合一     喇叭     实现    

管理员
2018-08-03 08:10:40    评分
2楼

谢谢楼主分享


共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]