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,
|
position: number,
|
||||||
) {
|
) {
|
||||||
const staticValue = occurrence?.faderParams[parameter];
|
const staticValue = occurrence?.faderParams[parameter];
|
||||||
let value =
|
let value = staticValue === undefined || staticValue === -1 ? undefined : staticValue;
|
||||||
staticValue === undefined || staticValue === -1 ? defaultValue(parameter) : staticValue;
|
|
||||||
const points = (occurrence?.faderAutomation || [])
|
const points = (occurrence?.faderAutomation || [])
|
||||||
.filter((point) => point.parameter === parameter && point.position <= position)
|
.filter((point) => point.parameter === parameter && point.position <= position)
|
||||||
.sort((a, b) => a.position - b.position);
|
.sort((a, b) => a.position - b.position);
|
||||||
|
|||||||
@@ -254,13 +254,14 @@ async function buildMidiClip(
|
|||||||
dur = nextNote.position / 96 - noteData.position / 96;
|
dur = nextNote.position / 96 - noteData.position / 96;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const automatedVelocity = koClip.groupPattern
|
||||||
|
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position)
|
||||||
|
: undefined;
|
||||||
const velocity = Math.max(
|
const velocity = Math.max(
|
||||||
1,
|
1,
|
||||||
Math.min(
|
Math.min(
|
||||||
127,
|
127,
|
||||||
koClip.groupPattern
|
automatedVelocity === undefined ? noteData.velocity : automatedVelocity * 127,
|
||||||
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position) * 127
|
|
||||||
: noteData.velocity,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user