Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 419x 838x 419x 419x 419x 279x 279x 124x 97x | /**
* Library entries for the select session's tests: charts, courses and a collection, with placeholder values that
* satisfy the types.
*/
import { createEmptyJSON, type BeMusicEvent, type BeMusicJSON } from '@be-music/chart-source';
import type { CourseDefinition } from '@be-music/player-engine/course';
import type { LibraryChart, LibraryCourse, LibraryFolder } from '@be-music/player-scene-model';
import type { BrowserChartCollection } from '../../collection/types.ts';
/** A chart titled `id` in the folder `directory`, with one object on each of `channels` (a 7-key chart by default). */
export function makeChart(
id: string,
directory: string,
options: { channels?: readonly string[]; difficulty?: number; modeHint?: string; playLevel?: number } = {},
): LibraryChart {
const chart: BeMusicJSON = createEmptyJSON();
chart.events = (options.channels ?? ['11', '18']).map((channel, index): BeMusicEvent => ({
measure: 1,
channel,
position: [index, Math.max(1, options.channels?.length ?? 1)],
value: '01',
}));
Iif (options.difficulty !== undefined) chart.metadata.difficulty = options.difficulty;
if (options.modeHint !== undefined) chart.bmson.info.modeHint = options.modeHint;
return {
id,
sourceId: 'test',
sourceLabel: 'test',
sourceKind: 'directory',
chartPath: `${directory}/${id}.bms`,
directoryLabel: directory,
fileLabel: `${id}.bms`,
title: id,
totalNotes: 1,
...(options.playLevel !== undefined ? { playLevel: options.playLevel } : {}),
chart,
};
}
/** A playable grade course named `id`. */
export function makeCourse(id: string, overrides: Partial<LibraryCourse> = {}): LibraryCourse {
const definition: CourseDefinition = {
name: id,
kind: 'grade',
stages: [],
constraints: [],
trophies: [],
release: false,
source: { format: 'beatoraja-json' },
};
return { id, definition, stages: [{ title: 'stage' }], playable: true, ...overrides };
}
/**
* A collection of `charts` with the course folders given, its charts in one source (`test`) holding `files` (path to
* bytes).
*/
export function makeCollection(
charts: readonly LibraryChart[],
courseFolders: readonly LibraryFolder[] = [],
files: Readonly<Record<string, Uint8Array>> = {},
): BrowserChartCollection {
return {
sources: [{ id: 'test', kind: 'directory', label: 'test', files: new Map(Object.entries(files)) }],
charts: [...charts],
errors: [],
...(courseFolders.length > 0 ? { courseFolders: [...courseFolders] } : {}),
};
}
/** A course folder listing `courses`. */
export function makeCourseFolder(label: string, courses: readonly LibraryCourse[]): LibraryFolder {
return { label, charts: [], courses: [...courses] };
}
|