Fixed typedarray bugs in serialise

This commit is contained in:
Aoife
2021-04-18 02:47:19 +02:00
parent a7072e9dd0
commit c84ebc55b5
3 changed files with 15 additions and 16 deletions
+5 -6
View File
@@ -1,17 +1,16 @@
import Timbre from './Timbre';
import Vocoder from './Vocoder';
import Effects from './Effects';
import Arpeggio from './Arpeggio';
import { useSelector } from 'react-redux';
export default function Editor() {
const activeTab = useSelector((state) => state.parameters.activeTab);
return (
<div className='col-span-5 overflow-y-auto overscroll-contain'>
{activeTab === 'Timbre1' ? <Timbre id='timbre1' /> : null}
{activeTab === 'Timbre2' ? <Timbre id='timbre2' /> : null}
{activeTab === 'Vocoder' ? <Vocoder id='vocoder' /> : null}
{activeTab === 'Effects' ? <Effects id='effects' /> : null}
<div className="col-span-5 overflow-y-auto overscroll-contain">
{activeTab === 'Timbre1' ? <Timbre id="timbre1" /> : null}
{activeTab === 'Timbre2' ? <Timbre id="timbre2" /> : null}
{activeTab === 'Vocoder' ? <Vocoder id="vocoder" /> : null}
{activeTab === 'Effects' ? <Effects id="effects" /> : null}
</div>
);
}
+6 -6
View File
@@ -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;
}
+4 -4
View File
@@ -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) {