Update Ableton exporter to handle pad track context for pitch automation targets

This commit is contained in:
2026-07-14 11:25:26 +02:00
parent f046f355fb
commit 50cf9e8176

View File

@@ -30,7 +30,9 @@ import {
filterEffectValues,
reverbEffectValues,
} from './effects';
import { convertGroupFaderValue } from './faderPolicies';
import { AbletonMidiControllerTargets, buildMidiClipEnvelopes } from './midi';
import { getPadEnvelopeState, getPadSoundState } from './padSound';
import { getSimplerPlaybackState } from './playback';
import { ALSDrumBranch } from './types/drumBranch';
import { ALSDrumRack } from './types/drumRack';
@@ -64,10 +66,6 @@ let _localTrackColor = -1;
let _localGroupTrackColor = -1;
const MIN_CLIP_LAUNCHER_SCENES = 8;
const SIMPLER_FADE_IN_MS = 0;
const SIMPLER_FADE_OUT_MS = 5;
const SIMPLER_ATTACK_MS = 0.1;
const SIMPLER_RELEASE_MS = 50;
type AbletonVersion = '10' | '11';
function getAbletonVersion(exporterParams: ExporterParams): AbletonVersion {
@@ -114,7 +112,7 @@ export function assignDeviceListIds(devices: Record<string, any>[]) {
});
}
function targetFor(parameter: any): AbletonAutomationTarget {
function targetFor(parameter: any, padTrack?: AblTrack): AbletonAutomationTarget {
const automationTarget =
parameter?.AutomationTarget?.['@Id'] === undefined
? undefined
@@ -124,6 +122,7 @@ function targetFor(parameter: any): AbletonAutomationTarget {
session: automationTarget,
staticValue:
parameter?.Manual?.['@Value'] === undefined ? undefined : Number(parameter.Manual['@Value']),
padTrack,
};
}
@@ -202,15 +201,19 @@ function trackAutomationTargets(
}
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler) => {
const pitchTarget = targetFor(simpler.Pitch.TransposeKey);
const staticPitchValue = koTrack.faderParams[FaderParam.PTC];
const padTracks = koTrack.drumRack
? koTrack.tracks.filter((track) => Boolean(track.sampleName))
: [koTrack];
const padTrack = padTracks.shift() ?? koTrack;
const pitchTarget = targetFor(simpler.Pitch.TransposeKey, padTrack);
const staticPitchValue = padTrack.faderParams[FaderParam.PTC];
const staticPitchOffset =
staticPitchValue === -1 ? 0 : Math.round((staticPitchValue - 0.5) * 10);
pitchTarget.valueOffset =
Number(simpler.Pitch.TransposeKey.Manual['@Value']) - staticPitchOffset;
addTarget(targets, FaderParam.PTC, pitchTarget);
addTarget(targets, FaderParam.TUNE, targetFor(simpler.Pitch.TransposeFine));
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount));
addTarget(targets, FaderParam.TUNE, targetFor(simpler.Pitch.TransposeFine, padTrack));
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount, padTrack));
});
findAutoFilters(midiTrack.DeviceChain.DeviceChain.Devices).forEach((filter) => {