当前位置: 编程技术>移动开发
MT6589平台通话录音时播放提示音给对方功能的具体实现
来源: 互联网 发布时间:2014-10-19
本文导语: 1.修改AudioMTKStreamOut.cpp ssize_t AudioMTKStreamOut::write(const void *buffer, size_t bytes) { case android_audio_legacy::AudioSystem::MODE_IN_CALL: case android_audio_legacy::AudioSystem::MODE_IN_CALL_2: 修改pBGSPlayer->Open(pSpeechDriver, 0x0, 0xFF); 為pBGSPlayer->Open(pSpeechDriver, 0xF...
1.修改AudioMTKStreamOut.cpp ssize_t AudioMTKStreamOut::write(const void *buffer, size_t bytes)
{
case android_audio_legacy::AudioSystem::MODE_IN_CALL:
case android_audio_legacy::AudioSystem::MODE_IN_CALL_2:
修改pBGSPlayer->Open(pSpeechDriver, 0x0, 0xFF); 為pBGSPlayer->Open(pSpeechDriver, 0xFF, 0xFF);
2.修改InCallScreen.java
a.添加: import android.media.ToneGenerator;
b. 添加成员:private ToneGenerator mToneGenerator;
c. 修改函数 private void onRecordClick(MenuItem menuItem)
在 startRecord(); 之前添加:
mToneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, 240);
setVolumeControlStream(AudioManager.STREAM_MUSIC); mToneGenerator.startTone(24, 1000);
d.修改函数 private void stopRecord() 添加:
if (mToneGenerator != null) { mToneGenerator.release(); mToneGenerator = null; }
{
case android_audio_legacy::AudioSystem::MODE_IN_CALL:
case android_audio_legacy::AudioSystem::MODE_IN_CALL_2:
修改pBGSPlayer->Open(pSpeechDriver, 0x0, 0xFF); 為pBGSPlayer->Open(pSpeechDriver, 0xFF, 0xFF);
2.修改InCallScreen.java
a.添加: import android.media.ToneGenerator;
b. 添加成员:private ToneGenerator mToneGenerator;
c. 修改函数 private void onRecordClick(MenuItem menuItem)
在 startRecord(); 之前添加:
mToneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, 240);
setVolumeControlStream(AudioManager.STREAM_MUSIC); mToneGenerator.startTone(24, 1000);
d.修改函数 private void stopRecord() 添加:
if (mToneGenerator != null) { mToneGenerator.release(); mToneGenerator = null; }