mt6735 在Android L 版本上如何实现类似答录机的功能
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
在android L 版本上如何实现类似答录机的功能
[SOLUTION]
修改方法:
在 AudioALSAPlaybackHandlerVoice.cpp文件中修改,
在open的时候,去对gain进行设定:
如果贵司有开通话时播一段音乐给对方听这个功能,则定义一个宏XXX_XX,
status_t AudioALSAPlaybackHandlerVoice:pen()
{
…
// HW attribute config // TODO(Harvey): query this
mStreamAttributeTarget.audio_format = AUDIO_FORMAT_PCM_16_BIT;
mStreamAttributeTarget.audio_channel_mask = mStreamAttributeSource->audio_channel_mask;
// same as source stream
mStreamAttributeTarget.num_channels =
android_audio_legacy::AudioSystem::popCount(mStreamAttributeTarget.audio_channel_mask);
mStreamAttributeTarget.sample_rate = mStreamAttributeSource->sample_rate; // same as
source stream
mStreamAttributeTarget.u8BGSDlGain = mStreamAttributeSource->u8BGSDlGain;
mStreamAttributeTarget.u8BGSUlGain = mStreamAttributeSource->u8BGSUlGain;
// bit conversion
initBitConverter();
// open background sound
mBGSPlayer->mBGSMutex.lock();
mBGSPlayer->CreateBGSPlayBuffer(
mStreamAttributeTarget.sample_rate,
mStreamAttributeTarget.num_channels,
mStreamAttributeTarget.audio_format);
#ifdef XXX_XX
mBGSPlayer->Open(SpeechDriverFactory::GetInstance()->GetSpeechDriver(),0xff, 0xff);
#else
mBGSPlayer->Open(SpeechDriverFactory::GetInstance()->GetSpeechDriver(),
mStreamAttributeTarget.u8BGSUlGain, mStreamAttributeTarget.u8BGSDlGain);
#endif
mBGSPlayer->mBGSMutex.unlock();
ALOGD("-%s()", __FUNCTION__);
return NO_ERROR;
}
在android L 版本上如何实现类似答录机的功能
[SOLUTION]
修改方法:
在 AudioALSAPlaybackHandlerVoice.cpp文件中修改,
在open的时候,去对gain进行设定:
如果贵司有开通话时播一段音乐给对方听这个功能,则定义一个宏XXX_XX,
status_t AudioALSAPlaybackHandlerVoice:pen()
{
…
// HW attribute config // TODO(Harvey): query this
mStreamAttributeTarget.audio_format = AUDIO_FORMAT_PCM_16_BIT;
mStreamAttributeTarget.audio_channel_mask = mStreamAttributeSource->audio_channel_mask;
// same as source stream
mStreamAttributeTarget.num_channels =
android_audio_legacy::AudioSystem::popCount(mStreamAttributeTarget.audio_channel_mask);
mStreamAttributeTarget.sample_rate = mStreamAttributeSource->sample_rate; // same as
source stream
mStreamAttributeTarget.u8BGSDlGain = mStreamAttributeSource->u8BGSDlGain;
mStreamAttributeTarget.u8BGSUlGain = mStreamAttributeSource->u8BGSUlGain;
// bit conversion
initBitConverter();
// open background sound
mBGSPlayer->mBGSMutex.lock();
mBGSPlayer->CreateBGSPlayBuffer(
mStreamAttributeTarget.sample_rate,
mStreamAttributeTarget.num_channels,
mStreamAttributeTarget.audio_format);
#ifdef XXX_XX
mBGSPlayer->Open(SpeechDriverFactory::GetInstance()->GetSpeechDriver(),0xff, 0xff);
#else
mBGSPlayer->Open(SpeechDriverFactory::GetInstance()->GetSpeechDriver(),
mStreamAttributeTarget.u8BGSUlGain, mStreamAttributeTarget.u8BGSDlGain);
#endif
mBGSPlayer->mBGSMutex.unlock();
ALOGD("-%s()", __FUNCTION__);
return NO_ERROR;
}