Update Ableton transformer to support fader automation data
This commit is contained in:
@@ -2,6 +2,7 @@ import * as Sentry from '@sentry/react';
|
|||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
import {
|
import {
|
||||||
ExporterParams,
|
ExporterParams,
|
||||||
|
FaderAutomationEvent,
|
||||||
FaderParam,
|
FaderParam,
|
||||||
Note,
|
Note,
|
||||||
Pad,
|
Pad,
|
||||||
@@ -49,6 +50,11 @@ export type AblClip = {
|
|||||||
sceneName: string;
|
sceneName: string;
|
||||||
timeSignature: TimeSignature;
|
timeSignature: TimeSignature;
|
||||||
faderParams: { [K in FaderParam]: number };
|
faderParams: { [K in FaderParam]: number };
|
||||||
|
faderAutomation: AblFaderAutomationPoint[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AblFaderAutomationPoint = Pick<FaderAutomationEvent, 'position' | 'value' | 'flags'> & {
|
||||||
|
parameter: FaderParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AblScene = {
|
export type AblScene = {
|
||||||
@@ -64,7 +70,11 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
|
||||||
scenes.forEach((scene, sceneIndex) => {
|
scenes.forEach((scene, sceneIndex) => {
|
||||||
const sceneBars = Math.max(...scene.patterns.map((p) => p.bars));
|
const sceneBars = Math.max(
|
||||||
|
1,
|
||||||
|
...scene.patterns.map((p) => p.bars),
|
||||||
|
...Object.values(scene.patternEvents).map((pattern) => pattern?.bars || 0),
|
||||||
|
);
|
||||||
const ablScene: AblScene = {
|
const ablScene: AblScene = {
|
||||||
name: customSceneNames[scene.name] || scene.name,
|
name: customSceneNames[scene.name] || scene.name,
|
||||||
};
|
};
|
||||||
@@ -102,6 +112,15 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
}
|
}
|
||||||
|
|
||||||
const faderParams = data.settings.groupFaderParams[pad.group];
|
const faderParams = data.settings.groupFaderParams[pad.group];
|
||||||
|
const faderAutomation = (scene.patternEvents[pad.group]?.events || [])
|
||||||
|
.filter((event): event is FaderAutomationEvent => event.type === 'fader')
|
||||||
|
.filter((event) => event.parameter >= FaderParam.LVL && event.parameter <= FaderParam.MOD)
|
||||||
|
.map((event) => ({
|
||||||
|
position: event.position,
|
||||||
|
parameter: event.parameter as FaderParam,
|
||||||
|
value: event.value,
|
||||||
|
flags: event.flags,
|
||||||
|
}));
|
||||||
|
|
||||||
if (!track) {
|
if (!track) {
|
||||||
const soundId = findSoundIdByPad(pattern.pad, pads) || 0;
|
const soundId = findSoundIdByPad(pattern.pad, pads) || 0;
|
||||||
@@ -146,6 +165,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
sceneName: customSceneNames[scene.name] || scene.name,
|
sceneName: customSceneNames[scene.name] || scene.name,
|
||||||
timeSignature: data.scenesSettings.timeSignature,
|
timeSignature: data.scenesSettings.timeSignature,
|
||||||
faderParams,
|
faderParams,
|
||||||
|
faderAutomation,
|
||||||
});
|
});
|
||||||
|
|
||||||
track.lane = lane;
|
track.lane = lane;
|
||||||
|
|||||||
Reference in New Issue
Block a user