Closed semicontinuity closed 4 years ago
What shoes it so to memory usage when it's not invoked, but other midi functions are used?
No extra RAM is needed for this SYSEX support. If MIDI stream contains sysex packets, corresponding empty callbacks will be called.
Something's wrong. I tested with my midiserial sketch and got;
C:\Users\USER\AppData\Local\Temp\arduino_build_520897\libraries\usbhid\USBMIDI.cpp.o:(.rodata._ZTV7USBMIDI+0x48): warning: undefined reference to `USBMIDI::handleSysExData(unsigned char)'
C:\Users\USER\AppData\Local\Temp\arduino_build_520897\libraries\usbhid\USBMIDI.cpp.o:(.rodata._ZTV7USBMIDI+0x4c): warning: undefined reference to `USBMIDI::handleSysExEnd()'
Sorry, forgot to add empty handlers (my sketch has sysex handlers, but yours does not - that's why). Fixed.
Memory test:
This patch add lightweight support for sending and receiving SYSEX messages.
It does not do any sysex buffering, and simply forwards the message byte-by-byte to the application code: every byte is passed with handleSysExData(b) call, and the end of message is signalled with handleSysExEnd(). The user code is responsible for any processing - it may or may not buffer data, parse the message on the fly, etc.
To send sysex, there are options: either to send individual sysex packets, or to use sendSysexPayload() to transmit data from user-supplied buffer, and frame it with F0/F7 bytes.