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 | import type { LaneKeyOverrides } from '@be-music/player-engine/lanes';
import type { ControlActionOverrides, ControlKeyOverrides, ControlScheme } from '@be-music/player-browser/host';
import type { DecideScene, PlayScene, ResultScene, SelectScene } from '@be-music/player-browser/host';
import type { SkinFamilyId } from '@be-music/player-browser/skin';
import type { ReplayPlaybackOptions } from '@be-music/player-engine/replay';
import type { GaugePick, RulesetId } from '@be-music/player-engine/ruleset';
import type { BrowseSort, DifficultyFilter, KeysFilter, HSFix, PlayOptions } from '@be-music/player-scene-model';
import type { PlayTempoSettings } from './play-tempo-settings.ts';
import type { ReplayAutoSaveRule } from './services/replay-slots.ts';
import type { LeaderboardSubmitRule } from './leaderboard-submit-rule.ts';
/** Every screen the player shows, each made by its `create*Scene`. */
export type PlayerScene = SelectScene | DecideScene | PlayScene | ResultScene;
/**
* DOM handles passed into the `PlayerWebApp` constructor. The lookups happen once at boot in `main.ts`; the app
* stores the references on `this.elements` and reads them throughout the session.
*/
export interface PlayerWebElements {
stage: HTMLDivElement;
shell: HTMLDivElement;
/**
* Hidden `<input type="file" webkitdirectory>` the Options dialog's "Open folder" button clicks. The DOM element stays
* for the session, so its `change` listener stays bound however the dialog's controls are rebuilt (theme changes).
*/
chartInput: HTMLInputElement;
/**
* Hidden `<input type="file" multiple>` behind the Options dialog's "Open files" button: ZIP archives and replays, which
* the folder picker (`chartInput`) can't select.
*/
filesInput: HTMLInputElement;
/**
* Floating DOM `<input>` overlay positioned near the LR2 default skin's search-text rect. Focus is given to it when
* the user clicks the skin's `#SRC_TEXT,st=30,edit=1` region or hits the `/` shortcut; typing into it filters the
* song list via the select scene's `setSearch`.
*/
searchInput: HTMLInputElement;
/**
* Centered overlay shown while a dropped folder / ZIP is being read + parsed. Toggled via the `.visible` class so CSS
* controls the fade-in / fade-out, and the `aria-hidden` attribute mirrors the visibility for screen readers.
*/
loadingOverlay: HTMLDivElement;
loadingLabel: HTMLDivElement;
loadingBarFill: HTMLElement;
loadingCounter: HTMLDivElement;
}
/**
* User-facing skin-family selection. Mirrors the package's {@link SkinFamilyId} plus an extra `'auto'` sentinel that
* means "let the player pick automatically based on what's loaded". The auto branch's policy is documented on
* `PlayerWebApp.pickActiveFamilyForScene`.
*/
export type SkinFamilyOverride = SkinFamilyId | 'auto';
/**
* The four scene kinds the family-routing helper dispatches over. Used as the `scene` argument of
* `PlayerWebApp.availableFamiliesForScene` / `PlayerWebApp.pickActiveFamilyForScene` — passing
* the kind lets the helpers consult the right per-skin slots (`decideSkin` only for decide, `selectSkin` only for
* select, etc.) without N copy-pasted callers each computing the predicate locally.
*/
export type SkinFamilySceneKind = 'select' | 'decide' | 'gameplay' | 'result';
/**
* Plain-data state object backing the Options dialog's controls. Each key matches a control; reads / writes go through the
* same `state.foo` reference so a programmatic update (e.g. `setAudioCompressor` triggered by a URL flag) can call
* `controller.refresh()` and the dialog reflects the new value. Function members are bound to the host so `this` keeps
* its meaning when a button invokes them.
*/
export interface PlayerGUIState extends PlayTempoSettings {
autoPlay: boolean;
/** Id of the Be-Music Skin the default (no-theme) family renders with. Persisted in `localStorage`. */
builtInSkin: string;
/** Showmanship level for the built-in skins. Persisted in `localStorage`. */
skinEffects: 'full' | 'reduced' | 'off';
/**
* Render resolution (canvas pixels per CSS pixel), one of 0.5×, 0.75×, then 1× up to the display's `devicePixelRatio` in 0.5 steps;
* 1.5× until picked. Persisted in `localStorage`.
*/
renderResolution: number;
/** Gameplay layout pick: `'auto'` follows the device (touch layout on phones / tablets). Persisted in `localStorage`. */
playLayout: 'auto' | 'standard' | 'touch';
/** Renderer: WebGL 2 (the default) or WebGPU. Persisted in `localStorage`; takes effect on the next load. */
renderer: 'webgl' | 'webgpu';
/**
* When true, gameplay auto-pauses on tab visibility change / window blur and auto-resumes on focus. False (the
* default) keeps the play scene running in the background — convenient for capturing recordings while another window
* holds focus.
*/
autoPauseOnBlur: boolean;
showFPS: boolean;
/** Master volume in percent (0..100) over every sound the player makes, applied live and remembered across reloads. */
masterVolume: number;
/** Silence every sound while retaining the master volume setting. Persisted in localStorage. */
muted: boolean;
/** Keysound bus volume in percent (0..100), pushed live to gameplay and remembered across reloads. */
keyVolume: number;
/** BGM bus volume in percent (0..100), pushed live to gameplay and remembered across reloads. */
bgmVolume: number;
/**
* Ask the platform audio session for `'playback'` so sound plays with the iPhone / iPad silent switch on (pausing other
* apps' music). Off by default; only offered where `navigator.audioSession` exists. Remembered across reloads.
*/
playInSilentMode: boolean;
/**
* When true, the next play scales every decoded sample by one gain so the loudest peak sits near −3 dBFS. Off by
* default. Remembered with the other Options dialog settings. Takes the next play, not the one already loaded.
*/
peakGain: boolean;
compressor: boolean;
compressorKey: boolean;
compressorBGM: boolean;
compressorMaster: boolean;
/**
* Pixel cap for the longest edge of BGA videos that need the ffmpeg.wasm transcode fallback. Single-threaded libx264
* cost is linear in pixel count, so capping the long edge is the biggest single-threaded encode-time lever — at the
* cost of a (usually imperceptible) reduction in BGA texture sharpness.
*
* `0` is the special "Off" value: no resize happens and the source resolution passes through unchanged. Off by
* default so the BMS-author resolution is preserved unless the user explicitly opts in via the GUI dropdown. Any
* positive value activates the resize path with that pixel cap; the `Math.max` guard at the consumer side rejects
* accidental negatives.
*/
bgaResizeMaxEdgePx: number;
/**
* When true, BGA transcoding uses the browser's WebCodecs `VideoEncoder` (hardware-accelerated where supported)
* instead of the libx264 wasm encoder. Decoding still goes through ffmpeg.wasm because WebCodecs' decoder doesn't
* speak the legacy MPEG-1 / VC-1 codecs BMS BGA usually ships in.
*
* Forced to `false` and disabled in the GUI when the browser doesn't expose `VideoEncoder` (Safari < 17, older
* Firefox builds). Ignored at runtime if the encoder rejects the configured parameters or the raw decoded frames
* would blow the memory budget — the transcode then silently falls back to the ffmpeg encode path.
*/
bgaUseWebCodecs: boolean;
/** "Quality" of the BGA video transcode: the bitrate it spends (`low`, `standard`, `high`, `very-high`). */
bgaTranscodeQuality: import('@be-music/player-browser/recording').RecordingQuality;
/**
* Debug overlay — when true, every invisible / keysound note the chart authors on channels `3x` / `4x` paints as the
* 9-keys POP green note (or a flat green bar fallback) in its assigned playable lane during gameplay. Useful for
* verifying which lane each `#WAV` sample is wired to without affecting scoring or judgement. Defaults to false so
* the regular play surface stays uncluttered.
*
* Live-toggleable — the gameplay view always extracts the invisible-note array and preloads the green sprite at
* chart-prepare time, so flipping the flag mid-song flips the per-frame render branch on the very next paint.
*/
showInvisibleNotes: boolean;
/**
* Guide: STOP, SCROLL and SPEED: labels on STOPs and on Be-Music's `#SCROLL` and `#SPEED` changes. Viewing
* preferences, live during a play; they change no record or replay. Guide: BPM is the play option `bpmGuide`.
*/
guideStop: boolean;
guideScroll: boolean;
guideSpeed: boolean;
/**
* The replay ghost shown with the play (`services/ghost.ts`): `'OFF'` (default), or the replay it plays — `'OWN_BEST'`
* (the player's best on the chart), a replay slot, the Leaderboard's top run, or a picked replay file. Latched at song
* start.
*/
ghost: import('./services/ghost.ts').GhostSourceSetting;
/**
* How the ghost shows (`services/ghost.ts`): `'PLAYFIELD'` (default, a second playfield on the built-in skins),
* `'PACEMAKER'` (a pacemaker alone, on every family) or `'LANE_OVERLAY'` (the pacemaker with the recorded inputs over
* the player's own lanes, on the built-in skins). Latched at song start.
*/
ghostMode: import('./services/ghost.ts').GhostModeSetting;
/**
* When true (off by default), the replay (`*.bmplay.json` input replay — see `@be-music/player-engine/replay`) recorded
* during gameplay is automatically downloaded the moment the result scene mounts, for both the LR2/default and
* beatoraja result paths. Toggled from the Options dialog's "Auto-save replays" checkbox.
*/
autoSaveReplay: boolean;
/**
* When true (off by default), a recorded replay keeps each controller's device name (its `Gamepad.id`, which often
* names the vendor and product ids) in `play.inputSources`, wherever the replay goes: saved files, replay slots and
* Leaderboard submissions. Toggled from the Options dialog's "Record device names in replays" checkbox; latched at
* song start.
*/
replayDeviceNames: boolean;
/**
* Whether a Bemuse server song plays at the volume its ReplayGain (`replaygain` in the server's index) sets, as
* Bemuse plays it. On by default; off plays the charts at their own `#VOLWAV`. Read as a play starts.
*/
bemuseReplayGain: boolean;
/**
* Each replay slot's auto-save rule (beatoraja's `autosavereplay`), applied as a result opens against the best record
* before the play (`DEFAULT_REPLAY_AUTO_SAVE_RULES` until the player picks others); `never` leaves the slot to be
* saved by hand.
*/
replaySlotAutoSave1: ReplayAutoSaveRule;
replaySlotAutoSave2: ReplayAutoSaveRule;
replaySlotAutoSave3: ReplayAutoSaveRule;
replaySlotAutoSave4: ReplayAutoSaveRule;
/**
* In a course, go straight on to the next stage instead of showing each stage's result (the course result still
* shows at the end). False (the default) shows every stage's result, as LR2 and beatoraja do.
*/
courseAutoAdvance: boolean;
/**
* How a NONSTOP course places its stages: `'intended'` (the default) as LR2's loader means to, `'lr2'` exactly as
* LR2's binary does, including its third-stage start offset (`planNonstopCourse`).
*/
nonstopPlacement: 'intended' | 'lr2';
/**
* Which of what a replay recorded the player seeing a replay or ghost reproduces (tempo, hi-speed, SUDDEN+ /
* HIDDEN+, LIFT), the rest staying the viewer's own: the Options dialog's "Play options / Replay / ghost" toggles, all on
* by default, remembered across visits and latched at song start.
*/
replayView: ReplayPlaybackOptions;
/** `tempoEnabled` / `tempoPercent` / `tempoPitchMode` / `tempoStretchAlgorithm`: see {@link PlayTempoSettings}. */
/**
* When true (off by default), every finished play is sent to the Leaderboard when the result scene mounts — signing
* in anonymously the first time (docs/leaderboard.md). Toggled from the Options dialog's "Submit to Leaderboard"
* checkbox and latched at song start like the auto-save.
*/
submitToLeaderboard: boolean;
/**
* When a finished play is sent once {@link submitToLeaderboard} is on (`LeaderboardSubmitRule`): only when its EX-SCORE
* beats the player's own best on the chart, the chart's first play included (default), or always. Latched at song
* start with the toggle. Course runs are always sent.
*/
leaderboardSubmitRule: LeaderboardSubmitRule;
/**
* The compat ruleset the shared engine judges under (`PlayerOptions.judgeRuleset`): LR2 (default) / beatoraja / That-Which-Must-Not-Be-Named.
* It owns every judge rule: the windows, note selection, empty POOR, the long-note style, the gauge and the score.
* Latched at song start (the Play options folder is disabled during a play) and recorded into the replay.
*/
judgeRuleset: RulesetId;
/**
* Hi-speed (note scroll multiplier) the next play starts at. Two-way synced with the LR2 select panel's HS and the
* in-game `ArrowUp` / `ArrowDown` keys, applied live to a running play when changed here, and remembered across
* reloads.
*/
hiSpeed: number;
hsFix: HSFix;
displayAreaInfo: PlayOptions['displayAreaInfo'];
bga: PlayOptions['bga'];
bgaSize: PlayOptions['bgaSize'];
scoreGraph: boolean;
hiddenSudden1P: PlayOptions['hiddenSudden1P'];
hiddenSudden2P: PlayOptions['hiddenSudden2P'];
laneCover: PlayOptions['laneCover'];
shutter: PlayOptions['shutter'];
/**
* Gauge for the next play: the judge ruleset's own (`HARD`) or another source's, qualified (`lr2:HARD`, ADR 0019).
* Two-way synced with the LR2 select scene's PLAY OPTION panel.
*/
gauge: GaugePick;
/** 1P lane arrangement for the next play. Two-way synced with the LR2 select panel. */
hRandomThresholdBPM: number;
randomSeed1P: string;
randomSeed2P: string;
randomFixedLane1P: number;
randomFixedLane2P: number;
lr2RandomScratch1P: boolean;
lr2RandomScratch2P: boolean;
random1P: PlayOptions['random1P'];
/** 2P lane arrangement for the next play. Two-way synced with the LR2 select panel. */
random2P: PlayOptions['random1P'];
/** DP FLIP for the next play. Two-way synced with the LR2 select panel. */
dpFlip: boolean;
/** 1P auto scratch for the next play. Two-way synced with the LR2 select panel. */
classicHiSpeed: boolean;
floatingHiSpeed: boolean;
fixedDisplayArea: boolean;
normalHiSpeedLevel: number;
judgeTimingMs: number;
visualConstant: boolean;
lift1P: number;
lift2P: number;
liftOn1P: boolean;
liftOn2P: boolean;
noteDurationMs: number;
constantFadeMs: number;
bpmGuide: boolean;
bpmChangeWarning: boolean;
guideSE: PlayOptions['guideSE'];
windowHold: PlayOptions['windowHold'];
judgeCounts: PlayOptions['judgeCounts'];
judgeDetailSplit: PlayOptions['judgeDetailSplit'];
judgeDetail: PlayOptions['judgeDetail'];
scoreTargetRate: PlayOptions['scoreTargetRate'];
judgePosition: PlayOptions['judgePosition'];
judgeDisplay: PlayOptions['judgeDisplay'];
laneBrightness: PlayOptions['laneBrightness'];
scoreTarget: PlayOptions['scoreTarget'];
markProcessedNotes: PlayOptions['markProcessedNotes'];
showJudgeArea: PlayOptions['showJudgeArea'];
lr2AddMines: PlayOptions['lr2AddMines'];
lr2AddLongNotes: PlayOptions['lr2AddLongNotes'];
lr2Loudness: PlayOptions['lr2Loudness'];
lr2AddNotes: PlayOptions['lr2AddNotes'];
lr2Gambol: PlayOptions['lr2Gambol'];
lr2SideJump: PlayOptions['lr2SideJump'];
lr2SpiralEffect: PlayOptions['lr2SpiralEffect'];
lr2Wave: PlayOptions['lr2Wave'];
lr2SinCurve: PlayOptions['lr2SinCurve'];
lr2Nabeatsu: PlayOptions['lr2Nabeatsu'];
lr2Heartbeat: PlayOptions['lr2Heartbeat'];
lr2Char: PlayOptions['lr2Char'];
lr2SuperLoop: PlayOptions['lr2SuperLoop'];
lr2Tornado: PlayOptions['lr2Tornado'];
lr2Earthquake: PlayOptions['lr2Earthquake'];
lr2Acceleration: PlayOptions['lr2Acceleration'];
autoScratchNotes: PlayOptions['autoScratchNotes'];
judgeTimingAutoAdjust: PlayOptions['judgeTimingAutoAdjust'];
judgeAlgorithm: PlayOptions['judgeAlgorithm'];
longNoteModifier: PlayOptions['longNoteModifier'];
longNoteRate: number;
extraNoteDepth: number;
extraNoteScratch: boolean;
sevenToNinePattern: PlayOptions['sevenToNinePattern'];
sevenToNineType: PlayOptions['sevenToNineType'];
battleMode: PlayOptions['battleMode'];
dBattleScratch: boolean;
gauge2P: PlayOptions['gauge2P'];
mRan1P: boolean;
mRan2P: boolean;
longNoteMode: PlayOptions['longNoteMode'];
customJudge: boolean;
practice: boolean;
practiceGauge: PlayOptions['practiceGauge'];
practiceGaugeCategory: PlayOptions['practiceGaugeCategory'];
practiceStartGauge: number;
practiceJudgeRank: number;
practiceTotal: number;
practiceRestBefore: number;
practiceRestAfter: number;
practiceCarriedLongNotes: boolean;
customJudgeKeyPerfectGreat: number;
customJudgeKeyGreat: number;
customJudgeKeyGood: number;
customJudgeScratchPerfectGreat: number;
customJudgeScratchGreat: number;
customJudgeScratchGood: number;
customJudgeLongNoteMargin: number;
lr2ExtraMode: boolean;
lr2ExtraLevel: PlayOptions['lr2ExtraLevel'];
mineModifier: PlayOptions['mineModifier'];
crazyJudge: PlayOptions['crazyJudge'];
crazyHellJudge: boolean;
crazyAddMine: boolean;
crazyNotes: PlayOptions['crazyNotes'];
scrollModifier: PlayOptions['scrollModifier'];
scrollSection: number;
scrollRate: number;
gaugeAutoShift: PlayOptions['gaugeAutoShift'];
bottomShiftableGauge: PlayOptions['bottomShiftableGauge'];
bmsonTotalMode: PlayOptions['bmsonTotalMode'];
autoScratch1P: boolean;
/** 2P auto scratch for the next play. Two-way synced with the LR2 select panel. */
autoScratch2P: boolean;
/**
* ANY KEY (That-Which-Must-Not-Be-Named PC, #751) for the next play: each press takes the nearest note on any lane.
* Offered with the `____` judge rules only; a play with it saves no record.
*/
anyKey: boolean;
/** The player's own lane keys over the defaults (Options → Keys, `lane-keys.ts`); read as each play starts. */
laneKeys: LaneKeyOverrides;
/** The player's own START / SELECT keys over the defaults (Options → Keys, `control-keys.ts`). */
controlKeys: ControlKeyOverrides;
/** The key map the built-in skins' screens read: LR2's or beatoraja's (Options → Keys). */
builtInControlScheme: ControlScheme;
/** The player's own keys for the screens' operations (Options → Keys, `control-keys.ts`). */
actionKeys: ControlActionOverrides;
/**
* The built-in and LR2 select screens' sort, key filter and difficulty filter. Two-way synced with an LR2 select
* skin's sort and filter buttons; the beatoraja select screen has its own MODE and SORT buttons.
*/
sort: BrowseSort;
keysFilter: KeysFilter;
difficultyFilter: DifficultyFilter;
/**
* Explicit skin-family override picked from the Options dialog dropdown. `'auto'` (default) keeps the legacy
* priority — beatoraja if a beatoraja theme is loaded and covers the chart, otherwise LR2 (which itself falls
* back to the default family per-scene when the corresponding LR2 skin isn't loaded). Any other value forces
* that family on every scene; unavailable scenes for the chosen family fall through to the default family
* (= built-in chrome) rather than silently using the unselected family.
*
* The dropdown rebuilds its option list whenever a theme load completes so `'lr2'` / `'beatoraja'` only show
* up when the corresponding theme is present. When the user's pick becomes unavailable mid-session (e.g.
* they had LR2 selected then dropped a beatoraja-only theme that wiped the LR2 state), `PlayerWebApp.rebuildSkinFamilyPicker`
* silently resets to `'auto'` so the GUI never displays an unhonorable value.
*/
confirmDroppedSkin: boolean;
skipDroppedSkin: boolean;
skinFamilyOverride: SkinFamilyOverride;
/**
* Read-only status text (loading summaries, "Playing: …", recording state, etc.). Bound to a disabled string
* controller so users can copy it out of the GUI but can't edit it. The runtime updates this via `setStatus`
* which also pushes the new value into the controller.
*/
status: string;
/** Triggered by clicking the GUI's "Open folder" button. */
openFolder: () => void;
/** Triggered by clicking the GUI's "Open files" button (ZIP archives / replays). */
openFiles: () => void;
/** "Video format": the container and codec of recordings, as `mp4/avc` / `webm/vp9` (`recording-format-choice.ts`). */
recordingFormat: string;
/** "Video quality": the bitrates recordings are made at (`low`, `standard`, `high`, `very-high`). */
recordingQuality: import('@be-music/player-browser/recording').RecordingQuality;
/** Triggered by clicking the GUI's record toggle. */
record: () => void;
/** Triggered by clicking the GUI's "Screenshot" button. Captures the Pixi stage at its native size. */
screenshot: () => void;
}
|