[go: nahoru, domu]

[Chromecast] Use new AThings volume table access functions

This hooks up the VolumeToDbFS and DbFSToVolume functions to use the
Android volume tables using a special Android Things system API.
Eventually (in Android P) such access will be through a public API.

Note that the volume_control API assumes only one table for all
stream types but Android actually has separate tables for separate
types. We deal with this by assuming the STREAM_MUSIC table for all
levels into and out of the volume_control API, and internally
remapping them to their correct curves.

This change also takes advantage of the new APIs to properly
calculate the ducking limiter value. This is necessary since the
AudioTrack.setVolume() multiplier is directly applied to the stream
data instead of being mapped through the volume tables first.

Bug: [internal] b/65457547
Test: Changing volumes up and down, observing results to TTS volume
      via logs and listening. Testing ducking at all volume levels.

Change-Id: Id3ffbf4e475a9d5565da1cc60d683b985e6f6cc3
Reviewed-on: https://chromium-review.googlesource.com/668809
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Commit-Queue: Chris Kuiper <ckuiper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503926}
8 files changed