1#if defined(ESP32) || !defined(ARDUINO)
11 message(message), timestamp(timestamp) {
15 uint8_t *newBuffer =
new uint8_t[message.
length];
17 if (newBuffer ==
nullptr) {
18 DEBUGREF(F(
"SysEx buffer allocation failed"));
20 this->message.realtimemessage = 0x00;
23 memcpy(newBuffer, message.
data, message.
length);
24 this->message.sysexmessage.
data = newBuffer;
30 *
this = std::move(that);
36 std::swap(this->eventType, that.eventType);
38 std::swap(this->timestamp, that.timestamp);
45 delete[] message.sysexmessage.
data;
46 message.sysexmessage.
data =
nullptr;
47 message.sysexmessage.
length = 0;
49 message.realtimemessage = 0x00;
54 return push(MIDIMessageQueueElement(message, timestamp));
58 return push(MIDIMessageQueueElement(message, timestamp));
62 return push(MIDIMessageQueueElement(message, timestamp));
66 if (
storage.size() ==
size.load(std::memory_order_acquire))
70 MIDIMessageQueueElement el(message, timestamp);
77 size.fetch_add(1, std::memory_order_release);
83 if (
size.load(std::memory_order_acquire) == 0)
85 message = std::move(*
read_p);
88 size.fetch_sub(1, std::memory_order_release);
93 if (
storage.size() ==
size.load(std::memory_order_acquire))
97 size.fetch_add(1, std::memory_order_release);
void swap(AHEncoder &a, AHEncoder &b)
MIDIReadEvent
Values returned by the MIDI reading functions.
@ SYSEX_CHUNK
An incomplete System Exclusive message.
@ NO_MESSAGE
No new messages were received.
@ SYSEX_MESSAGE
A MIDI System Exclusive message was received.
#define BEGIN_CS_NAMESPACE
bool push(ChannelMessage message, uint16_t timestamp)
bool pop(MIDIMessageQueueElement &message)
#define DEBUGREF(x)
Print an expression and its location (file and line number) to the debug output if debugging is enabl...
void release()
Deallocate the storage for the SysEx data (if present).
MIDIMessageQueueElement & operator=(const MIDIMessageQueueElement &)=delete
No copy assignment.
MIDIMessageQueueElement()=default