Skip to content

Commit

Permalink
Audio: Fix in-call audio not changing during a call
Browse files Browse the repository at this point in the history
  • Loading branch information
Fagulhas committed Dec 20, 2012
1 parent e83e989 commit 3c88058
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 3 additions & 2 deletions audio/AudioHardware.cpp
Expand Up @@ -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);
Expand Down
14 changes: 6 additions & 8 deletions audio/AudioPolicyManager.cpp
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 3c88058

Please sign in to comment.