From 8c1bc179b40c6ba09d2e174f3d76a518269f49dc Mon Sep 17 00:00:00 2001 From: UK KIM Date: Wed, 13 Jul 2011 01:01:09 -0700 Subject: audio: set in-call volume when user starts call The RIL needs to have its voice volume reset every time a call is made, not every time the volume is changed from the upper layer. Change-Id: Id042da241de65f9dfb8d5c52e1b4bb910c7c0219 --- audio/audio_hw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 02b8d33..98be5e7 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -265,6 +265,7 @@ struct tuna_audio_device { struct pcm *pcm_modem_dl; struct pcm *pcm_modem_ul; int in_call; + float voice_volume; /* RIL */ struct ril_handle ril; @@ -299,6 +300,7 @@ struct tuna_stream_in { }; static void select_output_device(struct tuna_audio_device *adev); +static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ @@ -389,6 +391,7 @@ static void select_mode(struct tuna_audio_device *adev) select_output_device(adev); set_route_by_array(adev->mixer, amic_vx, 1); start_call(adev); + adev_set_voice_volume(&adev->device, adev->voice_volume); adev->in_call = 1; } } else if (adev->mode == AUDIO_MODE_NORMAL) { @@ -884,8 +887,10 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume) { struct tuna_audio_device *adev = (struct tuna_audio_device *)dev; + adev->voice_volume = volume; + /* convert the float volume to something suitable for the RIL */ - if (adev->in_call) { + if (adev->mode == AUDIO_MODE_IN_CALL) { int int_volume = (int)(volume * 5); ril_set_call_volume(&adev->ril, SOUND_TYPE_VOICE, int_volume); } @@ -1124,6 +1129,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; + adev->voice_volume = 1.0f; /* RIL */ ril_open(&adev->ril); -- cgit v1.1