|
发表于 2020-11-3 19:52:32
6365 浏览 0 回复
MTK Android L 如何单独使用主、副mic
[DESCRIPTION]
Android L上如何单独使用主、副mic
[SOLUTION]
在AudioALSAHardware.cpp中定义
static String8 keySET_MIC_CHOOSE= String8("SET_MIC_CHOOSE");
添加
- #include "AudioALSAHardwareResourceManager.h"
- status_t AudioALSAHardware::setParameters(const String8 &keyValuePairs)
-
- //add this start
- if (param.getInt(keySET_MIC_CHOOSE, value) == NO_ERROR) {
- param.remove(keySET_MIC_CHOOSE);
- ALOGD("+%s(): %s", __FUNCTION__, "setBuiltInMicSpecificType");
- if(value==2){
- AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_MIC2_ONLY);
- }elseif(value==1){
- AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_MIC1_ONLY);
- }else{
- AudioALSAHardwareResourceManager::getInstance()->setBuiltInMicSpecificType(BUILTIN_MIC_DEFAULT);
- }
- }
- //add this end
复制代码
然后上层调用
- AudioSystem.setParameters("SET_MIC_CHOOSE=1");//仅使用主mic
- AudioSystem.setParameters("SET_MIC_CHOOSE=2");//仅使用副mic
- AudioSystem.setParameters("SET_MIC_CHOOSE=0");//还原默认设置,使用双mic
复制代码
|
|
手机微信同号:13682654092
|
|
|
|
|
登录或注册
|