Update fader value logic in Ableton exporter to handle undefined values correctly
This commit is contained in:
@@ -73,8 +73,7 @@ export function getFaderValueAt(
|
||||
position: number,
|
||||
) {
|
||||
const staticValue = occurrence?.faderParams[parameter];
|
||||
let value =
|
||||
staticValue === undefined || staticValue === -1 ? defaultValue(parameter) : staticValue;
|
||||
let value = staticValue === undefined || staticValue === -1 ? undefined : staticValue;
|
||||
const points = (occurrence?.faderAutomation || [])
|
||||
.filter((point) => point.parameter === parameter && point.position <= position)
|
||||
.sort((a, b) => a.position - b.position);
|
||||
|
||||
@@ -254,13 +254,14 @@ async function buildMidiClip(
|
||||
dur = nextNote.position / 96 - noteData.position / 96;
|
||||
}
|
||||
|
||||
const automatedVelocity = koClip.groupPattern
|
||||
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position)
|
||||
: undefined;
|
||||
const velocity = Math.max(
|
||||
1,
|
||||
Math.min(
|
||||
127,
|
||||
koClip.groupPattern
|
||||
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position) * 127
|
||||
: noteData.velocity,
|
||||
automatedVelocity === undefined ? noteData.velocity : automatedVelocity * 127,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user