Update Simpler track handling to use WeakMap
This commit is contained in:
@@ -64,6 +64,7 @@ let _localId = -1;
|
|||||||
let _localGroupId = -1;
|
let _localGroupId = -1;
|
||||||
let _localTrackColor = -1;
|
let _localTrackColor = -1;
|
||||||
let _localGroupTrackColor = -1;
|
let _localGroupTrackColor = -1;
|
||||||
|
const simplerPadTracks = new WeakMap<object, AblTrack>();
|
||||||
|
|
||||||
const MIN_CLIP_LAUNCHER_SCENES = 8;
|
const MIN_CLIP_LAUNCHER_SCENES = 8;
|
||||||
type AbletonVersion = '10' | '11';
|
type AbletonVersion = '10' | '11';
|
||||||
@@ -200,11 +201,8 @@ function trackAutomationTargets(
|
|||||||
addTarget(targets, FaderParam.FX, target);
|
addTarget(targets, FaderParam.FX, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
const padTracks = koTrack.drumRack
|
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler) => {
|
||||||
? koTrack.tracks.filter((track) => Boolean(track.sampleName))
|
const padTrack = simplerPadTracks.get(simpler) ?? koTrack;
|
||||||
: [koTrack];
|
|
||||||
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler, index) => {
|
|
||||||
const padTrack = padTracks[index] ?? koTrack;
|
|
||||||
const pitchTarget = targetFor(simpler.Pitch.TransposeKey, padTrack);
|
const pitchTarget = targetFor(simpler.Pitch.TransposeKey, padTrack);
|
||||||
const staticPitchValue = padTrack.faderParams[FaderParam.PTC];
|
const staticPitchValue = padTrack.faderParams[FaderParam.PTC];
|
||||||
const staticPitchOffset =
|
const staticPitchOffset =
|
||||||
@@ -350,6 +348,7 @@ async function buildSimplerDevice(
|
|||||||
) {
|
) {
|
||||||
const simplerTemplate = await loadTemplate<ALSSimpler>('simpler', abletonVersion);
|
const simplerTemplate = await loadTemplate<ALSSimpler>('simpler', abletonVersion);
|
||||||
const device = structuredClone(simplerTemplate.OriginalSimpler);
|
const device = structuredClone(simplerTemplate.OriginalSimpler);
|
||||||
|
simplerPadTracks.set(device, koTrack);
|
||||||
const padSound = getPadSoundState(koTrack);
|
const padSound = getPadSoundState(koTrack);
|
||||||
const padEnvelope = getPadEnvelopeState(padSound);
|
const padEnvelope = getPadEnvelopeState(padSound);
|
||||||
const playbackState = getSimplerPlaybackState(padSound.playMode);
|
const playbackState = getSimplerPlaybackState(padSound.playMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user