12 #ifndef ROC_AUDIO_CHANNEL_SET_H_
13 #define ROC_AUDIO_CHANNEL_SET_H_
150 typedef uint64_t word_t;
154 WordBytes =
sizeof(word_t),
155 WordBits = WordBytes * 8,
156 NumWords = MaxChannels / WordBits
162 word_t words_[NumWords];
165 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_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.
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 toggle_channel(size_t n, bool enabled)
Enable/disable given channel.
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 toggle_channel_range(size_t from, size_t to, bool enabled)
Enable/disable all channels in inclusive range.
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.
uint8_t byte_at(size_t n) const
Get byte by index from bit mask.
void clear()
Unset all fields.
void set_mask(ChannelMask mask)
Set channel mask to given bitmask.
void set_range(size_t from, size_t to)
Set channel mask to all channels from inclusive range.
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.
bool is_equal(ChannelMask mask) const
Check if channel set is equal to given mask.
void set_count(size_t count)
Set channel mask based on channel count.
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.