From 39cfce611328a94ec96474a7ac7dd102b6553230 Mon Sep 17 00:00:00 2001 From: vivek mehta Date: Fri, 18 Sep 2015 10:39:16 -0700 Subject: hal: effect: visualizer: support two offload sessions add support to get visualizer data for two offload session. Change-Id: I273aa392080e67a605137c43a3a5b798f66513fb --- visualizer/offload_visualizer.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'visualizer/offload_visualizer.c') diff --git a/visualizer/offload_visualizer.c b/visualizer/offload_visualizer.c index d363b778..b2f09528 100644 --- a/visualizer/offload_visualizer.c +++ b/visualizer/offload_visualizer.c @@ -300,20 +300,40 @@ bool effects_enabled() { return false; } -int configure_proxy_capture(struct mixer *mixer, int value) { - const char *proxy_ctl_name = "AFE_PCM_RX Audio Mixer MultiMedia4"; +int set_control(const char* name, struct mixer *mixer, int value) { struct mixer_ctl *ctl; - if (value && acdb_send_audio_cal) - acdb_send_audio_cal(AFE_PROXY_ACDB_ID, ACDB_DEV_TYPE_OUT); - - ctl = mixer_get_ctl_by_name(mixer, proxy_ctl_name); + ctl = mixer_get_ctl_by_name(mixer, name); if (ctl == NULL) { - ALOGW("%s: could not get %s ctl", __func__, proxy_ctl_name); + ALOGW("%s: could not get %s ctl", __func__, name); return -EINVAL; } - if (mixer_ctl_set_value(ctl, 0, value) != 0) - ALOGW("%s: error setting value %d on %s ", __func__, value, proxy_ctl_name); + if (mixer_ctl_set_value(ctl, 0, value) != 0) { + ALOGW("%s: error setting value %d on %s ", __func__, value, name); + return -EINVAL; + } + + return 0; +} + +int configure_proxy_capture(struct mixer *mixer, int value) { + int retval = 0; + + if (value && acdb_send_audio_cal) + acdb_send_audio_cal(AFE_PROXY_ACDB_ID, ACDB_DEV_TYPE_OUT); + + retval = set_control("AFE_PCM_RX Audio Mixer MultiMedia4", mixer, value); + + if (retval != 0) + return retval; + + // Extending visualizer to capture for compress2 path as well. + // for extending it to multiple offload either this needs to be extended + // or need to find better solution to enable only active offload sessions + + retval = set_control("AFE_PCM_RX Audio Mixer MultiMedia7", mixer, value); + if (retval != 0) + return retval; return 0; } -- cgit v1.2.3