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