Add support for Ableton one-shot pad overrides in export logic
This commit is contained in:
7
src/lib/exporters/ableton/playback.ts
Normal file
7
src/lib/exporters/ableton/playback.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { PadCode } from '../../../types/types';
|
||||||
|
|
||||||
|
export type AbletonPlaybackMode = 'oneshot' | 'key' | 'legato';
|
||||||
|
|
||||||
|
export function hasOneShotOverride(padCode: PadCode, oneShotPads: PadCode[] = []) {
|
||||||
|
return oneShotPads.includes(padCode);
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
ProjectRawData,
|
ProjectRawData,
|
||||||
TimeSignature,
|
TimeSignature,
|
||||||
} from '../../types/types';
|
} from '../../types/types';
|
||||||
|
import { hasOneShotOverride } from '../exporters/ableton/playback';
|
||||||
import { getSampleName } from '../exporters/utils';
|
import { getSampleName } from '../exporters/utils';
|
||||||
import { findPad, findSoundByPad, findSoundIdByPad } from '../utils';
|
import { findPad, findSoundByPad, findSoundIdByPad } from '../utils';
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ export type AblData = {
|
|||||||
|
|
||||||
export type AblTrack = Omit<Pad, 'file' | 'rawData' | 'midiChannel'> & {
|
export type AblTrack = Omit<Pad, 'file' | 'rawData' | 'midiChannel'> & {
|
||||||
padCode: PadCode;
|
padCode: PadCode;
|
||||||
|
oneShotOverride: boolean;
|
||||||
group: string;
|
group: string;
|
||||||
sampleName: string;
|
sampleName: string;
|
||||||
sampleChannels: number;
|
sampleChannels: number;
|
||||||
@@ -174,6 +176,10 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
...omit(pad, ['file', 'rawData']),
|
...omit(pad, ['file', 'rawData']),
|
||||||
soundId,
|
soundId,
|
||||||
padCode: pattern.pad,
|
padCode: pattern.pad,
|
||||||
|
oneShotOverride: hasOneShotOverride(
|
||||||
|
pattern.pad,
|
||||||
|
exporterParams.abletonOneShotPads,
|
||||||
|
),
|
||||||
name: sound?.meta?.name || pattern.pad,
|
name: sound?.meta?.name || pattern.pad,
|
||||||
volume: pad.volume / 200, // converting from 0-200 to 0.0-1.0
|
volume: pad.volume / 200, // converting from 0-200 to 0.0-1.0
|
||||||
sampleName: getSampleName(sound?.meta?.name, soundId),
|
sampleName: getSampleName(sound?.meta?.name, soundId),
|
||||||
@@ -244,6 +250,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
...omit(pad, ['file', 'rawData']),
|
...omit(pad, ['file', 'rawData']),
|
||||||
soundId: pad.soundId,
|
soundId: pad.soundId,
|
||||||
padCode,
|
padCode,
|
||||||
|
oneShotOverride: hasOneShotOverride(padCode, exporterParams.abletonOneShotPads),
|
||||||
name: sound?.meta?.name || padCode,
|
name: sound?.meta?.name || padCode,
|
||||||
volume: pad.volume / 200,
|
volume: pad.volume / 200,
|
||||||
sampleName: getSampleName(sound?.meta?.name, pad.soundId),
|
sampleName: getSampleName(sound?.meta?.name, pad.soundId),
|
||||||
@@ -274,6 +281,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
|
|
||||||
const drumTrack: AblTrack = {
|
const drumTrack: AblTrack = {
|
||||||
padCode: `${group}0` as PadCode,
|
padCode: `${group}0` as PadCode,
|
||||||
|
oneShotOverride: false,
|
||||||
group,
|
group,
|
||||||
sampleName: '',
|
sampleName: '',
|
||||||
sampleChannels: 0,
|
sampleChannels: 0,
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ export type ExportFormat = {
|
|||||||
|
|
||||||
export type ExporterParams = {
|
export type ExporterParams = {
|
||||||
abletonVersion?: '10' | '11';
|
abletonVersion?: '10' | '11';
|
||||||
|
abletonOneShotPads?: PadCode[];
|
||||||
projectName?: string; // custom project name for exported files
|
projectName?: string; // custom project name for exported files
|
||||||
includeArchivedSamples?: boolean;
|
includeArchivedSamples?: boolean;
|
||||||
exportAllPadsWithSamples?: boolean; // export all pads with assigned samples even if not used
|
exportAllPadsWithSamples?: boolean; // export all pads with assigned samples even if not used
|
||||||
|
|||||||
Reference in New Issue
Block a user