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