Skip to content
Permalink
Browse files

Audio: Fix in-call audio not changing during a call

  • Loading branch information
Fagulhas committed Dec 20, 2012
1 parent e83e989 commit 3c88058b5ec79e536af8e3929b9ad7b833877cdb
Showing with 9 additions and 10 deletions.
  1. +3 −2 audio/AudioHardware.cpp
  2. +6 −8 audio/AudioPolicyManager.cpp
@@ -1574,9 +1574,10 @@ status_t AudioHardware::setVoiceVolume(float v)
ALOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
v = 1.0;
}
// Added 0.4 to current volume, as in voice call Mute cannot be set as minimum volume(0.00)
// Huawei sets volume range lower, change it to 0.2
// Added 0.2 to current volume, as in voice call Mute cannot be set as minimum volume(0.00)
// setting Rx volume level as 2 for minimum and 7 as max level.
v = 0.4 + v;
v = 0.2 + v;

int vol = lrint(v * 5.0);
ALOGD("setVoiceVolume(%f)\n", v);
@@ -953,7 +953,7 @@ status_t AudioPolicyManager::checkAndSetVolume(int stream, int index, audio_io_h
#ifdef QCOM_FM_ENABLED
|| (stream == AudioSystem::FM)
#endif
|| force) {
|| force) {
mOutputs.valueFor(output)->mCurVolume[stream] = volume;
ALOGVV("checkAndSetVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
if (stream == AudioSystem::VOICE_CALL ||
@@ -982,25 +982,23 @@ status_t AudioPolicyManager::checkAndSetVolume(int stream, int index, audio_io_h
voiceVolume = 1.0;
}

if ((voiceVolume != mLastVoiceVolume && output == mPrimaryOutput) &&
(!(mAvailableOutputDevices
if ((voiceVolume != mLastVoiceVolume && output == mPrimaryOutput)
#ifdef QCOM_FM_ENABLED
& AudioSystem::DEVICE_OUT_FM
&& (!(mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM))
#endif
))) {
) {
mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
mLastVoiceVolume = voiceVolume;
}
}
#ifdef QCOM_FM_ENABLED
else if ((stream == AudioSystem::FM) && (mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM)) {
} else if ((stream == AudioSystem::FM) && (mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM)) {
float fmVolume = -1.0;
fmVolume = (float)index/(float)mStreams[stream].mIndexMax;
if (fmVolume >= 0 && output == mPrimaryOutput) {
mpClientInterface->setFmVolume(fmVolume, delayMs);
}
}
#endif
}
return NO_ERROR;
}

0 comments on commit 3c88058

Please sign in to comment.
You can’t perform that action at this time.