MT6589平台通话录音时播放提示音给对方功能的具体实现
内容摘要
1.修改AudioMTKStreamOut.cpp ssize_t AudioMTKStreamOut::write(const void *buffer, size_t bytes) { case android_audio_legacy::AudioSystem::MODE_IN_CALL: case andr
文章正文
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; }
代码注释