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 | 317x 2662x 2662x 2662x 2662x 1440x 1440x 1262x 1262x 178x 2662x 3x | import { type BGACue } from '@be-music/chart-model';
// The BGA cue builders (`buildBGATimelines`, `buildBmsBGATimeline`) live in `@be-music/chart-model`; this module only picks
// the cue on screen, for `@be-music/player-engine/display`.
/**
* How long a POOR / miss BGA layer stays visible after a miss before the normal base/layer composite returns.
* 500 ms is the shipped default of both LR2 (`<poorbga>500</poorbga>` in its `config.xml`) and beatoraja
* (`PlayerConfig.misslayerDuration`, which `BGAProcessor.drawBGA` shows the miss layer for from the miss); both expose
* it as a per-user setting, this implementation does not yet. Shared by the renderers that time the miss layer out
* (TUI compositor, web built-in / LR2 scene, web beatoraja scene) so the miss-layer feel is identical across them —
* change it here, not per frontend.
*/
export const DEFAULT_POOR_BGA_DISPLAY_SECONDS = 0.5;
export function pickActiveBGACue<T extends { seconds: number }>(
cues: ReadonlyArray<T>,
seconds: number,
): T | undefined {
let low = 0;
let high = cues.length - 1;
let answer = -1;
while (low <= high) {
const mid = Math.floor((low + high) / 2);
if (cues[mid]!.seconds <= seconds) {
answer = mid;
low = mid + 1;
} else {
high = mid - 1;
}
}
return answer < 0 ? undefined : cues[answer];
}
export function pickActiveBGAKey(cues: ReadonlyArray<BGACue>, seconds: number): string | undefined {
return pickActiveBGACue(cues, seconds)?.key;
}
|