40 [[gnu::always_inline]] [[nodiscard]]
bool isSystemMessage()
const {
return statusType == 0x0f; }
46 return MIDIMessage{.statusType = 0b1000, .channel =
channel, .data1 = note, .data2 = velocity};
49 static MIDIMessage noteOn(uint8_t
channel, uint8_t note, uint8_t velocity) {
50 return MIDIMessage{.statusType = 0b1001, .channel =
channel, .data1 = note, .data2 = velocity};
53 static MIDIMessage polyphonicAftertouch(uint8_t
channel, uint8_t note, uint8_t aftertouch) {
54 return MIDIMessage{.statusType = 0b1010, .channel =
channel, .data1 = note, .data2 = aftertouch};
57 static MIDIMessage cc(uint8_t
channel, uint8_t cc, uint8_t value) {
58 return MIDIMessage{.statusType = 0b1011, .channel =
channel, .data1 = cc, .data2 = value};
61 static MIDIMessage programChange(uint8_t
channel, uint8_t program) {
62 return MIDIMessage{.statusType = 0b1100, .channel =
channel, .data1 = program, .data2 = 0};
65 static MIDIMessage channelAftertouch(uint8_t
channel, uint8_t aftertouch) {
66 return MIDIMessage{.statusType = 0b1101, .channel =
channel, .data1 = aftertouch, .data2 = 0};
74 .data1 =
static_cast<uint8_t
>(bend & 0x7f),
75 .
data2 =
static_cast<uint8_t
>((bend >> 7) & 0x7f),
80 return MIDIMessage{.statusType = 0x0F, .channel = 0x08, .data1 = 0, .data2 = 0};
83 static MIDIMessage realtimeStart() {
84 return MIDIMessage{.statusType = 0x0F, .channel = 0x0A, .data1 = 0, .data2 = 0};
87 static MIDIMessage realtimeContinue() {
88 return MIDIMessage{.statusType = 0x0F, .channel = 0x0B, .data1 = 0, .data2 = 0};
91 static MIDIMessage realtimeStop() {
92 return MIDIMessage{.statusType = 0x0F, .channel = 0x0C, .data1 = 0, .data2 = 0};
95 static MIDIMessage systemPositionPointer(uint16_t position) {
96 uint8_t positionPointerLSB = position & (uint32_t)0x7F;
97 uint8_t positionPointerMSB = (position >> 7) & (uint32_t)0x7F;
99 .statusType = 0x0F, .channel = 0x02, .data1 = positionPointerLSB, .data2 = positionPointerMSB};