diff options
author | Andy Hung <hunga@google.com> | 2022-05-11 19:55:34 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2022-05-11 19:55:34 -0700 |
commit | cb0f95c29d405e233fa654a043e89cc840029a70 (patch) | |
tree | 907ef9c2b7946aae3718fc92ccc5cc674501a23f | |
parent | 575e3bb555ba429fac217c6dee7f0d844c921af5 (diff) | |
download | media-cb0f95c29d405e233fa654a043e89cc840029a70.tar.gz |
audio: add audio_is_channel_mask_spatialized
Test: spatialized audio playback
Bug: 232154509
Change-Id: Ie0c25656a0a1eb7a20ea4bed5ce36760c59c3673
-rw-r--r-- | audio/include/system/audio.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/audio/include/system/audio.h b/audio/include/system/audio.h index 2f7fe23e..b846595c 100644 --- a/audio/include/system/audio.h +++ b/audio/include/system/audio.h @@ -322,6 +322,28 @@ static inline audio_channel_mask_t audio_channel_mask_from_representation_and_bi return (audio_channel_mask_t) ((representation << AUDIO_CHANNEL_COUNT_MAX) | bits); } +/* + * Returns true so long as Quadraphonic channels (FL, FR, BL, BR) are completely specified + * in the channel mask. We expect these 4 channels to be the minimum for + * reasonable spatializer effect quality. + * + * Note, this covers: + * AUDIO_CHANNEL_OUT_5POINT1 + * AUDIO_CHANNEL_OUT_5POINT1POINT4 + * AUDIO_CHANNEL_OUT_7POINT1 + * AUDIO_CHANNEL_OUT_7POINT1POINT2 + * AUDIO_CHANNEL_OUT_7POINT1POINT4 + * AUDIO_CHANNEL_OUT_9POINT1POINT4 + * AUDIO_CHANNEL_OUT_9POINT1POINT6 + * AUDIO_CHANNEL_OUT_13POINT_360RA + * AUDIO_CHANNEL_OUT_22POINT2 + */ +static inline bool audio_is_channel_mask_spatialized(audio_channel_mask_t channelMask) { + return audio_channel_mask_get_representation(channelMask) + == AUDIO_CHANNEL_REPRESENTATION_POSITION + && (channelMask & AUDIO_CHANNEL_OUT_QUAD) == AUDIO_CHANNEL_OUT_QUAD; +} + /** * Expresses the convention when stereo audio samples are stored interleaved * in an array. This should improve readability by allowing code to use |