diff options
author | Glenn Kasten <gkasten@google.com> | 2012-03-14 13:45:31 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-03-14 17:06:13 -0700 |
commit | 89f7ba3df8fc359023b494c2e625beed900bc706 (patch) | |
tree | 93106af7201d1a442bec580f5427675cf6655a33 /include/system/audio.h | |
parent | 1a87808b302898f8361664e80096dab0de81dfc0 (diff) | |
download | system_core-89f7ba3df8fc359023b494c2e625beed900bc706.zip system_core-89f7ba3df8fc359023b494c2e625beed900bc706.tar.gz system_core-89f7ba3df8fc359023b494c2e625beed900bc706.tar.bz2 |
audio_channel_in/out_mask_from_count
Change-Id: I879d188cf64ea1dbfa1a0574dee77119c2b08e26
Diffstat (limited to 'include/system/audio.h')
-rw-r--r-- | include/system/audio.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/system/audio.h b/include/system/audio.h index 0980319..b863063 100644 --- a/include/system/audio.h +++ b/include/system/audio.h @@ -384,7 +384,7 @@ static inline bool audio_is_output_channel(uint32_t channel) return false; } -/* Derive a channel mask from a channel count. +/* Derive an output channel mask from a channel count. * This is to be used when the content channel mask is unknown. The 1, 2, 4, 5, 6, 7 and 8 channel * cases are mapped to the standard game/home-theater layouts, but note that 4 is mapped to quad, * and not stereo + FC + mono surround. A channel count of 3 is arbitrarily mapped to stereo + FC @@ -392,7 +392,7 @@ static inline bool audio_is_output_channel(uint32_t channel) * Returns the matching channel mask, or 0 if the number of channels exceeds that of the * configurations for which a default channel mask is defined. */ -static inline audio_channel_mask_t audio_channel_mask_from_count(uint32_t channel_count) +static inline audio_channel_mask_t audio_channel_out_mask_from_count(uint32_t channel_count) { switch(channel_count) { case 1: @@ -416,6 +416,19 @@ static inline audio_channel_mask_t audio_channel_mask_from_count(uint32_t channe } } +/* Similar to above, but for input. Currently handles only mono and stereo. */ +static inline audio_channel_mask_t audio_channel_in_mask_from_count(uint32_t channel_count) +{ + switch (channel_count) { + case 1: + return AUDIO_CHANNEL_IN_MONO; + case 2: + return AUDIO_CHANNEL_IN_STEREO; + default: + return 0; + } +} + static inline bool audio_is_valid_format(audio_format_t format) { switch (format & AUDIO_FORMAT_MAIN_MASK) { |