Fixed typedarray bugs in serialise
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
import Timbre from './Timbre';
|
import Timbre from './Timbre';
|
||||||
import Vocoder from './Vocoder';
|
import Vocoder from './Vocoder';
|
||||||
import Effects from './Effects';
|
import Effects from './Effects';
|
||||||
import Arpeggio from './Arpeggio';
|
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
export default function Editor() {
|
export default function Editor() {
|
||||||
const activeTab = useSelector((state) => state.parameters.activeTab);
|
const activeTab = useSelector((state) => state.parameters.activeTab);
|
||||||
return (
|
return (
|
||||||
<div className='col-span-5 overflow-y-auto overscroll-contain'>
|
<div className="col-span-5 overflow-y-auto overscroll-contain">
|
||||||
{activeTab === 'Timbre1' ? <Timbre id='timbre1' /> : null}
|
{activeTab === 'Timbre1' ? <Timbre id="timbre1" /> : null}
|
||||||
{activeTab === 'Timbre2' ? <Timbre id='timbre2' /> : null}
|
{activeTab === 'Timbre2' ? <Timbre id="timbre2" /> : null}
|
||||||
{activeTab === 'Vocoder' ? <Vocoder id='vocoder' /> : null}
|
{activeTab === 'Vocoder' ? <Vocoder id="vocoder" /> : null}
|
||||||
{activeTab === 'Effects' ? <Effects id='effects' /> : null}
|
{activeTab === 'Effects' ? <Effects id="effects" /> : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { fromBitArray, buildByte } from '../utils/functions';
|
import { fromBitArray, buildByte } from '../utils/functions';
|
||||||
|
|
||||||
export default function serialise(patch) {
|
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) {
|
switch (patch[0].voice_mode) {
|
||||||
default:
|
default:
|
||||||
case 'Single':
|
case 'Single':
|
||||||
data.append(serialise_timbre(1, patch[1]));
|
data.concat(serialise_timbre(1, patch[1]));
|
||||||
break;
|
break;
|
||||||
case 'Multiple':
|
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;
|
break;
|
||||||
case 'Vocoder':
|
case 'Vocoder':
|
||||||
data.append(serialise_vocoder(patch[1]));
|
data.concat(serialise_vocoder(patch[1]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
@@ -155,7 +155,7 @@ function serialise_timbre(num, timbre) {
|
|||||||
),
|
),
|
||||||
timbre[`t${num}_patch_4_intensity`],
|
timbre[`t${num}_patch_4_intensity`],
|
||||||
];
|
];
|
||||||
array.append(Array(55).fill(0));
|
array.concat(Array(55).fill(0));
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,6 +242,6 @@ function serialise_vocoder(vocoder) {
|
|||||||
vocoder.v_pan_7,
|
vocoder.v_pan_7,
|
||||||
vocoder.v_pan_8,
|
vocoder.v_pan_8,
|
||||||
];
|
];
|
||||||
array.append(Array(174).fill(0));
|
array.concat(Array(174).fill(0));
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ export function sysex_encode(data) {
|
|||||||
|
|
||||||
export function sysex_write_header(data, channel) {
|
export function sysex_write_header(data, channel) {
|
||||||
const ch = 0x30 + channel;
|
const ch = 0x30 + channel;
|
||||||
return new Uint8Array(5 + SYSEX_LENGTH + 1)
|
const array = new Uint8Array(5 + SYSEX_LENGTH + 1);
|
||||||
.set([0xf0, 0x42, ch, 0x58, 0x40], 0)
|
array.set([0xf0, 0x42, ch, 0x58, 0x40], 0);
|
||||||
.set(data, 5)
|
array.set([...data, 0xf7], 5);
|
||||||
.set(0xf7, -1);
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sysex_decode(syx) {
|
export function sysex_decode(syx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user