summaryrefslogtreecommitdiffstats
path: root/visualizer
diff options
context:
space:
mode:
authorRavi Kumar Alamanda <ralama@codeaurora.org>2014-11-14 16:51:10 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-02-26 13:59:24 -0800
commit518bcbb6ab445e45806e74af43cde0518e98f5e2 (patch)
tree8fb619f70dbd7283d1c1f76f7df1dc5bca266a51 /visualizer
parentb58ff9b91d3b263c876f77e56065116ab7f2fab7 (diff)
downloadandroid_hardware_qcom_audio-518bcbb6ab445e45806e74af43cde0518e98f5e2.tar.gz
android_hardware_qcom_audio-518bcbb6ab445e45806e74af43cde0518e98f5e2.tar.bz2
android_hardware_qcom_audio-518bcbb6ab445e45806e74af43cde0518e98f5e2.zip
visualizer: do not apply calibration on audio routed to afe proxy
When compress offload playback is active, if the Visualizer effect is enabled, decoded PCM audio is routed to AFE Proxy port and read from it by the Visualizer wrapper library. When audio is routed to proxy port, current output device specific calibration is also being applied which is not desired. Avoid this by sending default audio calibration i.e. no post-processing to be applied the data. Change-Id: Id576c4ed7bbb482683074e3e33aa5760b7597d37
Diffstat (limited to 'visualizer')
-rw-r--r--visualizer/Android.mk1
-rw-r--r--visualizer/offload_visualizer.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index 393eec33..87d4987d 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -24,6 +24,7 @@ LOCAL_CFLAGS+= -O2 -fvisibility=hidden
LOCAL_SHARED_LIBRARIES := \
libcutils \
liblog \
+ libdl \
libtinyalsa
LOCAL_MODULE_RELATIVE_PATH := soundfx
diff --git a/visualizer/offload_visualizer.c b/visualizer/offload_visualizer.c
index 94c44a59..d363b778 100644
--- a/visualizer/offload_visualizer.c
+++ b/visualizer/offload_visualizer.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <time.h>
#include <sys/prctl.h>
+#include <dlfcn.h>
#include <cutils/list.h>
#include <cutils/log.h>
@@ -29,6 +30,15 @@
#include <tinyalsa/asoundlib.h>
#include <audio_effects/effect_visualizer.h>
+#define LIB_ACDB_LOADER "libacdbloader.so"
+#define ACDB_DEV_TYPE_OUT 1
+#define AFE_PROXY_ACDB_ID 45
+
+static void* acdb_handle;
+
+typedef void (*acdb_send_audio_cal_t)(int, int);
+
+acdb_send_audio_cal_t acdb_send_audio_cal;
enum {
EFFECT_STATE_UNINITIALIZED,
@@ -294,6 +304,9 @@ int configure_proxy_capture(struct mixer *mixer, int value) {
const char *proxy_ctl_name = "AFE_PCM_RX Audio Mixer MultiMedia4";
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);
if (ctl == NULL) {
ALOGW("%s: could not get %s ctl", __func__, proxy_ctl_name);
@@ -614,6 +627,19 @@ int visualizer_init(effect_context_t *context)
set_config(context, &context->config);
+ if (acdb_handle == NULL) {
+ acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW);
+ if (acdb_handle == NULL) {
+ ALOGE("%s: DLOPEN failed for %s", __func__, LIB_ACDB_LOADER);
+ } else {
+ acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(acdb_handle,
+ "acdb_loader_send_audio_cal");
+ if (!acdb_send_audio_cal)
+ ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s",
+ __func__, LIB_ACDB_LOADER);
+ }
+ }
+
return 0;
}