Update Ableton exporter logic and fix test assertions

This commit is contained in:
2026-07-14 07:58:32 +02:00
parent b4517ac2d9
commit 69d5c545c7
2 changed files with 10 additions and 15 deletions

View File

@@ -228,7 +228,8 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
const staticPitchValue = koTrack.faderParams[FaderParam.PTC]; const staticPitchValue = koTrack.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 = Number(simpler.Pitch.TransposeKey.Manual['@Value']) - staticPitchOffset; pitchTarget.valueOffset =
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));
addTarget( addTarget(
@@ -385,9 +386,7 @@ async function buildMidiClip(
midiClip.Notes.NoteIdGenerator.NextId['@Value'] = _noteId; midiClip.Notes.NoteIdGenerator.NextId['@Value'] = _noteId;
const clipEnvelopes = const clipEnvelopes =
abletonVersion === '10' abletonVersion === '10' ? buildMidiClipEnvelopes(koClip.midiEvents, midiControllerTargets) : [];
? buildMidiClipEnvelopes(koClip.midiEvents, midiControllerTargets)
: [];
if (clipForLauncher && koTrack) { if (clipForLauncher && koTrack) {
clipEnvelopes.push( clipEnvelopes.push(
...buildClipEnvelopes(koClip.groupPattern, automationTargets, koTrack, false), ...buildClipEnvelopes(koClip.groupPattern, automationTargets, koTrack, false),
@@ -641,8 +640,7 @@ async function buildDrumRackDevice(koTrack: AblTrack, abletonVersion: AbletonVer
drumBranch.Name.EffectiveName['@Value'] = subtrack.name; drumBranch.Name.EffectiveName['@Value'] = subtrack.name;
drumBranch.Name.UserName['@Value'] = subtrack.name; drumBranch.Name.UserName['@Value'] = subtrack.name;
drumBranch.BranchInfo.ReceivingNote['@Value'] = note; drumBranch.BranchInfo.ReceivingNote['@Value'] = note;
drumBranch.BranchInfo.SendingNote['@Value'] = drumBranch.BranchInfo.SendingNote['@Value'] = subtrack.drumRackSendingNote ?? subtrack.rootNote; // not sure if this matters
subtrack.drumRackSendingNote ?? subtrack.rootNote; // not sure if this matters
drumBranch.BranchInfo.ChokeGroup['@Value'] = subtrack.inChokeGroup ? 1 : 0; drumBranch.BranchInfo.ChokeGroup['@Value'] = subtrack.inChokeGroup ? 1 : 0;
drumBranch.MixerDevice.Volume.Manual['@Value'] = subtrack.volume; drumBranch.MixerDevice.Volume.Manual['@Value'] = subtrack.volume;
drumBranch.DeviceChain.MidiToAudioDeviceChain.Devices = await buildSimplerDevice( drumBranch.DeviceChain.MidiToAudioDeviceChain.Devices = await buildSimplerDevice(

View File

@@ -1,9 +1,6 @@
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import test from 'node:test'; import test from 'node:test';
import abletonTransformer, { import abletonTransformer, { AblTrack, getDrumRackMidiNote } from '../src/lib/transformers/ableton';
AblTrack,
getDrumRackMidiNote,
} from '../src/lib/transformers/ableton';
import { import {
EffectType, EffectType,
FaderParam, FaderParam,
@@ -170,10 +167,7 @@ test('automatically builds a per-group rack without flattening chromatic pads',
); );
assert.deepEqual( assert.deepEqual(
melodic.lane?.clips.map((clip) => clip.notes.map((item) => item.note)), melodic.lane?.clips.map((clip) => clip.notes.map((item) => item.note)),
[ [[60, 64], [67]],
[60, 64],
[67],
],
); );
}); });
@@ -220,7 +214,10 @@ test('does not create selector-note racks when samples are excluded', () => {
exportAllPadsWithSamples: true, exportAllPadsWithSamples: true,
}); });
assert.equal(result.tracks.some((track) => track.drumRack), false); assert.equal(
result.tracks.some((track) => track.drumRack),
false,
);
assert.deepEqual( assert.deepEqual(
result.tracks.map((track) => track.padCode), result.tracks.map((track) => track.padCode),
['a0', 'a1', 'a2'] as PadCode[], ['a0', 'a1', 'a2'] as PadCode[],