原因是由于在HAL层默认没有处理上层发的stereo 转mono的命令,所以会没有效果,
可按如下修改,添加相关处理:
1修改AudioMTKHardware.cpp
添加:static String8 keySetStereo2MonoMode = String8("EnableStereoOutput");
2.修改status_t AudioMTKHardware::setParameters(const String8 &keyValuePairs)
在EXIT_SETPARAMETERS:
之前添加:
代码如下:
if (param.getInt(keySetStereo2MonoMode, value) == NO_ERROR) {
ALOGD("setParameters(): %s value=%d", keyValuePairs.string(),value);
((AudioMTKStreamManager*)mAudioMTKStreamManager)-ForceSterer2Mono(value);
}
3.修改AudioMTKStreamManager.h
添加public方法定义:
代码如下:
status_t ForceSterer2Mono(bool flag);
status_t AudioMTKStreamManager::ForceSterer2Mono(bool flag)
{
// force all stream to standby
ALOGD("ForceSterer2Mono = %d",flag);
if (mStreamOutVector.size()) {
for (size_t i = 0; i mStreamOutVector.size() ; i++) {
AudioMTKStreamOut *pTempOut = (AudioMTKStreamOut *)mStreamOutVector.valueAt(i);
pTempOut-SetStereoToMonoFlagForce(flag);
}
}
return NO_ERROR;
}
4.修改AudioMTKStreamOut.h
t添加定义:
代码如下:
status_t SetStereoToMonoFlagForce(bool flag);
status_t AudioMTKStreamOut::SetStereoToMonoFlagForce(bool flag)
{
ALOGD("SetStereoToMonoFlagForce = %d",flag);
mSteroToMono = flag;
return NO_ERROR;
}
猜你喜欢