络达开发----如何开启AGC功能
芯片型号:AB1565
功能模块:音频动态增益
功能描述:AGC是一个动态增益自动调节的功能,它可以依据设定好的规则,对外部或者输入音源进行动态增益的调整,然后再把结果输出到speaker上。SDK v2.11.0默认是不开启AGC功能的。
SDK中已经包含了支持AGC的库文件及部分源代码,其位置在:
bta_sdk\dsp\middleware\MTK\dspalg\agc
及相关库文件:
bta_sdk\dsp\prebuilt\middleware\MTK\dspalg\agc
其中源代码部分,包含了一些初始化等相关的接口函数,库文件则是实现AGC算法的相关控制。
开户AGC,需要把agc源码目录下的module.mk添加到工程中。
通过代码分析可以知道,AGC的开关是通过宏定义:MTK_VOICE_AGC_ENABLE和MTK_BT_AGC_USE_PIC来实现的,通过其相关的readme.txt文件也可以得知该信息,其内容如下:
Compander module usage guide
Brief: This module is the AGC implementation.
Usage: GCC: For AGC, make sure to include the following:
1) Add the following module.mk for libs and source file:
include $(SOURCE_DIR)/middleware/MTK/dspalg/agc/module.mk
2) Module.mk provides different options to enable or disable according to the profiles.
Please configure the related options on the specified XT-XCC/feature.mk.
MTK_VOICE_AGC_ENABLE
3) Add the header file path:
CFLAGS += -I$(SOURCE_DIR)/middleware/MTK/dspalg/agc/inc
4) Add FUNC_RX_WB_AGC (for hfp downlink) / FUNC_TX_AGC (for uplink)
into the feature table in dsp_sdk.c to apply agc in the specified scenario, like stream_feature_list_hfp_downlink[], stream_feature_list_hfp_uplink[].
Dependency: None
Notice: 1) MTK_VOICE_AGC_ENABLE and MTK_BT_AGC_USE_PIC must be set as "y" on the specified XT-XCC/feature.mk.
Relative doc: None
Example project:None
因此,把AGC功能添加到工程中并开户,需要如下几个步骤:
-
在如下的路径中的文件feature_65_evb.mk里添加 宏定义:
MTK_VOICE_AGC_ENABLE = y
MTK_BT_AGC_USE_PIC = y
当然,如果你使用的是1568的芯片,则需要在feature_68_evb.mk中添加上面内容。
文件路径:
bta_sdk\dsp\project\ab1565_ab1568_evk\apps\dsp0_headset_ref_design\XT-XCC
-
在上步骤路径中的Makefile中添加如下内容
其目的是把agc目录中的module.mk添加到工程中。该mk文件会中会自动添加agc預编译好的库文件到工程中,即文件:pisplit_agc.o
ifeq ($(MTK_VOICE_AGC_ENABLE),y)
include $(ROOTDIR)/middleware/MTK/dspalg/agc/module.mk
Endif
-
完成上述步骤后,删除之前编译生成的文件,然后重新编译即可。