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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | 46x 289x | import type { BattleMode, LaneKeyOverrides, LR2ExtraLevel } from '@be-music/player-engine/lanes';
/**
* The options of a play session (`PlaySession`) and of its disposal: everything a host sets for a play, whichever family
* draws it. `createPlayScene` takes them as its `settings`, `course`, `replay`, `preResolved`, `audio` and `on`.
*/
import type { CourseView, PlayResult, HSFix, RandomMode, SystemSound } from '@be-music/player-scene-model';
import type { GameplayLayoutMode } from '@be-music/player-skin-sdk';
import type { NonstopStitchMap } from '@be-music/player-engine/course';
import type {
BeMusicReplay,
ReplayCourseStage,
ReplayRecordingOptions,
ReplayPlaybackOptions,
} from '@be-music/player-engine/replay';
import type { GaugePick, RulesetId } from '@be-music/player-engine/ruleset';
import type { JudgeTimingAutoAdjust } from '@be-music/player-engine/display';
import type { GuideSound, ResolvedPlayChart } from '@be-music/player-engine';
import type { CompressorParams, TunableCompressor } from '../../runtime/audio-bus.ts';
import type { BGATranscodeQuality } from '../../media/bga-stream/ffmpeg-args.ts';
import type { BPMGuideKinds } from '../../chart/bpm-guide.ts';
import type { AudioService } from '../../runtime/audio-service.ts';
import type { ControlKeyOverrides, ControlScheme } from '../controls/control-buttons.ts';
import type { ControlActionOverrides } from '../controls/control-actions.ts';
/** How far the play skin is moved (design pixels) and scaled, as LR2's number keys + the arrows move it. */
export interface SkinAdjust {
readonly x: number;
readonly y: number;
readonly scale: number;
}
/** The play skin where it is drawn. */
export const NO_SKIN_ADJUST: SkinAdjust = { x: 0, y: 0, scale: 1 };
/**
* The mine option a play of the player's own selection runs: nanasigroove's ADDMINE (`NANASI_ADD`) while the player has
* it on, otherwise the beatoraja mine option they picked under Mines.
*/
export function resolvePlayerMineModifier(
options: Pick<PlaySessionOptions, 'mineModifier' | 'crazyAddMine'>,
): import('@be-music/player-engine/lanes').MineModifier | undefined {
return options.crazyAddMine === true ? 'NANASI_ADD' : options.mineModifier;
}
import type { TempoPitchMode, TimeStretchAlgorithm } from '../../runtime/play-tempo.ts';
import type { BeMusicEffectLevel } from '../../skin/be-music/types.ts';
/**
* The options of a play: the play options it judges and scrolls with, the tempo, the audio mix, the BGA, the drawing
* options its view reads, and the host's callbacks. Everything here reaches the same engine / audio / BGA pipeline
* whichever family draws the play.
*/
export interface PlaySessionOptions {
/** Selected source options to preserve in the replay, independently of score handling. */
recordingOptionState?: import('@be-music/player-engine/replay').ReplayOptionState;
/** Showmanship level for the Be-Music Skin (count-ins, shakes, particles). Defaults to `'full'`. */
beMusicEffects?: BeMusicEffectLevel;
/**
* Gameplay layout for the Be-Music Skins. `'touch'` (for touch screens) spreads the lanes across most of the stage
* with a low judgement line and (on a landscape stage) no BGA; the 24 / 48 KEY modes and LR2 skins keep the standard
* layout regardless. On a portrait screen a skin with a portrait stage
* plays 5 / 7 / 9 KEY charts on it, in either mode. Defaults to `'standard'`.
*/
layoutMode?: GameplayLayoutMode;
onExit?: () => void;
/**
* Restart hook. Fired when the player presses the restart hotkey (`R` by default) — host should dispose this view and
* mount a fresh one with the same song. The view itself can't recreate its `Application` cleanly, so re-mount is the
* host's job.
*/
onRestart?: () => void;
/**
* Natural-end hook. Fires once when the chart has finished playing (every playable note judged + a small audio tail
* buffer). The snapshot is the same payload `PlaySession.getResultData` returns — passed eagerly so the
* host doesn't have to reach back into the soon-to-be-disposed gameplay view to read it. When this hook is supplied,
* `onExit` is **not** called for natural completion; `onExit` is reserved for the user-initiated escape (ESC). Hosts
* that don't want a result screen can leave this unset and rely on `onExit` for both paths (legacy behavior).
*/
onChartFinished?: (result: PlayResult) => void;
/** When true, every note is auto-judged as PERFECT at its scheduled time. */
autoPlay?: boolean;
/** Opt in to manual seeking; seeking turns the play into practice. */
allowSeek?: 'practice';
/** A previous course stage sought: keep this stage out of recording and records too. */
practice?: boolean;
/**
* When true, the gameplay automatically pauses on tab visibility change (`document.hidden`) and window blur, and
* auto-resumes on focus / `pageshow`. When false (the default), the play scene keeps running in the background —
* convenient for capturing recordings while another window holds focus, and matches the "no surprise pauses"
* behavior most rhythm-game hosts ship.
*/
autoPauseOnBlur?: boolean;
/**
* Initial visual scroll-speed multiplier. Mirrors the live runtime hotkey (`ArrowUp` / `ArrowDown` adjusts this value
* during play); the option lets the host seed it from the select-screen play-options panel so the user doesn't have
* to re-dial their preferred HS at every song. Clamped to [`HISPEED_MIN`, `HISPEED_MAX`] internally; defaults to
* `DEFAULT_HISPEED` (2.0).
*/
initialHiSpeed?: number;
/**
* Fires when the player changes the hi-speed during play (`ArrowUp` / `ArrowDown`), with the new value on the same
* scale as {@link initialHiSpeed} — before any HS-FIX rescaling — so a host can remember it and seed the next play
* with it. Not fired for `PlaySession.setHiSpeed` writes, which come from the host.
*/
onHiSpeedChange?: (hiSpeed: number, normalLevel?: number, floating?: boolean) => void;
/**
* Where the play skin is moved to and how far it is scaled (LR2's 1 / 2 + the arrows), in design pixels: the play
* starts with it, and reports each change through {@link onSkinAdjustChange} for the next play.
*/
skinAdjust?: SkinAdjust;
/** The player moved or scaled the play skin (LR2's 1 / 2 + the arrows). */
onSkinAdjustChange?: (adjust: SkinAdjust) => void;
/**
* BGA display mode picked from the LR2 panel-1 BGA toggle (`#SRC_BUTTON,type=72`). Defaults to `'ON'` so charts that
* ship a BGA render it by default. With `'OFF'` the BGA layer stays empty for the entire play; with `'AUTOPLAY_ONLY'`
* the BGA only shows when {@link autoPlay} is also true.
*/
bga?: 'OFF' | 'ON' | 'AUTOPLAY_ONLY';
/**
* BGA frame size picked from `#SRC_BUTTON,type=73`. NORMAL uses the skin's default `#DST_BGA` rect (op 30); EXTEND
* chooses the larger variant (op 31). Defaults to NORMAL.
*/
bgaSize?: 'NORMAL' | 'EXTEND';
/**
* Score-graph display flag picked from `#SRC_BUTTON,type=70`. Drives ops 38 (off) / 39 (on) on the gameplay runtime
* so the skin's score-prediction line chrome (gated on op 39) shows when enabled. Defaults to `false` to mirror the
* LR2 default.
*/
scoreGraph?: boolean;
/**
* HS-FIX mode picked from `#SRC_BUTTON,type=55`. Applied as a one-time multiplier on `initialHiSpeed` at
* chart-prepare time so the user's chosen HS feels consistent across BPM changes. LR2 `'CONSTANT'` uses a
* separate 150-BPM distance map and pauses on STOP, without applying the ordinary HS-FIX multiplier.
*/
hsFix?: HSFix;
classicHiSpeed?: boolean;
floatingHiSpeed?: boolean;
fixedDisplayArea?: boolean;
normalHiSpeedLevel?: number;
judgeTimingMs?: number;
visualConstant?: boolean;
lift1P?: number;
lift2P?: number;
liftOn1P?: boolean;
liftOn2P?: boolean;
noteDurationMs?: number;
constantFadeMs?: number;
onJudgeTimingChange?: (judgeTimingMs: number) => void;
bpmGuide?: boolean;
/**
* Which of the STOP, `#SCROLL` and `#SPEED` guide labels show (viewing preferences, followed live). The BPM labels
* follow {@link bpmGuide} alone (`resolveShownGuideKinds`); without this, STOPs follow it too, as beatoraja's guide.
*/
bpmGuideKinds?: BPMGuideKinds;
/**
* The automatic judge-timing adjustment of a manual play (default `'OFF'`), which moves {@link judgeTimingMs}:
* beatoraja's calibration or LR2's ON / SILENT. LR2's SILENT also loads no keysounds, BGM or BGA and hides the judge
* display; a replay takes that from its own recorded mode and never adjusts.
*/
judgeTimingAutoAdjust?: JudgeTimingAutoAdjust;
/**
* HIDDEN / SUDDEN / HID+SUD effect picked from `#SRC_BUTTON,type=50/51`:
*
* - `OFF` — no mask
* - `HIDDEN` — bottom of the playfield is masked (notes disappear before reaching the judge line)
* - `SUDDEN` — top of the playfield is masked (notes appear suddenly partway down)
* - `HID+SUD` — both
*
* Defaults to `'OFF'`.
*/
hiddenSudden1P?: 'OFF' | 'HIDDEN' | 'SUDDEN' | 'HID+SUD';
hiddenSudden2P?: 'OFF' | 'HIDDEN' | 'SUDDEN' | 'HID+SUD';
/**
* Shutter coverage (0..1) — how much of the playfield each active mask occupies. `0.25` covers the bottom 25 % for
* HIDDEN, the top 25 % for SUDDEN, and 25 % at each end for HID+SUD. Drives slider `type=4 / 5` on the panel-1
* shutter track. Defaults to `0.25`.
*/
shutter?: number;
/**
* LANE COVER ON / OFF toggle (LR2 button_type 46). When true, the gameplay-side mask renders at `shutter`'s
* configured height. When false, the mask is suppressed regardless of `shutter` — preserves the user's last height
* across toggles so they don't have to redial it after re-enabling.
*/
laneCover?: boolean;
/**
* Where the lane covers start: `'play-options'` (default) from {@link hiddenSudden1P} / {@link hiddenSudden2P},
* {@link shutter} and {@link laneCover}; `'none'` with every cover at 0 and off.
*/
coverStart?: 'play-options' | 'none';
/**
* The play takes the lane cover keys (`play-cover-keys.ts`): PageUp / PageDown move SUDDEN+, Home / End the LIFT, H
* switches HIDDEN+ and J / K move it. The beatoraja play screen's keys; off by default.
*/
coverKeys?: boolean;
/** beatoraja's note-selection algorithm. */
judgeAlgorithm?: 'combo' | 'duration' | 'lowest';
/** LR2's mania option GAMBOL (LR2 rules only): 1 or 2; 0 or absent is off. */
lr2Gambol?: 0 | 1 | 2;
/** beatoraja CUSTOM JUDGE rates; absent while the option is off. */
customJudge?: import('@be-music/player-engine/ruleset').BeatorajaCustomJudge;
longNoteModifier?: import('@be-music/player-scene-model').PlayOptions['longNoteModifier'];
longNoteRate?: number;
sevenToNinePattern?: import('@be-music/player-engine/lanes').SevenToNinePattern;
sevenToNineType?: import('@be-music/player-engine/lanes').SevenToNineType;
battleMode?: BattleMode;
dBattleScratch?: boolean;
/** PRACTICE range and rules (`PlayerOptions.practice`), under every ruleset; set with `practice` so nothing is saved. */
practiceRange?: import('@be-music/player-engine').PlayerOptions['practice'];
/** beatoraja LN MODE for charts whose long-note mode is undefined. */
longNoteMode?: 'LN' | 'CN' | 'HCN';
lr2ExtraMode?: boolean;
lr2ExtraLevel?: LR2ExtraLevel;
/** LR2's mania chart generators: each rate is 0 (off) or 10–100. A replay plays back its recorded rates and seed. */
lr2Mania?: import('@be-music/player-engine/lanes').LR2ManiaChartRates;
extraNoteDepth?: number;
extraNoteScratch?: boolean;
mineModifier?: import('@be-music/player-scene-model').PlayOptions['mineModifier'];
/** nanasigroove's GOOD2BAD / GREAT2BAD the player picked; a chart's own wins. */
crazyJudge?: import('@be-music/player-scene-model').PlayOptions['crazyJudge'];
/** nanasigroove's HELLJUDGE the player picked; a chart's own wins. */
crazyHellJudge?: boolean;
/** nanasigroove's ADDMINE the player picked: it replaces `mineModifier` while on (`resolvePlayerMineModifier`). */
crazyAddMine?: boolean;
/** nanasigroove's NOTES conversion the player picked; a chart's own wins. */
crazyNotes?: import('@be-music/player-scene-model').PlayOptions['crazyNotes'];
scrollModifier?: import('@be-music/player-scene-model').PlayOptions['scrollModifier'];
scrollSection?: number;
scrollRate?: number;
gaugeAutoShift?: import('@be-music/player-scene-model').PlayOptions['gaugeAutoShift'];
bottomShiftableGauge?: import('@be-music/player-scene-model').PlayOptions['bottomShiftableGauge'];
bmsonTotalMode?: import('@be-music/player-engine/ruleset').BmsonTotalMode;
/**
* 1P side auto-scratch flag — when true, the scratch lane (channel 16) auto-judges as PERFECT at every note's
* scheduled time even when {@link autoPlay} is off. The player only has to play the keys.
*/
autoScratch1P?: boolean;
/** 2P side auto-scratch (channel 26). */
autoScratch2P?: boolean;
/**
* ANY KEY (That-Which-Must-Not-Be-Named PC, #751): each press takes the nearest unjudged note in reach on any lane and
* holds that lane until its key comes up. A replay plays with its own recorded switch instead.
*/
anyKey?: boolean;
/** The player's own lane keys over the defaults (`LaneModeOptions.laneKeys`); a replay plays its recorded channels. */
laneKeys?: LaneKeyOverrides;
/** The player's own START / SELECT keys over the defaults; the play records their presses in the replay. */
controlKeys?: ControlKeyOverrides;
/** The player's own keys for the play's operations (`control-actions.ts`), over their defaults. */
actionKeys?: ControlActionOverrides;
/** The key map the play reads its keys by (the skin family's, `resolveControlScheme`). Defaults to LR2's. */
controlScheme?: ControlScheme;
/**
* beatoraja's WINDOW HOLD (#1131): until the last note the play takes START as held, so every key press also runs the
* START + key controls of {@link controlScheme}. Not in AUTO play or a replay, as beatoraja runs them in PLAY only.
*/
windowHold?: boolean;
/** The key map of the built-in skins, from which the host takes `controlScheme` on a built-in skin. */
builtInControlScheme?: ControlScheme;
/**
* DP FLIP — when true, swaps every note's 1P / 2P channel at chart-prepare time. Only DP charts have notes on both
* sides so SP charts are unaffected. Mirrors LR2's `#SRC_BUTTON,type=54`.
*/
dpFlip?: boolean;
/**
* Note-arrangement mode for the 1P keyboard lanes (`#SRC_BUTTON,type=42`). Applied at chart-prepare time so the
* shuffle is consistent across the play session — pressing F5 (restart) reuses the same `random1P` value but draws a
* fresh permutation. LR2 SCATTER avoids preceding-row destinations while respecting active long notes.
*/
hRandomThresholdBPM?: number;
randomSeed1P?: string;
randomSeed2P?: string;
randomFixedLane1P?: number;
randomFixedLane2P?: number;
lr2RandomScratch1P?: boolean;
lr2RandomScratch2P?: boolean;
random1P?: RandomMode;
/** 2P side note arrangement (`#SRC_BUTTON,type=43`). */
random2P?: RandomMode;
/**
* Replay playback: a recorded replay to re-drive instead of live keyboard input. The chart prepare skips the
* usual DP-flip / lane-shuffle passes and re-applies the RECORDED arrangement (`applyReplayArrangement`), the
* engine consumes `replay.inputs` deterministically (`PlayerOptions.replayInputs`), live lane input is ignored,
* and no new replay is recorded for the run. The chart's `#RANDOM` / `#SWITCH` lines take the log's
* `play.randomDraws`, so the replay plays the recorded branches. `prepare` rejects when the loaded chart does not
* match the log (draws that were not drawn for its control flow, a log without draws whose branches differ, or a
* different chart file).
*/
replay?: BeMusicReplay;
/**
* A replay ghost to show beside the play (`ghost/ghost.ts`): the source of the replay it plays, read while the play
* loads, and shown as {@link ghostMode} says. It is left out of a replay, a course stage and a NONSTOP run, and
* wherever its mode has no room. It only draws: the play's judging, records, replay and Leaderboard submission are
* its own.
*/
ghost?: import('./ghost/ghost.ts').GhostSource;
/**
* How the ghost shows (`ghost/ghost.ts`): `'side-playfield'` (the default) as a second playfield, `'pacemaker'` as a
* pacemaker alone (the score graph's target and the target score numbers, on every family), or `'lane-overlay'` as
* the pacemaker with the recorded inputs over the play's own lanes (drawn on the built-in family).
*/
ghostMode?: import('./ghost/ghost.ts').GhostPresentationMode;
/** Reuse the resolved chart layout while playing fresh input and recording a new replay. */
fixedArrangement?: Pick<BeMusicReplay, 'chart' | 'play'>;
/**
* Which of the view a {@link replay} recorded (`play.view` / `play.viewChanges`) it shows over the viewer's own
* settings: the hi-speed, SUDDEN+ / HIDDEN+, the lift (this scene has none to show) and the tempo. Defaults to all
* (`DEFAULT_REPLAY_PLAYBACK_OPTIONS`).
*/
replayView?: Readonly<ReplayPlaybackOptions>;
/**
* Judgment-window ruleset for the shared engine (`PlayerOptions.judgeRuleset`): `'lr2'` (default) / `'beatoraja'`
* / `'____'`. Recorded into the replay; replays re-apply the log's own value instead.
*/
judgeRuleset?: RulesetId;
/**
* SHA-256 (lowercase hex) of the source chart file bytes, when the host computed one. Stamped into the recorded
* replay (`chart.sha256`) so a dropped log can be matched back to its chart by content.
*/
chartSHA256?: string;
/** MD5 (lowercase hex) of the same bytes, stamped as `chart.md5` (the key LR2 and LR2IR use). */
chartMD5?: string;
/** Host application stamped into the recorded replay's `recorder` (the engine adds its own version). */
replayRecorder?: ReplayRecordingOptions['recorder'];
/**
* Record each controller's device name (its `Gamepad.id`) in the replay's `play.inputSources`
* (`ReplayRecordingOptions.includeDeviceNames`). Off by default: only the player turns it on, since the name can
* identify their hardware.
*/
replayDeviceNames?: boolean;
/**
* 1P gauge variant (`#SRC_BUTTON,type=40`). Selects the ruleset's gauge (the engine resolves the curve) and drives
* the gauge-on-red-branch op flags (43 / 45).
*/
gauge?: GaugePick;
/** The 2P player's gauge of a two-player play (`battleMode: 'TWO-PLAYER'`). */
gauge2P?: GaugePick;
/** That-Which-Must-Not-Be-Named M-RAN per player: MIRROR after a RANDOM-type arrangement in two-player play. */
mRan1P?: boolean;
mRan2P?: boolean;
/**
* The play is one stage of a course (`PlayerOptions.course`): it runs on the ruleset's course gauge, from the state the
* previous stage left. Recorded into the replay, which then replays on its own.
*/
course?: ReplayCourseStage;
/**
* The running course as the skin shows it — its kind, title, stage list and the stage being played (LR2 ops 280-293,
* texts 150-170; beatoraja's course strings). Display only; the judging follows {@link course}.
*/
courseInfo?: CourseView;
/**
* The chart is a stitched NONSTOP course (`stitchNonstopCourse`'s map): each stage's samples play at its FIT rate
* and its background sound fades at the stage seams.
*/
nonstop?: NonstopStitchMap;
/**
* The play tempo, 0.5 to 1.5 (`clampPlayTempo`; default 1): the play clock, its audio, the scroll, the BGA and the
* chart-time lead-out run `tempo` times as fast, while judging stays in chart time (the engine's `speed`). A replay
* plays at the tempo its log recorded (`play.tempo`) instead. A NONSTOP FIT stage's rate multiplies with it. In `pitch`
* mode it can change during the play (`PlaySession.setTempo`).
*/
tempo?: number;
/** Fires when the play tempo changed during the play (`setTempo`, or a replay following its log), with the new one. */
onTempoChange?: (tempo: number) => void;
/**
* How a tempo change sounds, for {@link tempo} and NONSTOP FIT stages alike: `pitch` (default, as LR2) plays the
* samples faster or slower, `keep-pitch` stretches them to the new tempo when they load and keeps their pitch.
*/
tempoPitchMode?: TempoPitchMode;
/** The time stretcher keep pitch uses: `signalsmith` (default, Signalsmith Stretch) or `wsola`. */
tempoStretchAlgorithm?: TimeStretchAlgorithm;
/** The hi-speed cannot be changed during play (a course's `no_speed` constraint). */
hiSpeedLocked?: boolean;
/**
* When true, every decoded sample of the chart is scaled by one gain so the loudest peak sits near −3 dBFS. Off
* when omitted: charts keep the level they were authored at. Applies as the samples load, so a change takes the
* next play. `#VOLWAV` still multiplies on top at playback.
*/
peakGain?: boolean;
/**
* When true (default), the audio bus runs through dynamics compressors that soften clipping when many BMS samples
* fire simultaneously (jacks, dense BGM stacks). Set to `false` to bypass every compressor and feed sample sources
* directly to `audioContext.destination`.
*
* Equivalent to `audioCompressorMode === 'off'` when `false`. When `true` (or omitted), the active mode comes from
* `audioCompressorMode` (defaults to `'split'`).
*/
audioCompressor?: boolean;
/**
* Compressor architecture when `audioCompressor` is enabled.
*
* - `'split'` (default) — separate compressors on the key / BGM buses plus a master limiter; key bus tuned
* aggressively for transient peaks, BGM bus tuned for musical glue, master for clip protection. Prevents BGM
* ducking under dense input bursts (a known failure mode of the legacy single-bus compressor).
* - `'legacy'` — original single-compressor topology, kept for A/B comparison via the player's `?compressor=legacy` URL
* flag so behavior can be diff-tested directly.
*
* `'off'` is reachable via `audioCompressor: false` rather than being a valid value here — `audioCompressor` is the
* user- facing toggle, this option only chooses **which** compressed topology to use when compression is on.
*/
audioCompressorMode?: 'split' | 'legacy';
/**
* Initial per-stage on/off flags for the split-bus architecture. Defaults to all `true` (every stage engaged). Hosts
* that surface a UI for per-stage bypass should pass the current UI state here so the bus comes up matching the
* visible selection — otherwise the user's stage choices on the select screen would be silently reset every gameplay
* re-mount.
*/
audioCompressorStages?: { key?: boolean; bgm?: boolean; master?: boolean };
/**
* Initial user volume per source bus — `key` (player keysounds) and `bgm` (auto-triggered BGM) — as linear gains
* (1 = unity, clamped to `0..2`). Hosts with volume sliders pass the current UI values so a re-mounted gameplay keeps
* the user's balance; `PlaySession.setAudioVolume` changes them live.
*/
audioVolumes?: { key?: number; bgm?: number };
/**
* Parameter overrides per compressor (`key` / `bgm` / `master` in split mode, `legacy`), merged over the factory
* tuning. `PlaySession.setAudioCompressorParams` retunes them live.
*/
audioCompressorParams?: Partial<Record<TunableCompressor, Partial<CompressorParams>>>;
/**
* When set to a positive integer, BGA videos that need the ffmpeg.wasm fallback (legacy `.mpg` / `.wmv` / `.avi` /
* unsupported codecs) are downscaled during transcode so neither edge exceeds this many pixels. Aspect ratio is
* preserved.
*
* Single-threaded libx264 cost scales linearly with pixel count, so capping at 720 / 480 / etc. is the biggest
* single-threaded speed lever once `-preset ultrafast` is in effect. Visual parity holds well under nearest-filter
* scaling because the BGA layer is rendered into a 256-px spec canvas.
*
* `undefined` / `0` / negative values disable the cap and the source resolution passes through unchanged (the default
* behavior).
*/
bgaTranscodeMaxLongEdgePx?: number;
/**
* When true, the BGA transcode fallback uses the browser's WebCodecs `VideoEncoder` API instead of libx264 in
* ffmpeg.wasm. The decode step still goes through ffmpeg because WebCodecs' `VideoDecoder` doesn't speak the legacy
* codecs (MPEG-1, VC-1, etc.) BMS BGA usually ships in.
*
* Hardware-accelerated where the browser exposes a platform encoder — typically a 5–20× encode-side speedup. Silently
* falls back to the ffmpeg-only path when the browser doesn't support WebCodecs, the encoder rejects the configured
* parameters, or the raw decoded frames would exceed the in-memory budget.
*/
bgaTranscodeUseWebCodecs?: boolean;
/** How much bitrate a BGA video transcode spends (libx264's `-crf`, WebCodecs' bitrate), `standard` by default. */
bgaTranscodeQuality?: BGATranscodeQuality;
/**
* Debug overlay — when true, the renderer paints a thin green bar at every invisible / keysound note's chart position
* (BMS channels `3x` / `4x`, the chart author's hidden keysound layout). The bars never affect gameplay or judgement;
* they're a chart-inspection aid for verifying which lane each `#WAV` sample is wired to. Defaults to `false` so the
* regular play surface stays uncluttered.
*/
showInvisibleNotes?: boolean;
/**
* The chart's `#RANDOM` / `#SWITCH` branches as the decide screen drew them (`DecideScene.resolved`), so the play
* plays the branches the screen showed. Without it the play draws its own; a replay always plays its log's.
*/
preResolved?: ResolvedPlayChart;
/**
* The host's audio service: the play opens its own context and bus through it (`openPlayGraph`). Without one the play
* makes them itself.
*/
audio?: AudioService;
/**
* beatoraja's GUIDE SE: the sound set's sound for each judgment, when the player turned it on. Each is decoded
* through {@link audio} as the play loads and played on the key bus at its judgment; one the set lacks is left out.
*/
guideSounds?: Partial<Record<GuideSound, SystemSound>>;
}
export interface PlayDisposeOptions {
/**
* Natural chart end can transition visually to result while a long final sample still rings out. Keep the Web Audio
* graph alive briefly in that path instead of closing the AudioContext as part of visual teardown.
*/
preserveAudioTail?: boolean;
}
|