Fixed typedarray bugs in serialise
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import { fromBitArray, buildByte } from '../utils/functions';
|
||||
|
||||
export default function serialise(patch) {
|
||||
const data = new Array.from(serialise_patch(patch[0]));
|
||||
const data = Array.from(serialise_patch(patch[0]));
|
||||
switch (patch[0].voice_mode) {
|
||||
default:
|
||||
case 'Single':
|
||||
data.append(serialise_timbre(1, patch[1]));
|
||||
data.concat(serialise_timbre(1, patch[1]));
|
||||
break;
|
||||
case 'Multiple':
|
||||
data.append(serialise_timbre(1, patch[1]), serialise_timbre(2, patch[2]));
|
||||
data.concat(serialise_timbre(1, patch[1]), serialise_timbre(2, patch[2]));
|
||||
break;
|
||||
case 'Vocoder':
|
||||
data.append(serialise_vocoder(patch[1]));
|
||||
data.concat(serialise_vocoder(patch[1]));
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
@@ -155,7 +155,7 @@ function serialise_timbre(num, timbre) {
|
||||
),
|
||||
timbre[`t${num}_patch_4_intensity`],
|
||||
];
|
||||
array.append(Array(55).fill(0));
|
||||
array.concat(Array(55).fill(0));
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,6 @@ function serialise_vocoder(vocoder) {
|
||||
vocoder.v_pan_7,
|
||||
vocoder.v_pan_8,
|
||||
];
|
||||
array.append(Array(174).fill(0));
|
||||
array.concat(Array(174).fill(0));
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ export function sysex_encode(data) {
|
||||
|
||||
export function sysex_write_header(data, channel) {
|
||||
const ch = 0x30 + channel;
|
||||
return new Uint8Array(5 + SYSEX_LENGTH + 1)
|
||||
.set([0xf0, 0x42, ch, 0x58, 0x40], 0)
|
||||
.set(data, 5)
|
||||
.set(0xf7, -1);
|
||||
const array = new Uint8Array(5 + SYSEX_LENGTH + 1);
|
||||
array.set([0xf0, 0x42, ch, 0x58, 0x40], 0);
|
||||
array.set([...data, 0xf7], 5);
|
||||
return array;
|
||||
}
|
||||
|
||||
export function sysex_decode(syx) {
|
||||
|
||||
Reference in New Issue
Block a user