Feature: Implement device ID assignment utility and apply it to build processes

This commit is contained in:
2026-07-14 08:16:34 +02:00
parent 948b106604
commit b842c4d33f
2 changed files with 22 additions and 6 deletions

View File

@@ -121,6 +121,14 @@ function setLive10SampleReference(fileRef: any, sampleName: string) {
fileRef.LivePackId = { '@Value': '' };
}
export function assignDeviceListIds(devices: Record<string, any>[]) {
devices.forEach((device, deviceIdx) => {
Object.values(device).forEach((devContent: any) => {
devContent['@Id'] = deviceIdx;
});
});
}
function targetFor(
parameter: any,
maxValue?: number,
@@ -647,10 +655,12 @@ async function buildDrumRackDevice(koTrack: AblTrack, abletonVersion: AbletonVer
drumBranch.BranchInfo.SendingNote['@Value'] = subtrack.drumRackSendingNote ?? subtrack.rootNote; // not sure if this matters
drumBranch.BranchInfo.ChokeGroup['@Value'] = subtrack.inChokeGroup ? 1 : 0;
drumBranch.MixerDevice.Volume.Manual['@Value'] = subtrack.volume;
drumBranch.DeviceChain.MidiToAudioDeviceChain.Devices = await buildSimplerDevice(
const branchDevices = await buildSimplerDevice(
subtrack,
abletonVersion,
);
assignDeviceListIds([branchDevices]);
drumBranch.DeviceChain.MidiToAudioDeviceChain.Devices = branchDevices;
device.Branches.DrumBranch.push(drumBranch);
}
@@ -727,11 +737,7 @@ async function buildTrack(
}
// make sure id's are sequential in device chain
midiTrack.DeviceChain.DeviceChain.Devices['#'].forEach((device, deviceIdx) => {
Object.values(device).forEach((devContent: any) => {
devContent['@Id'] = deviceIdx;
});
});
assignDeviceListIds(midiTrack.DeviceChain.DeviceChain.Devices['#']);
if (exporterParams.groupTracks) {
midiTrack.DeviceChain.AudioOutputRouting.Target['@Value'] = 'AudioOut/GroupTrack';