From 6015dfc996dadefd1494cb3635928f8dce3b5a4c Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sat, 17 Jan 2009 13:30:20 -0800 Subject: Fix issue #1324: No audible call-waiting indication when in-call volume is low http://code.google.com/p/android/issues/detail?id=1324 Re-base the internally generated in-call audio volume so that it is never muted, which is already the case for the hardware routed in-call audio. --- libs/audioflinger/AudioFlinger.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index c330bc8..918b01f 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -800,13 +800,21 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) return BAD_VALUE; } - mStreamTypes[stream].volume = value; status_t ret = NO_ERROR; if (stream == AudioTrack::VOICE_CALL) { AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_SET_VOICE_VOLUME; ret = mAudioHardware->setVoiceVolume(value); mHardwareStatus = AUDIO_HW_IDLE; + // FIXME: This is a temporary fix to re-base the internally + // generated in-call audio so that it is never muted, which is + // already the case for the hardware routed in-call audio. + // When audio stream handling is reworked, this should be + // addressed more cleanly. Fixes #1324; see discussion at + // http://review.source.android.com/8224 + mStreamTypes[stream].volume = value * (1.0 - 1.0 / 6.0) + (1.0 / 6.0); + } else { + mStreamTypes[stream].volume = value; } return ret; } @@ -830,6 +838,11 @@ float AudioFlinger::streamVolume(int stream) const if (uint32_t(stream) >= AudioTrack::NUM_STREAM_TYPES) { return 0.0f; } + if (stream == AudioTrack::VOICE_CALL) { + // FIXME: Re-base internally generated in-call audio, + // reverse of above in setStreamVolume. + return (mStreamTypes[stream].volume - (1.0 / 6.0)) / (1.0 - 1.0 / 6.0); + } return mStreamTypes[stream].volume; } -- cgit v1.1