12 #ifndef ROC_AUDIO_CHANNEL_SET_H_
13 #define ROC_AUDIO_CHANNEL_SET_H_
132 typedef uint64_t word_t;
136 WordBytes =
sizeof(word_t),
137 WordBits = WordBytes * 8,
138 NumWords = MaxChannels / WordBits
143 word_t words_[NumWords];
146 uint16_t first_chan_;
Channel layout, order, and positions.
Channel set. Multi-word bitmask with bits corresponding to enabled channels. Meaning of each channel ...
void set_channel(size_t n, bool enabled)
Set given channel to be enabled or disabled.
void set_layout(ChannelLayout layout)
Set layout of the channel set.
size_t last_channel() const
Get index of last enabled channel.
bool operator==(const ChannelSet &other) const
Check two channel sets for equality.
void set_channel_range(size_t from, size_t to, bool enabled)
Set all channels in inclusive range to be enabled or disabled.
ChannelSet(ChannelLayout layout, ChannelOrder order, ChannelMask mask)
Construct with given layout and 32-bit channel mask.
static size_t max_channels()
Get maximum possible number of channels.
void bitwise_or(const ChannelSet &other)
Set channel set to result of bitwise OR operation with another set.
bool has_channel(size_t n) const
Check if specific channel is enabled.
size_t num_bytes() const
Get number of bytes in bit mask.
void bitwise_and(const ChannelSet &other)
Set channel set to result of bitwise AND operation with another set.
void set_order(ChannelOrder order)
Set order of the channel set.
void set_channel_mask(ChannelMask mask)
Set enabled channels based on given mask.
uint8_t byte_at(size_t n) const
Get byte by index from bit mask.
void clear()
Unset all fields.
void bitwise_xor(const ChannelSet &other)
Set channel set to result of bitwise XOR operation with another set.
ChannelLayout layout() const
Get channel layout.
size_t first_channel() const
Get index of first enabled channel.
size_t num_channels() const
Get number of enabled channels.
bool is_superset(ChannelMask mask) const
Check if channel set is super-set of given mask, or equal to it.
bool is_subset(ChannelMask mask) const
Check if channel set is sub-set of given mask, or equal to it.
ChannelSet()
Construct empty channel set.
bool operator!=(const ChannelSet &other) const
Check two channel sets for equality.
bool is_valid() const
Check if channel set has valid layout and order, and non-zero channels.
ChannelOrder order() const
Get channel order.
ChannelLayout
Channel layout. Defines meaning of channels in ChannelSet. ChannelMapper uses channel layout to decid...
uint32_t ChannelMask
Channel mask.
void format_channel_set(const ChannelSet &ch_set, core::StringBuilder &bld)
Format ChannelSet to string.
ChannelOrder
Surround channel order.
Commonly used types and functions.