12 Aug
2016
12 Aug
'16
9:10 a.m.
Felipe F. Tonello wrote:
This patch adds a new options to amidi tool to add a delay (in milliseconds) to each MIDI message.
This is very useful when sending firmware updates to a remote device via SysEx or any other use that requires this delay in between messages.
- case 0xf4:
- case 0xf5:
return 0; /* ignore */- case 0xf7:
return 0; /* ignore */
Silent data loss is bad.
- case 0x00 ... 0x7f:
return rstate_len ?: rstate_len - 1;
rstate_len - 1 == -1
int len = message_length(*data);/* check for variable length */if (len == -1) {int i = 0;while (data[i++] != 0xf7);
Possible buffer overflow.
if (len > 0 &&(err = snd_rawmidi_write(output, data, len)) < 0) {
Same here.
The most robust way to find message boundaries probably would be a state machine. However, there is actually no requirement to find all message boundaries; the _actual_ requirement is to insert pauses between SysEx messages. So don't bother to try to parse everything; just search for F0 or F7.
Regards, Clemens