From e2142bbdc5b75e8d42c92781644f16a7afe958b6 Mon Sep 17 00:00:00 2001 From: Tony Layher Date: Tue, 23 Dec 2014 10:58:58 -0500 Subject: 8084: Add define for ES705 codecs. The ES705 Codec reverses the volume adjustment. When attempting to change volume low = loud and vice versa. Correct this by remving the 100 - vol statement. Credit to Lessaj Change-Id: I4bfc280293bc2ab1170c2e5cf934734a7cfd809e --- hal/Android.mk | 4 ++++ hal/voice.c | 4 ++-- hal/voice_extn/compress_voip.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hal/Android.mk b/hal/Android.mk index c7d1a8a2..e5125f27 100644 --- a/hal/Android.mk +++ b/hal/Android.mk @@ -171,6 +171,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_AUXPCM_BT)),true) LOCAL_CFLAGS += -DAUXPCM_BT_ENABLED endif +ifeq ($(BOARD_USES_ES705),true) + LOCAL_CFLAGS += -DUSE_ES705 +endif + LOCAL_COPY_HEADERS_TO := mm-audio LOCAL_COPY_HEADERS := audio_extn/audio_defs.h diff --git a/hal/voice.c b/hal/voice.c index 94afa47c..d5dcc19b 100644 --- a/hal/voice.c +++ b/hal/voice.c @@ -326,12 +326,12 @@ int voice_set_volume(struct audio_device *adev, float volume) } vol = lrint(volume * 100.0); - +#ifndef USE_ES705 // Voice volume levels from android are mapped to driver volume levels as follows. // 0 -> 5, 20 -> 4, 40 ->3, 60 -> 2, 80 -> 1, 100 -> 0 // So adjust the volume to get the correct volume index in driver vol = 100 - vol; - +#endif err = platform_set_voice_volume(adev->platform, vol); } if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c index 348170a7..408d59a6 100644 --- a/hal/voice_extn/compress_voip.c +++ b/hal/voice_extn/compress_voip.c @@ -688,13 +688,13 @@ int voice_extn_compress_voip_set_volume(struct audio_device *adev, float volume) } vol = lrint(volume * 100.0); - +#ifndef USE_ES705 /* Voice volume levels from android are mapped to driver volume levels as follows. * 0 -> 5, 20 -> 4, 40 ->3, 60 -> 2, 80 -> 1, 100 -> 0 * So adjust the volume to get the correct volume index in driver */ vol = 100 - vol; - +#endif err = voip_set_volume(adev, vol); ALOGV("%s: exit: status(%d)", __func__, err); -- cgit v1.2.3