15 static constexpr size_t m_maxChannels = 64;
21 ChannelFlags (
bool defaultValues =
true, size_t numChannels = m_maxChannels)
23 if (numChannels > m_maxChannels)
26 m_numChannels = m_maxChannels;
34 if (newValues ==
true)
43 size_t
size()
const noexcept
53 if (newNumChannels > m_maxChannels)
56 m_numChannels = newNumChannels;
62 std::bitset<m_maxChannels>::reference
operator[] (size_t channel) {
63 if (channel >= m_numChannels)
66 return m_flags[channel];
73 if (channel >= m_numChannels)
76 return m_flags.test (channel);
85 for (size_t i = 0; i < m_maxChannels; ++i)
86 if (m_flags.test (i) ==
false)
98 for (size_t channel = 0; channel < m_maxChannels; ++channel)
99 res += m_flags.test (channel);
110 for (size_t i = 0; i < m_maxChannels; ++i)
111 if (m_flags.test (i) ==
true)
122 bool notFirst =
false;
124 for (size_t i = 0; i < m_numChannels; ++i)
126 if (m_flags.test (i) ==
false)
140 size_t m_numChannels = m_maxChannels;
141 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
#define HART_THROW_OR_RETURN_VOID(ExceptionType, message)
#define HART_THROW_OR_RETURN(ExceptionType, message, returnValue)