Update test data structure to use groupPatterns for project definition and track mapping
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
FaderParam,
|
||||
Group,
|
||||
GroupFaderParam,
|
||||
GroupPattern,
|
||||
MidiPatternEvent,
|
||||
Note,
|
||||
Pad,
|
||||
@@ -64,6 +65,30 @@ function note(noteValue: number, position: number, velocity = 100): Note {
|
||||
|
||||
function project(): ProjectRawData {
|
||||
const params = faderParams();
|
||||
const groupPatterns: GroupPattern[] = [
|
||||
{
|
||||
group: 'a',
|
||||
patternNumber: 1,
|
||||
bars: 1,
|
||||
recordCount: 0,
|
||||
events: [],
|
||||
notes: {
|
||||
0: [note(72, 0, 110)],
|
||||
1: [note(60, 0), note(64, 96)],
|
||||
},
|
||||
},
|
||||
{
|
||||
group: 'a',
|
||||
patternNumber: 2,
|
||||
bars: 1,
|
||||
recordCount: 0,
|
||||
events: [],
|
||||
notes: {
|
||||
0: [note(72, 24, 90)],
|
||||
1: [note(67, 48)],
|
||||
},
|
||||
},
|
||||
];
|
||||
return {
|
||||
pads: {
|
||||
a: [
|
||||
@@ -77,10 +102,13 @@ function project(): ProjectRawData {
|
||||
},
|
||||
scenes: [
|
||||
{
|
||||
number: 1,
|
||||
name: '01',
|
||||
patternNumbers: { a: 1, b: 0, c: 0, d: 0 },
|
||||
timeSignature: { numerator: 4, denominator: 4 },
|
||||
patterns: [
|
||||
{ pad: 'a0', group: 'a', notes: [note(72, 0, 110)], bars: 1 },
|
||||
{ pad: 'a1', group: 'a', notes: [note(60, 0), note(64, 96)], bars: 1 },
|
||||
{ pad: 'a0', group: 'a', notes: groupPatterns[0].notes[0], bars: 1 },
|
||||
{ pad: 'a1', group: 'a', notes: groupPatterns[0].notes[1], bars: 1 },
|
||||
],
|
||||
patternEvents: {
|
||||
a: {
|
||||
@@ -93,10 +121,13 @@ function project(): ProjectRawData {
|
||||
},
|
||||
},
|
||||
{
|
||||
number: 2,
|
||||
name: '02',
|
||||
patternNumbers: { a: 2, b: 0, c: 0, d: 0 },
|
||||
timeSignature: { numerator: 4, denominator: 4 },
|
||||
patterns: [
|
||||
{ pad: 'a0', group: 'a', notes: [note(72, 24, 90)], bars: 1 },
|
||||
{ pad: 'a1', group: 'a', notes: [note(67, 48)], bars: 1 },
|
||||
{ pad: 'a0', group: 'a', notes: groupPatterns[1].notes[0], bars: 1 },
|
||||
{ pad: 'a1', group: 'a', notes: groupPatterns[1].notes[1], bars: 1 },
|
||||
],
|
||||
patternEvents: {
|
||||
a: {
|
||||
@@ -109,6 +140,11 @@ function project(): ProjectRawData {
|
||||
},
|
||||
},
|
||||
],
|
||||
groupPatterns,
|
||||
songPositions: [
|
||||
{ position: 0, sceneNumber: 1 },
|
||||
{ position: 1, sceneNumber: 2 },
|
||||
],
|
||||
settings: {
|
||||
bpm: 120,
|
||||
scale: 0,
|
||||
@@ -140,10 +176,14 @@ function trackShape(tracks: AblTrack[]) {
|
||||
drumRack: track.drumRack,
|
||||
padCode: track.padCode,
|
||||
children: track.tracks.map((child) => child.padCode),
|
||||
clips: track.lane?.clips.map((clip) => ({
|
||||
sessionClips: track.lane?.sessionClips.map((clip) => ({
|
||||
sceneIndex: clip.sceneIndex,
|
||||
notes: clip.notes.map((item) => item.note),
|
||||
})),
|
||||
arrangementClips: track.lane?.arrangementClips.map((clip) => ({
|
||||
occurrenceIndex: clip.occurrenceIndex,
|
||||
notes: clip.notes.map((item) => item.note),
|
||||
})),
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -215,14 +255,14 @@ test('automatically builds a per-group rack without flattening chromatic pads',
|
||||
['a0', 'a2'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
rack.lane?.clips.map((clip) => [clip.sceneIndex, clip.sceneName, clip.notes[0].note]),
|
||||
rack.lane?.sessionClips.map((clip) => [clip.sceneIndex, clip.sceneName, clip.notes[0].note]),
|
||||
[
|
||||
[0, 'Same', getDrumRackMidiNote('a0')],
|
||||
[1, 'Same', getDrumRackMidiNote('a0')],
|
||||
],
|
||||
);
|
||||
assert.deepEqual(
|
||||
melodic.lane?.clips.map((clip) => clip.notes.map((item) => item.note)),
|
||||
melodic.lane?.sessionClips.map((clip) => clip.notes.map((item) => item.note)),
|
||||
[[60, 64], [67]],
|
||||
);
|
||||
});
|
||||
@@ -266,8 +306,8 @@ test('uses one hybrid classification for Arrangement and Session exports', () =>
|
||||
|
||||
test('classifies a pad from its distinct pitches across every exported scene', () => {
|
||||
const data = project();
|
||||
data.scenes[0].patterns[1].notes = [note(60, 0)];
|
||||
data.scenes[1].patterns[1].notes = [note(61, 0)];
|
||||
data.groupPatterns[0].notes[1] = [note(60, 0)];
|
||||
data.groupPatterns[1].notes[1] = [note(61, 0)];
|
||||
const result = abletonTransformer(data, { includeArchivedSamples: true });
|
||||
const rack = result.tracks.find((track) => track.drumRack);
|
||||
|
||||
@@ -290,12 +330,12 @@ test('keeps pad-specific MIDI expression on an individual track', () => {
|
||||
rawData,
|
||||
data: rawData.slice(3, 7),
|
||||
};
|
||||
data.scenes[0].patternEvents.a?.events.push(event);
|
||||
data.groupPatterns[0].events.push(event);
|
||||
const result = abletonTransformer(data, { includeArchivedSamples: true });
|
||||
const a0 = result.tracks.find((track) => track.padCode === 'a0' && !track.drumRack);
|
||||
|
||||
assert.ok(a0);
|
||||
assert.equal(a0.lane?.clips[0].midiEvents.length, 1);
|
||||
assert.equal(a0.lane?.sessionClips[0].midiEvents.length, 1);
|
||||
});
|
||||
|
||||
test('does not create selector-note racks when samples are excluded', () => {
|
||||
@@ -313,7 +353,7 @@ test('does not create selector-note racks when samples are excluded', () => {
|
||||
['a0', 'a1', 'a2'] as PadCode[],
|
||||
);
|
||||
assert.deepEqual(
|
||||
result.tracks[0].lane?.clips.map((clip) => clip.notes.map((item) => item.note)),
|
||||
result.tracks[0].lane?.sessionClips.map((clip) => clip.notes.map((item) => item.note)),
|
||||
[[72], [72]],
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user