diff options
| author | 2009-10-24 01:38:58 -0700 | |
|---|---|---|
| committer | 2009-10-24 01:38:58 -0700 | |
| commit | 7ed70c9515fe3df6eb1796717d73f23e7286b3e6 (patch) | |
| tree | ca15e2090451457b722bb524c5f2c75421477c9f /libs/audioflinger/AudioFlinger.cpp | |
| parent | adddd24f31291f733cd5f72898b92f13f37ae37c (diff) | |
| parent | bf96aaadd46fb5b0884070177faa16ec4f22e2ba (diff) | |
am bf96aaad: Merge change Icf10db28 into eclair
Merge commit 'bf96aaadd46fb5b0884070177faa16ec4f22e2ba' into eclair-mr2
* commit 'bf96aaadd46fb5b0884070177faa16ec4f22e2ba':
  Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.
Diffstat (limited to 'libs/audioflinger/AudioFlinger.cpp')
| -rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 47 | 
1 files changed, 18 insertions, 29 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index ba8b3222933c..0960c81e108e 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -482,38 +482,17 @@ status_t AudioFlinger::setStreamVolume(int stream, float value, int output)          }      } -    status_t ret = NO_ERROR; - -    if (stream == AudioSystem::VOICE_CALL || -        stream == AudioSystem::BLUETOOTH_SCO) { -        float hwValue; -        if (stream == AudioSystem::VOICE_CALL) { -            hwValue = (float)AudioSystem::logToLinear(value)/100.0f; -            // offset value to reflect actual hardware volume that never reaches 0 -            // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java) -            value = 0.01 + 0.99 * value; -        } else { // (type == AudioSystem::BLUETOOTH_SCO) -            hwValue = 1.0f; -        } - -        AutoMutex lock(mHardwareLock); -        mHardwareStatus = AUDIO_SET_VOICE_VOLUME; -        ret = mAudioHardware->setVoiceVolume(hwValue); -        mHardwareStatus = AUDIO_HW_IDLE; - -    } -      mStreamTypes[stream].volume = value;      if (thread == NULL) { -        for (uint32_t i = 0; i < mPlaybackThreads.size(); i++) +        for (uint32_t i = 0; i < mPlaybackThreads.size(); i++) {             mPlaybackThreads.valueAt(i)->setStreamVolume(stream, value); - +        }      } else {          thread->setStreamVolume(stream, value);      } -    return ret; +    return NO_ERROR;  }  status_t AudioFlinger::setStreamMute(int stream, bool muted) @@ -553,11 +532,6 @@ float AudioFlinger::streamVolume(int stream, int output) const          volume = mStreamTypes[stream].volume;      } -    // remove correction applied by setStreamVolume() -    if (stream == AudioSystem::VOICE_CALL) { -        volume = (volume - 0.01) / 0.99 ; -    } -      return volume;  } @@ -644,6 +618,21 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, int format, int cha      return mAudioHardware->getInputBufferSize(sampleRate, format, channelCount);  } +status_t AudioFlinger::setVoiceVolume(float value) +{ +    // check calling permissions +    if (!settingsAllowed()) { +        return PERMISSION_DENIED; +    } + +    AutoMutex lock(mHardwareLock); +    mHardwareStatus = AUDIO_SET_VOICE_VOLUME; +    status_t ret = mAudioHardware->setVoiceVolume(value); +    mHardwareStatus = AUDIO_HW_IDLE; + +    return ret; +} +  void AudioFlinger::registerClient(const sp<IAudioFlingerClient>& client)  {  |