mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-12 03:01:58 -04:00
midi: don't write trailing continuation 0xf0 for SysEx
Because our midi messages already have a size, we don't need the 0xf0 continuation terminator. Also having the terminator optionally requires you to check and strip it if it's there. The easiest algorithm is to check the first byte for start (0xf0) or continuation (0xf7) and the last byte for end (0xf7) and that should be enough to process the messages without having to ever stip the last byte.
This commit is contained in:
parent
b41d117609
commit
350eb9a041
10 changed files with 52 additions and 35 deletions
|
|
@ -560,9 +560,6 @@ int midi_file_write_event(struct midi_file *mf, const struct midi_event *event)
|
|||
ev_size--;
|
||||
ev_data++;
|
||||
|
||||
if (ev_data[ev_size-1] == 0xf0)
|
||||
ev_size--;
|
||||
|
||||
CHECK_RES(write_varlen(mf, tr, ev_size));
|
||||
|
||||
tr->size += 1;
|
||||
|
|
|
|||
|
|
@ -1569,11 +1569,6 @@ static int sysex_play(struct data *d, void *dst, uint32_t maxsize, unsigned int
|
|||
bytes[size] = 0xf7;
|
||||
size += 1;
|
||||
}
|
||||
} else {
|
||||
if (bytes[size-1] != 0xf0) {
|
||||
bytes[size] = 0xf0;
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
if (d->sysex.first) {
|
||||
if (bytes[0] != 0xf0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue