Implement parsing for output compressor and sidechain effects state
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
Scene,
|
||||
SceneGroupPatternData,
|
||||
ScenesSettings,
|
||||
SidechainGroupRouting,
|
||||
SongPosition,
|
||||
Sound,
|
||||
TimeSignature,
|
||||
@@ -608,12 +609,43 @@ export function collectEffects(files: TarFile[]) {
|
||||
const param2 = bytesToFloat32(
|
||||
fxFile.data.slice(76 + (effectType - 1) * 4, 80 + (effectType - 1) * 4),
|
||||
);
|
||||
const outputCompressor =
|
||||
fxFile.data.length >= 144
|
||||
? {
|
||||
drive: bytesToFloat32(fxFile.data.slice(136, 140)),
|
||||
speed: bytesToFloat32(fxFile.data.slice(140, 144)),
|
||||
}
|
||||
: undefined;
|
||||
const sidechain =
|
||||
fxFile.data.length >= 152
|
||||
? {
|
||||
length: bytesToFloat32(fxFile.data.slice(144, 148)),
|
||||
shape: bytesToFloat32(fxFile.data.slice(148, 152)),
|
||||
routing:
|
||||
fxFile.data.length >= 160
|
||||
? (Object.fromEntries(
|
||||
projectGroups.map((group, index) => {
|
||||
const offset = 152 + index * 2;
|
||||
const rawValue = fxFile.data[offset] | (fxFile.data[offset + 1] << 8);
|
||||
const routing: SidechainGroupRouting = {
|
||||
rawValue,
|
||||
sourcePadMask: rawValue & 0x0fff,
|
||||
duckedDestination: (rawValue & 0x8000) !== 0,
|
||||
};
|
||||
return [group, routing];
|
||||
}),
|
||||
) as Record<Group, SidechainGroupRouting>)
|
||||
: undefined,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
rawData: fxFile.data,
|
||||
effectType,
|
||||
param1,
|
||||
param2,
|
||||
...(outputCompressor ? { outputCompressor } : {}),
|
||||
...(sidechain ? { sidechain } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,30 @@ export type ScenesSettings = {
|
||||
timeSignature: TimeSignature;
|
||||
};
|
||||
|
||||
export type OutputCompressorSettings = {
|
||||
drive: number;
|
||||
speed: number;
|
||||
};
|
||||
|
||||
export type SidechainGroupRouting = {
|
||||
rawValue: number;
|
||||
sourcePadMask: number;
|
||||
duckedDestination: boolean;
|
||||
};
|
||||
|
||||
export type SidechainSettings = {
|
||||
length: number;
|
||||
shape: number;
|
||||
routing?: Record<Group, SidechainGroupRouting>;
|
||||
};
|
||||
|
||||
export type Effects = {
|
||||
rawData: Uint8Array;
|
||||
effectType: EffectType;
|
||||
param1: number;
|
||||
param2: number;
|
||||
outputCompressor?: OutputCompressorSettings;
|
||||
sidechain?: SidechainSettings;
|
||||
};
|
||||
|
||||
export type Pattern = {
|
||||
|
||||
Reference in New Issue
Block a user