Refactor Simpler automation targets and initial values
This commit is contained in:
@@ -202,17 +202,6 @@ function trackAutomationTargets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler) => {
|
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler) => {
|
||||||
const oneshot = Number(simpler.Globals.PlaybackMode['@Value']) === 1;
|
|
||||||
const samplePart = simpler.Player.MultiSampleMap.SampleParts.MultiSamplePart;
|
|
||||||
const sampleRef = samplePart.SampleRef;
|
|
||||||
const sampleRate = Number(sampleRef.DefaultSampleRate?.['@Value']);
|
|
||||||
const sampleDuration = Number(sampleRef.DefaultDuration?.['@Value']);
|
|
||||||
const trimmedFrames =
|
|
||||||
Number(samplePart.SampleEnd['@Value']) - Number(samplePart.SampleStart['@Value']);
|
|
||||||
const soundLength =
|
|
||||||
sampleRate > 0
|
|
||||||
? (trimmedFrames > 0 ? trimmedFrames : sampleDuration) / sampleRate
|
|
||||||
: undefined;
|
|
||||||
const pitchTarget = targetFor(simpler.Pitch.TransposeKey);
|
const pitchTarget = targetFor(simpler.Pitch.TransposeKey);
|
||||||
const staticPitchValue = koTrack.faderParams[FaderParam.PTC];
|
const staticPitchValue = koTrack.faderParams[FaderParam.PTC];
|
||||||
const staticPitchOffset =
|
const staticPitchOffset =
|
||||||
@@ -221,30 +210,6 @@ function trackAutomationTargets(
|
|||||||
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));
|
||||||
addTarget(
|
|
||||||
targets,
|
|
||||||
FaderParam.ATK,
|
|
||||||
targetFor(
|
|
||||||
oneshot
|
|
||||||
? simpler.VolumeAndPan.OneShotEnvelope.FadeInTime
|
|
||||||
: simpler.VolumeAndPan.Envelope.AttackTime,
|
|
||||||
oneshot ? 2000 : undefined,
|
|
||||||
soundLength,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
addTarget(
|
|
||||||
targets,
|
|
||||||
FaderParam.REL,
|
|
||||||
targetFor(
|
|
||||||
oneshot
|
|
||||||
? simpler.VolumeAndPan.OneShotEnvelope.FadeOutTime
|
|
||||||
: simpler.VolumeAndPan.Envelope.ReleaseTime,
|
|
||||||
oneshot ? 2000 : undefined,
|
|
||||||
soundLength,
|
|
||||||
oneshot,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount));
|
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -382,7 +347,6 @@ async function buildSimplerDevice(koTrack: AblTrack, abletonVersion: AbletonVers
|
|||||||
const samplePart = device.Player.MultiSampleMap.SampleParts.MultiSamplePart;
|
const samplePart = device.Player.MultiSampleMap.SampleParts.MultiSamplePart;
|
||||||
const loopModulators = device.Player.LoopModulators;
|
const loopModulators = device.Player.LoopModulators;
|
||||||
const simplerFilter = device.Filter.Slot.Value.SimplerFilter;
|
const simplerFilter = device.Filter.Slot.Value.SimplerFilter;
|
||||||
const playbackDuration = simplerPlaybackDuration(koTrack);
|
|
||||||
|
|
||||||
device.LastPresetRef.Value = {} as any;
|
device.LastPresetRef.Value = {} as any;
|
||||||
device.ShouldShowPresetName['@Value'] = 'false';
|
device.ShouldShowPresetName['@Value'] = 'false';
|
||||||
@@ -400,9 +364,11 @@ async function buildSimplerDevice(koTrack: AblTrack, abletonVersion: AbletonVers
|
|||||||
simplerFilter.ModByLfo.Manual['@Value'] = 0;
|
simplerFilter.ModByLfo.Manual['@Value'] = 0;
|
||||||
device.Lfo.IsOn.Manual['@Value'] = 'false';
|
device.Lfo.IsOn.Manual['@Value'] = 'false';
|
||||||
device.Pitch.PitchLfoAmount.Manual['@Value'] = 0;
|
device.Pitch.PitchLfoAmount.Manual['@Value'] = 0;
|
||||||
device.VolumeAndPan.OneShotEnvelope.FadeInTime.Manual['@Value'] = 0;
|
device.VolumeAndPan.OneShotEnvelope.FadeInTime.Manual['@Value'] = SIMPLER_FADE_IN_MS;
|
||||||
device.VolumeAndPan.OneShotEnvelope.FadeOutTime.Manual['@Value'] = 0;
|
device.VolumeAndPan.OneShotEnvelope.FadeOutTime.Manual['@Value'] = SIMPLER_FADE_OUT_MS;
|
||||||
device.VolumeAndPan.OneShotEnvelope.SustainMode.Manual['@Value'] = 0;
|
device.VolumeAndPan.OneShotEnvelope.SustainMode.Manual['@Value'] = 0;
|
||||||
|
device.VolumeAndPan.Envelope.AttackTime.Manual['@Value'] = SIMPLER_ATTACK_MS;
|
||||||
|
device.VolumeAndPan.Envelope.ReleaseTime.Manual['@Value'] = SIMPLER_RELEASE_MS;
|
||||||
device.Globals.PlaybackMode['@Value'] = playbackState.playbackMode;
|
device.Globals.PlaybackMode['@Value'] = playbackState.playbackMode;
|
||||||
device.Globals.NumVoices['@Value'] = playbackState.voices;
|
device.Globals.NumVoices['@Value'] = playbackState.voices;
|
||||||
device.Globals.RetriggerMode['@Value'] = playbackState.retrigger;
|
device.Globals.RetriggerMode['@Value'] = playbackState.retrigger;
|
||||||
@@ -445,44 +411,8 @@ async function buildSimplerDevice(koTrack: AblTrack, abletonVersion: AbletonVers
|
|||||||
// setting velocity scaling to 20% to match KO behavior
|
// setting velocity scaling to 20% to match KO behavior
|
||||||
device.VolumeAndPan.VolumeVelScale.Manual['@Value'] = 0.2;
|
device.VolumeAndPan.VolumeVelScale.Manual['@Value'] = 0.2;
|
||||||
|
|
||||||
const attackTarget = playbackState.useOneShotEnvelope
|
|
||||||
? device.VolumeAndPan.OneShotEnvelope.FadeInTime
|
|
||||||
: device.VolumeAndPan.Envelope.AttackTime;
|
|
||||||
const releaseTarget = playbackState.useOneShotEnvelope
|
|
||||||
? device.VolumeAndPan.OneShotEnvelope.FadeOutTime
|
|
||||||
: device.VolumeAndPan.Envelope.ReleaseTime;
|
|
||||||
attackTarget.Manual['@Value'] = simplerEnvelopeMilliseconds(
|
|
||||||
koTrack.attack,
|
|
||||||
playbackDuration,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
);
|
|
||||||
releaseTarget.Manual['@Value'] = simplerEnvelopeMilliseconds(
|
|
||||||
koTrack.release,
|
|
||||||
playbackDuration,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
);
|
|
||||||
device.VolumeAndPan.Panorama.Manual['@Value'] = koTrack.pan;
|
device.VolumeAndPan.Panorama.Manual['@Value'] = koTrack.pan;
|
||||||
|
|
||||||
// overriding attack time if ATK fader param is defined
|
|
||||||
if (koTrack.faderParams[FaderParam.ATK] !== -1) {
|
|
||||||
attackTarget.Manual['@Value'] = simplerEnvelopeMilliseconds(
|
|
||||||
koTrack.faderParams[FaderParam.ATK] * 255,
|
|
||||||
playbackDuration,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// overriding release time if REL fader param is defined
|
|
||||||
if (koTrack.faderParams[FaderParam.REL] !== -1) {
|
|
||||||
releaseTarget.Manual['@Value'] = simplerEnvelopeMilliseconds(
|
|
||||||
koTrack.faderParams[FaderParam.REL] * 255,
|
|
||||||
playbackDuration,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
playbackState.useOneShotEnvelope,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let pitch = koTrack.pitch || 0;
|
let pitch = koTrack.pitch || 0;
|
||||||
if (koTrack.samplePitch) {
|
if (koTrack.samplePitch) {
|
||||||
pitch += koTrack.samplePitch;
|
pitch += koTrack.samplePitch;
|
||||||
|
|||||||
Reference in New Issue
Block a user