Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Channel set. Multi-word bitmask with bits corresponding to enabled channels. Meaning of each channel is defined by ChannelLayout. Order of serialized channels is defined by ChannelOrder. More...
#include <channel_set.h>
Public Member Functions | |
ChannelSet () | |
Construct empty channel set. More... | |
ChannelSet (ChannelLayout layout, ChannelOrder order, ChannelMask mask) | |
Construct with given layout and 32-bit channel mask. More... | |
bool | operator== (const ChannelSet &other) const |
Check two channel sets for equality. More... | |
bool | operator!= (const ChannelSet &other) const |
Check two channel sets for equality. More... | |
bool | is_valid () const |
Check if channel set has valid layout and order, and non-zero channels. More... | |
void | clear () |
Unset all fields. More... | |
ChannelLayout | layout () const |
Get channel layout. More... | |
void | set_layout (ChannelLayout layout) |
Set layout of the channel set. More... | |
ChannelOrder | order () const |
Get channel order. More... | |
void | set_order (ChannelOrder order) |
Set order of the channel set. More... | |
size_t | num_channels () const |
Get number of enabled channels. More... | |
bool | has_channel (size_t n) const |
Check if specific channel is enabled. More... | |
size_t | first_channel () const |
Get index of first enabled channel. More... | |
size_t | last_channel () const |
Get index of last enabled channel. More... | |
bool | is_equal (ChannelMask mask) const |
Check if channel set is equal to given mask. More... | |
bool | is_subset (ChannelMask mask) const |
Check if channel set is sub-set of given mask, or equal to it. More... | |
bool | is_superset (ChannelMask mask) const |
Check if channel set is super-set of given mask, or equal to it. More... | |
void | set_mask (ChannelMask mask) |
Set channel mask to given bitmask. More... | |
void | set_range (size_t from, size_t to) |
Set channel mask to all channels from inclusive range. More... | |
void | set_count (size_t count) |
Set channel mask based on channel count. More... | |
void | toggle_channel (size_t n, bool enabled) |
Enable/disable given channel. More... | |
void | toggle_channel_range (size_t from, size_t to, bool enabled) |
Enable/disable all channels in inclusive range. More... | |
void | bitwise_and (const ChannelSet &other) |
Set channel set to result of bitwise AND operation with another set. More... | |
void | bitwise_or (const ChannelSet &other) |
Set channel set to result of bitwise OR operation with another set. More... | |
void | bitwise_xor (const ChannelSet &other) |
Set channel set to result of bitwise XOR operation with another set. More... | |
size_t | num_bytes () const |
Get number of bytes in bit mask. More... | |
uint8_t | byte_at (size_t n) const |
Get byte by index from bit mask. More... | |
Static Public Member Functions | |
static size_t | max_channels () |
Get maximum possible number of channels. More... | |
Channel set. Multi-word bitmask with bits corresponding to enabled channels. Meaning of each channel is defined by ChannelLayout. Order of serialized channels is defined by ChannelOrder.
Definition at line 26 of file channel_set.h.
roc::audio::ChannelSet::ChannelSet | ( | ) |
Construct empty channel set.
roc::audio::ChannelSet::ChannelSet | ( | ChannelLayout | layout, |
ChannelOrder | order, | ||
ChannelMask | mask | ||
) |
Construct with given layout and 32-bit channel mask.
void roc::audio::ChannelSet::bitwise_and | ( | const ChannelSet & | other | ) |
Set channel set to result of bitwise AND operation with another set.
void roc::audio::ChannelSet::bitwise_or | ( | const ChannelSet & | other | ) |
Set channel set to result of bitwise OR operation with another set.
void roc::audio::ChannelSet::bitwise_xor | ( | const ChannelSet & | other | ) |
Set channel set to result of bitwise XOR operation with another set.
uint8_t roc::audio::ChannelSet::byte_at | ( | size_t | n | ) | const |
Get byte by index from bit mask.
void roc::audio::ChannelSet::clear | ( | ) |
Unset all fields.
size_t roc::audio::ChannelSet::first_channel | ( | ) | const |
Get index of first enabled channel.
bool roc::audio::ChannelSet::has_channel | ( | size_t | n | ) | const |
Check if specific channel is enabled.
bool roc::audio::ChannelSet::is_equal | ( | ChannelMask | mask | ) | const |
Check if channel set is equal to given mask.
bool roc::audio::ChannelSet::is_subset | ( | ChannelMask | mask | ) | const |
Check if channel set is sub-set of given mask, or equal to it.
bool roc::audio::ChannelSet::is_superset | ( | ChannelMask | mask | ) | const |
Check if channel set is super-set of given mask, or equal to it.
bool roc::audio::ChannelSet::is_valid | ( | ) | const |
Check if channel set has valid layout and order, and non-zero channels.
size_t roc::audio::ChannelSet::last_channel | ( | ) | const |
Get index of last enabled channel.
ChannelLayout roc::audio::ChannelSet::layout | ( | ) | const |
Get channel layout.
|
static |
Get maximum possible number of channels.
size_t roc::audio::ChannelSet::num_bytes | ( | ) | const |
Get number of bytes in bit mask.
size_t roc::audio::ChannelSet::num_channels | ( | ) | const |
Get number of enabled channels.
bool roc::audio::ChannelSet::operator!= | ( | const ChannelSet & | other | ) | const |
Check two channel sets for equality.
bool roc::audio::ChannelSet::operator== | ( | const ChannelSet & | other | ) | const |
Check two channel sets for equality.
ChannelOrder roc::audio::ChannelSet::order | ( | ) | const |
Get channel order.
void roc::audio::ChannelSet::set_count | ( | size_t | count | ) |
Set channel mask based on channel count.
void roc::audio::ChannelSet::set_layout | ( | ChannelLayout | layout | ) |
Set layout of the channel set.
void roc::audio::ChannelSet::set_mask | ( | ChannelMask | mask | ) |
Set channel mask to given bitmask.
void roc::audio::ChannelSet::set_order | ( | ChannelOrder | order | ) |
Set order of the channel set.
void roc::audio::ChannelSet::set_range | ( | size_t | from, |
size_t | to | ||
) |
Set channel mask to all channels from inclusive range.
void roc::audio::ChannelSet::toggle_channel | ( | size_t | n, |
bool | enabled | ||
) |
Enable/disable given channel.
void roc::audio::ChannelSet::toggle_channel_range | ( | size_t | from, |
size_t | to, | ||
bool | enabled | ||
) |
Enable/disable all channels in inclusive range.