50template <u
int8_t BufferSize = 112>
67 for (uint8_t i = 0; i < BufferSize; i++)
74 if (midimsg.
getCable() != this->cable)
89 if (midimsg.
data[5] != 0x12)
92 const uint8_t midiOffset = midimsg.
data[6];
93 const uint8_t midiLength = midimsg.
length - 8;
94 const uint8_t *text = midimsg.
data + 7;
95 const uint8_t midiBufferEnd = midiOffset + midiLength;
97 const uint8_t bufferEnd = this->
offset + BufferSize;
101 if (midiOffset >= bufferEnd || this->
offset >= midiBufferEnd)
108 uint8_t srcStart = max(0, this->
offset - midiOffset);
109 uint8_t dstStart = max(0, midiOffset - this->
offset);
110 uint8_t length = midiBufferEnd - midiOffset -
111 max(0, this->
offset - midiOffset) -
112 max(0, midiBufferEnd - bufferEnd);
116 memcpy(&
buffer[dstStart], &text[srcStart], length);
118 for (uint8_t i = 0; i < length; ++i) {
119 buffer[dstStart + i] = text[srcStart + i];
120 assert(dstStart + i < BufferSize);
121 assert(srcStart + i < midiLength);
#define BEGIN_CS_NAMESPACE
A type-safe class for MIDI USB Cable numbers.
Counts the number of instances of the LCD class.
static uint8_t getInstances()
A class that represents the Mackie Control Universal LCD display and saves the text it receives.
const char * getText() const
Get a pointer to the null-terminated display text.
bool getDirty() const
Check if the text was updated since the last time the dirty flag was cleared.
LCD(uint8_t offset=0, Cable cable=Cable_1)
Array< char, BufferSize+1 > buffer
bool updateWith(SysExMessage midimsg) override
void clearDirty()
Clear the dirty flag.
constexpr auto min(const T &a, const U &b) -> decltype(b< a ? b :a)
Return the smaller of two numbers/objects.
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.
An array wrapper for easy copying, comparing, and iterating.
Cable getCable() const
Get the MIDI USB cable number of the message.
bool isCompleteMessage() const