summaryrefslogtreecommitdiffstats
path: root/include/private
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-03-21 17:53:17 -0700
committerGlenn Kasten <gkasten@google.com>2014-05-19 09:46:25 -0700
commitc56f3426099a3cf2d07ccff8886050c7fbce140f (patch)
tree9e486a809f9d500a70fd26c4e1d2596ded190dbe /include/private
parent7c96d53a65085f42ac2b6d416cbc16fd36ed72ff (diff)
downloadframeworks_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 'include/private')
-rw-r--r--include/private/media/AudioTrackShared.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 3901e79..5116d1e 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <sys/types.h>
+#include <audio_utils/minifloat.h>
#include <utils/threads.h>
#include <utils/Log.h>
#include <utils/RefBase.h>
@@ -110,11 +111,8 @@ private:
// force to 32-bit. The client and server may have different typedefs for size_t.
uint32_t mMinimum; // server wakes up client if available >= mMinimum
- // Channel volumes are fixed point U4.12, so 0x1000 means 1.0.
- // Left channel is in [0:15], right channel is in [16:31].
- // Always read and write the combined pair atomically.
- // For AudioTrack only, not used by AudioRecord.
- uint32_t mVolumeLR;
+ // Stereo gains for AudioTrack only, not used by AudioRecord.
+ gain_minifloat_packed_t mVolumeLR;
uint32_t mSampleRate; // AudioTrack only: client's requested sample rate in Hz
// or 0 == default. Write-only client, read-only server.
@@ -285,8 +283,8 @@ public:
mCblk->mSendLevel = uint16_t(sendLevel * 0x1000);
}
- // caller must limit to 0 <= volumeLR <= 0x10001000
- void setVolumeLR(uint32_t volumeLR) {
+ // set stereo gains
+ void setVolumeLR(gain_minifloat_packed_t volumeLR) {
mCblk->mVolumeLR = volumeLR;
}
@@ -405,7 +403,7 @@ public:
// return value of these methods must be validated by the caller
uint32_t getSampleRate() const { return mCblk->mSampleRate; }
uint16_t getSendLevel_U4_12() const { return mCblk->mSendLevel; }
- uint32_t getVolumeLR() const { return mCblk->mVolumeLR; }
+ gain_minifloat_packed_t getVolumeLR() const { return mCblk->mVolumeLR; }
// estimated total number of filled frames available to server to read,
// which may include non-contiguous frames