diff options
author | Andy Hung <hunga@google.com> | 2014-05-30 10:42:03 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2014-05-30 17:07:44 -0700 |
commit | 6be494077f8d7970f3a88129c5d139c5a0c88f6d (patch) | |
tree | 8c77f163bd84e808693832666d29b42f73361fc5 /services/audioflinger/FastMixer.cpp | |
parent | 97ae82408469286426d8dc57a361350f74e24a8b (diff) | |
download | frameworks_av-6be494077f8d7970f3a88129c5d139c5a0c88f6d.zip frameworks_av-6be494077f8d7970f3a88129c5d139c5a0c88f6d.tar.gz frameworks_av-6be494077f8d7970f3a88129c5d139c5a0c88f6d.tar.bz2 |
Change parameter type for volume to float in AudioMixer
Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r-- | services/audioflinger/FastMixer.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index 13b21ec..c486630 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -273,10 +273,9 @@ void FastMixer::onStateChange() ALOG_ASSERT(name >= 0); mixer->setBufferProvider(name, bufferProvider); if (fastTrack->mVolumeProvider == NULL) { - mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, - (void *) MAX_GAIN_INT); - mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, - (void *) MAX_GAIN_INT); + float f = AudioMixer::UNITY_GAIN_FLOAT; + mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, &f); + mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, &f); } mixer->setParameter(name, AudioMixer::RESAMPLE, AudioMixer::REMOVE, NULL); @@ -336,12 +335,11 @@ void FastMixer::onWork() ALOG_ASSERT(name >= 0); if (fastTrack->mVolumeProvider != NULL) { gain_minifloat_packed_t vlr = fastTrack->mVolumeProvider->getVolumeLR(); - mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, - (void *) (uintptr_t) - (float_from_gain(gain_minifloat_unpack_left(vlr)) * MAX_GAIN_INT)); - mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, - (void *) (uintptr_t) - (float_from_gain(gain_minifloat_unpack_right(vlr)) * MAX_GAIN_INT)); + float vlf = float_from_gain(gain_minifloat_unpack_left(vlr)); + float vrf = float_from_gain(gain_minifloat_unpack_right(vlr)); + + mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, &vlf); + mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, &vrf); } // FIXME The current implementation of framesReady() for fast tracks // takes a tryLock, which can block |