diff options
author | Glenn Kasten <gkasten@google.com> | 2012-01-03 14:22:33 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-01-13 15:25:14 -0800 |
commit | 4790bd8be850235e9c6f1acf1e1e6146ef2996b3 (patch) | |
tree | 1820560bc322ca1e67abee5d2a65c0539b72dbf5 /include/private | |
parent | 6a78cd85867c5f22e4e82259b81fab46088331ad (diff) | |
download | frameworks_base-4790bd8be850235e9c6f1acf1e1e6146ef2996b3.zip frameworks_base-4790bd8be850235e9c6f1acf1e1e6146ef2996b3.tar.gz frameworks_base-4790bd8be850235e9c6f1acf1e1e6146ef2996b3.tar.bz2 |
AudioTrack and AudioFlinger send level cleanup
Add an API to control block for getting/setting send level.
This allow us to make the mSendLevel field private.
Document the lack of barriers.
Use 0.0f to initialize floating-point values (for doc only).
Change-Id: I59f83b00adeb89eeee227e7648625d9a835be7a4
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/media/AudioTrackShared.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h index 046d5e9..86e0682 100644 --- a/include/private/media/AudioTrackShared.h +++ b/include/private/media/AudioTrackShared.h @@ -85,7 +85,9 @@ struct audio_track_cblk_t uint16_t bufferTimeoutMs; // Maximum cumulated timeout before restarting audioflinger uint16_t waitTimeMs; // Cumulated wait time - uint16_t sendLevel; +private: + uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0 +public: volatile int32_t flags; // Cache line boundary (32 bytes) @@ -98,6 +100,19 @@ struct audio_track_cblk_t uint32_t framesAvailable_l(); uint32_t framesReady(); bool tryLock(); + + // No barriers on the following operations, so the ordering of loads/stores + // with respect to other parameters is UNPREDICTABLE. That's considered safe. + + // for AudioTrack client only, caller must limit to 0.0 <= sendLevel <= 1.0 + void setSendLevel(float sendLevel) { + mSendLevel = uint16_t(sendLevel * 0x1000); + } + + // for AudioFlinger only; the return value must be validated by the caller + uint16_t getSendLevel_U4_12() const { + return mSendLevel; + } }; |