carb::audio::getSpeakerFromSpeakerMode

Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::getSpeakerFromSpeakerMode(SpeakerMode channelMask, size_t index)

retrieves an indexed speaker name from a speaker mode mask.

Parameters
  • channelMask[in] the channel mask to retrieve one of the speaker names from. This must be a combination of one or more of the fSpeakerFlag* flags.

  • index[in] the zero based index of the speaker name to retrieve. This indicates which of the set speaker bits in the channel mask will be converted and returned.

Returns

the index of the speaker name of the index-th speaker set in the given channel mask. This may be cast to a Speaker::e* name if it is less than Speaker::eCount. If it is greater than or equal to Speaker::eCount, this would represent a custom unnamed speaker in the channel mask. This would be the index of the channel’s sample in each frame of output data for the given channel mask.

Returns

kInvalidSpeakerName if the index is out of range of the number of speakers in the given channel mask.