Update data access in collectEffects to use fxData instead of fxFile.data

This commit is contained in:
2026-07-14 11:50:34 +02:00
parent 882cd76fec
commit fce646065a

View File

@@ -602,31 +602,32 @@ export function collectEffects(files: TarFile[]) {
}; };
} }
const effectType = fxFile.data[4]; const fxData = fxFile.data;
const effectType = fxData[4];
const param1 = bytesToFloat32( const param1 = bytesToFloat32(
fxFile.data.slice(12 + (effectType - 1) * 4, 16 + (effectType - 1) * 4), fxData.slice(12 + (effectType - 1) * 4, 16 + (effectType - 1) * 4),
); );
const param2 = bytesToFloat32( const param2 = bytesToFloat32(
fxFile.data.slice(76 + (effectType - 1) * 4, 80 + (effectType - 1) * 4), fxData.slice(76 + (effectType - 1) * 4, 80 + (effectType - 1) * 4),
); );
const outputCompressor = const outputCompressor =
fxFile.data.length >= 144 fxData.length >= 144
? { ? {
drive: bytesToFloat32(fxFile.data.slice(136, 140)), drive: bytesToFloat32(fxData.slice(136, 140)),
speed: bytesToFloat32(fxFile.data.slice(140, 144)), speed: bytesToFloat32(fxData.slice(140, 144)),
} }
: undefined; : undefined;
const sidechain = const sidechain =
fxFile.data.length >= 152 fxData.length >= 152
? { ? {
length: bytesToFloat32(fxFile.data.slice(144, 148)), length: bytesToFloat32(fxData.slice(144, 148)),
shape: bytesToFloat32(fxFile.data.slice(148, 152)), shape: bytesToFloat32(fxData.slice(148, 152)),
routing: routing:
fxFile.data.length >= 160 fxData.length >= 160
? (Object.fromEntries( ? (Object.fromEntries(
projectGroups.map((group, index) => { projectGroups.map((group, index) => {
const offset = 152 + index * 2; const offset = 152 + index * 2;
const rawValue = fxFile.data[offset] | (fxFile.data[offset + 1] << 8); const rawValue = fxData[offset] | (fxData[offset + 1] << 8);
const routing: SidechainGroupRouting = { const routing: SidechainGroupRouting = {
rawValue, rawValue,
sourcePadMask: rawValue & 0x0fff, sourcePadMask: rawValue & 0x0fff,
@@ -640,7 +641,7 @@ export function collectEffects(files: TarFile[]) {
: undefined; : undefined;
return { return {
rawData: fxFile.data, rawData: fxData,
effectType, effectType,
param1, param1,
param2, param2,