降低前端mic灵敏度,改善回声
authorpenglei <1624952103@qq.com>
Wed, 21 Aug 2024 02:04:56 +0000 (10:04 +0800)
committerpenglei <1624952103@qq.com>
Wed, 21 Aug 2024 02:04:56 +0000 (10:04 +0800)
code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c

index d560c86..9504e1e 100755 (executable)
@@ -185,7 +185,13 @@ static int32_t AIDevOpen(td_handle *aiHandle, enum AudioCategory audioCategory)
             MediaHalMutexUnLock(g_subPortTrackInLock);
             return ret;
         }
+        uapi_ai_gain gain = {};
+        MEDIA_HAL_DOFUNC_TIME(ret = uapi_ai_get_volume(*aiHandle, &gain));
+        CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "uapi_ai_get_volume failed");
 
+        gain.integer = gain.integer - 6; // 前端mic灵敏度不同可通过此处调增,增加4db增益  默认gain.integer = gain.integer+4
+        MEDIA_HAL_DOFUNC_TIME(ret = uapi_ai_set_volume(*aiHandle, &gain));
+        CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "uapi_ai_set_volume failed");
         g_subPortTrackInOpened = true;
     }
     MediaHalMutexUnLock(g_subPortTrackInLock);
@@ -672,7 +678,15 @@ static int32_t SetSeaParam(AudioHandle trackHandle, char *value, uint32_t valueL
     if (ret != MEDIA_HAL_OK) {
         return ret;
     }
+    uint32_t *printparam = (uint32_t *)param;
     ret = uapi_sea_set_param(portTrackInCtx->seaHandle, UAPI_SEA_AFE_SEE, (const td_void *)param, paramLen);
+    MEDIA_HAL_LOGE(MODULE_NAME, "set_param");
+    for(int i = 0;i < 6;i++){
+        MEDIA_HAL_LOGE(MODULE_NAME, "%u,%u,%u,%u,%u,%u,%u,%u", *(printparam), *(printparam), *(printparam + 1), *(printparam + 2), \
+        *(printparam + 3), *(printparam + 4), *(printparam + 5), *(printparam + 6), *(printparam + 7));
+        printparam += 8;
+    }
+
     if (ret != MEDIA_HAL_OK) {
         MEDIA_HAL_LOGE(MODULE_NAME, "set aef param failed! ret = %d", ret);
         return ret;