diff options
author | Glenn Kasten <gkasten@google.com> | 2014-03-21 17:53:17 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-05-19 09:46:25 -0700 |
commit | c56f3426099a3cf2d07ccff8886050c7fbce140f (patch) | |
tree | 9e486a809f9d500a70fd26c4e1d2596ded190dbe /services/audioflinger/FastMixer.cpp | |
parent | 7c96d53a65085f42ac2b6d416cbc16fd36ed72ff (diff) | |
download | frameworks_av-c56f3426099a3cf2d07ccff8886050c7fbce140f.zip frameworks_av-c56f3426099a3cf2d07ccff8886050c7fbce140f.tar.gz frameworks_av-c56f3426099a3cf2d07ccff8886050c7fbce140f.tar.bz2 |
Pass stereo gains as packed minifloat
This will allow (eventually) a greater dynamic range for gains.
However there are still a few remaining places in effects and mixer
that will also need to be changed in order to get the full benefit.
Also fixes a minor bug: was not checking for NaN in AudioTrack C++.
Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r-- | services/audioflinger/FastMixer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index 5cb42cc..42ba791 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -257,9 +257,9 @@ void FastMixer::onStateChange() mixer->setBufferProvider(name, bufferProvider); if (fastTrack->mVolumeProvider == NULL) { mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, - (void *)0x1000); + (void *) MAX_GAIN_INT); mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, - (void *)0x1000); + (void *) MAX_GAIN_INT); } mixer->setParameter(name, AudioMixer::RESAMPLE, AudioMixer::REMOVE, NULL); @@ -312,11 +312,13 @@ void FastMixer::onWork() int name = fastTrackNames[i]; ALOG_ASSERT(name >= 0); if (fastTrack->mVolumeProvider != NULL) { - uint32_t vlr = fastTrack->mVolumeProvider->getVolumeLR(); + gain_minifloat_packed_t vlr = fastTrack->mVolumeProvider->getVolumeLR(); mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME0, - (void *)(uintptr_t)(vlr & 0xFFFF)); + (void *) (uintptr_t) + (float_from_gain(gain_minifloat_unpack_left(vlr)) * MAX_GAIN_INT)); mixer->setParameter(name, AudioMixer::VOLUME, AudioMixer::VOLUME1, - (void *)(uintptr_t)(vlr >> 16)); + (void *) (uintptr_t) + (float_from_gain(gain_minifloat_unpack_right(vlr)) * MAX_GAIN_INT)); } // FIXME The current implementation of framesReady() for fast tracks // takes a tryLock, which can block |