Update Ableton transformer logic for drum rack handling and group merging.
This commit is contained in:
@@ -89,9 +89,11 @@ export type AblScene = {
|
|||||||
|
|
||||||
export function getDrumRackMidiNote(padCode: PadCode) {
|
export function getDrumRackMidiNote(padCode: PadCode) {
|
||||||
const padNumber = parseInt(padCode.slice(1), 10);
|
const padNumber = parseInt(padCode.slice(1), 10);
|
||||||
|
// EP133 is 3x4 (top→bottom), Ableton Drum Rack is 4x4 (bottom→top)
|
||||||
|
// flip vertically: row 3 → row 0, row 0 → row 3
|
||||||
const row = 3 - Math.floor(padNumber / 3);
|
const row = 3 - Math.floor(padNumber / 3);
|
||||||
const col = padNumber % 3;
|
const col = padNumber % 3;
|
||||||
return 36 + row * 4 + col;
|
return 36 + row * 4 + col; // remaping notes starting from C1 (36)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrackNoteValues(track: AblTrack) {
|
function getTrackNoteValues(track: AblTrack) {
|
||||||
@@ -291,6 +293,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to create a drum rack track for a specific group
|
||||||
const createDrumRackTrack = (group: 'a' | 'b' | 'c' | 'd'): AblTrack | null => {
|
const createDrumRackTrack = (group: 'a' | 'b' | 'c' | 'd'): AblTrack | null => {
|
||||||
const groupTracksForDrumRack = tracks
|
const groupTracksForDrumRack = tracks
|
||||||
.filter((track) => track.group === group && track.sampleName)
|
.filter((track) => track.group === group && track.sampleName)
|
||||||
@@ -337,6 +340,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
timeSignature: data.scenesSettings.timeSignature,
|
timeSignature: data.scenesSettings.timeSignature,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// We need to merge notes from all tracks in the group into one track
|
||||||
const newClips = new Map<number, AblClip>();
|
const newClips = new Map<number, AblClip>();
|
||||||
|
|
||||||
drumTrack.tracks
|
drumTrack.tracks
|
||||||
@@ -378,6 +382,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
return drumTrack;
|
return drumTrack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Process drum racks for each group that has the option enabled
|
||||||
const drumRackTracks: AblTrack[] = [];
|
const drumRackTracks: AblTrack[] = [];
|
||||||
if (exporterParams.includeArchivedSamples) {
|
if (exporterParams.includeArchivedSamples) {
|
||||||
for (const group of ['a', 'b', 'c', 'd'] as const) {
|
for (const group of ['a', 'b', 'c', 'd'] as const) {
|
||||||
@@ -390,6 +395,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert drum rack tracks at the beginning, maintaining group order (A, B, C, D)
|
||||||
tracks.unshift(...drumRackTracks);
|
tracks.unshift(...drumRackTracks);
|
||||||
|
|
||||||
Sentry.setContext(`abletonData`, {
|
Sentry.setContext(`abletonData`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user