20 std::memset (activeChannels, 0,
sizeof (activeChannels));
23 bool isNoteActive (
int channel,
int note)
const noexcept
25 return isValidIndex (channel, note)
26 && (activeChannels[note] & (1u << (channel - 1))) != 0;
29 void startNote (
int channel,
int note)
noexcept
31 if (isValidIndex (channel, note))
32 activeChannels[note] |= (1u << (channel - 1));
35 void clearNote (
int channel,
int note)
noexcept
37 if (isValidIndex (channel, note))
38 activeChannels[note] &= ~(1u << (channel - 1));
41 bool areAnyNotesActive()
const noexcept
45 for (
auto a : activeChannels)
51 template <
typename Visitor>
52 void iterate (Visitor&& v)
const noexcept
54 for (
int note = 0; note < 128; ++note)
55 for (
int chan = 0; chan < 16; ++chan)
56 if ((activeChannels[note] & (1u << chan)) != 0)
60 static bool isValidIndex (
int channel,
int note)
noexcept