16 static constexpr size_t m_maxChannels = 64;
22 ChannelFlags (
bool defaultValues =
true, size_t numChannels = m_maxChannels)
24 if (numChannels > m_maxChannels)
27 m_numChannels = m_maxChannels;
35 if (newValues ==
true)
44 size_t
size()
const noexcept
54 if (newNumChannels > m_maxChannels)
57 m_numChannels = newNumChannels;
63 std::bitset<m_maxChannels>::reference
operator[] (size_t channel) {
64 if (channel >= m_numChannels)
67 return m_flags[channel];
74 if (channel >= m_numChannels)
77 return m_flags.test (channel);
86 for (size_t i = 0; i < m_maxChannels; ++i)
87 if (m_flags.test (i) ==
false)
99 for (size_t channel = 0; channel < m_maxChannels; ++channel)
100 res += m_flags.test (channel);
111 for (size_t i = 0; i < m_maxChannels; ++i)
112 if (m_flags.test (i) ==
true)
123 bool notFirst =
false;
125 for (size_t i = 0; i < m_numChannels; ++i)
127 if (m_flags.test (i) ==
false)
141 size_t m_numChannels = m_maxChannels;
142 std::bitset<m_maxChannels> m_flags;
A set of boolean flags mapped to each audio channel.
bool allTrue() const noexcept
Checks if all flags are set to true
bool operator[](size_t channel) const
Access the flag value for a specific channel.
std::bitset< m_maxChannels >::reference operator[](size_t channel)
Access the flag value for a specific channel.
size_t size() const noexcept
Returns the size (not capacity) of the container.
ChannelFlags(bool defaultValues=true, size_t numChannels=m_maxChannels)
Creates a new channel flags object.
void resize(size_t newNumChannels)
Resizes the container.
bool anyTrue() const noexcept
Checks if any of the flags is set to true
void setAllTo(bool newValues)
Sets all flags to a new value.
void representAsInitializerList(std::ostream &stream) const
Makes text representation of itself as a initializer list of active channels.
size_t numTrue()
Checks how many channels are marked with true
Thrown when an unexpected container size is encountered.
#define HART_THROW_OR_RETURN_VOID(ExceptionType, message)
Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns otherwise.
#define HART_THROW_OR_RETURN(ExceptionType, message, returnValue)
Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns a specified ...