Update MIDI FS SysEx parsing logic and add unit tests for page incrementing

This commit is contained in:
2026-07-14 11:45:04 +02:00
parent 6c21063906
commit ed6e50a50a
2 changed files with 22 additions and 2 deletions

View File

@@ -136,9 +136,11 @@ export function buildSysExGetFileDataRequest(page: number) {
}
export function parseSysExGetFileDataResponse(bytes: Uint8Array) {
const page = (bytes[0] << 8) | bytes[1];
return {
page: (bytes[0] << 8) | bytes[1],
nextPage: ((bytes[0] << 8) | (bytes[1] + 1)) & 0xffff,
page,
nextPage: (page + 1) & 0xffff,
data: bytes.subarray(2),
};
}