[Feature][ZXW-65]merged P49 base code
Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/lib/libvoice/voice_api.c b/ap/lib/libvoice/voice_api.c
index ba07e83..3494e74 100755
--- a/ap/lib/libvoice/voice_api.c
+++ b/ap/lib/libvoice/voice_api.c
@@ -42,6 +42,9 @@
extern int mix_set_vp_path(struct mixer *mixer, char path);
extern int mix_get_vp_path(struct mixer *mixer, int *path);
extern int mix_get_voice_path(struct mixer *mixer, int *path);
+extern int mix_set_vploop(struct mixer *mixer, int path);
+extern int mix_get_vploop(struct mixer *mixer, int *state);
+
@@ -422,3 +425,112 @@
return 0;
}
+int ap_audio_set_loopback_enable(int dev_mode,int enable)
+{
+
+ struct mixer *voice_mixer = NULL;
+ int ret = 0;
+ struct pcm_config config_voice = {0};
+
+
+ printf("%s: start dev_mode=%d,enable=%d!\n",__func__, dev_mode,enable);
+
+ if ((dev_mode < T_OUTPUT_HANDSET ) ||(dev_mode >= T_OUTPUT_MAX)){
+ printf("%s: dev_mode not support, dev_mode=%d!\n",__func__, dev_mode);
+ return -1;
+ }
+ if ((enable != 0 )&&(enable != 1)){
+ printf("%s: enable val not support, enable=%d!\n",__func__, enable);
+ return -1;
+ }
+ if(enable == 1){
+
+ //open mixer dev for control
+ voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);
+ if (!voice_mixer) {
+ printf("voice_mixer open failed!\n");
+ return -1;
+ }
+
+ //config mixer dev
+ ret = mix_set_voice_path(voice_mixer, dev_mode);
+ printf("mix_set_voice_path ret=%d!\n",ret);
+
+ ret = mix_set_vploop(voice_mixer, dev_mode);
+ printf("mix_set_vploop ret=%d!\n",ret);
+
+ //close mixer
+ mixer_close(voice_mixer);
+ voice_mixer = NULL;
+
+
+
+
+
+
+ }
+ else{
+
+ //open mixer dev for control
+ voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);
+ if (!voice_mixer) {
+ printf("voice_mixer open failed!\n");
+ return -1;
+ }
+
+
+ ret = mix_set_vploop(voice_mixer, VP_PATH_OFF);
+ //close mixer
+ mixer_close(voice_mixer);
+ voice_mixer = NULL;
+
+
+ printf("mix_set_vploop off end ret=%d!\n",ret);
+
+
+
+
+
+ }
+
+ //return 0;
+
+ printf("%s: end enable=%d!\n",__func__, enable);
+
+ return ret;
+
+
+}
+
+
+
+int ap_audio_get_loopback_enable(int *p_enable)
+{
+ struct mixer *voice_mixer = NULL;
+ int ret = 0;
+ printf("%s: start!\n",__func__);
+
+ //open mixer dev for control
+ voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);
+ if (!voice_mixer) {
+ printf("voice_mixer open failed!\n");
+ return -1;
+ }
+
+ //config mixer dev
+ ret = mix_get_vploop(voice_mixer, p_enable);
+ if((*p_enable != 0 ) &&(*p_enable != 1)){
+ printf("%s: p_enable not support, *p_enable=%d!\n",__func__, *p_enable);
+ ret = -1;
+ }
+ printf("%s: end *p_enable=%d!\n",__func__, *p_enable);
+
+ //close mixer
+ mixer_close(voice_mixer);
+ voice_mixer = NULL;
+
+ return ret;
+
+}
+
+