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 | import { monitorFrameRate } from '../../pane-controls.ts';
import { getBrowserWorkerCount, setBrowserWorkerCount } from '@be-music/player-browser/compute';
import { storeWorkerCount } from '../../worker-settings.ts';
// The Options dialog's Advanced folder. It is built with the dialog as `this` (`OptionsDialog`).
import type { OptionsDialog } from './index.ts';
import { buildBGATranscodeFolder } from './library.ts';
/**
* Diagnostics, session behaviour and the BGA transcode, which most players never touch, plus the reset for every
* remembered setting.
*/
export function buildDeveloperFolder(this: OptionsDialog): void {
const compute = { workers: getBrowserWorkerCount() };
this.place('workers')
.addBinding(compute, 'workers', {
label: 'CPU workers',
min: 1,
max: Math.max(1, navigator.hardwareConcurrency || 2),
step: 1,
})
.on('change', ({ value: count }) => {
setBrowserWorkerCount(count);
try {
storeWorkerCount(globalThis.localStorage, getBrowserWorkerCount());
} catch {
/* Storage can be disabled. */
}
});
this.place('autoPauseOnBlur')
.addBinding(this.guiState, 'autoPauseOnBlur', { label: 'Auto pause on blur' })
.on('change', ({ value }) => {
this.guiState.autoPauseOnBlur = value;
// Push live so a chart already in flight starts honoring the new policy on its next visibility / blur event,
// without forcing the user to restart the chart.
this.gameplayView?.setAutoPauseOnBlur(value);
});
this.fpsOverlayController = this.place('showFPS')
.addBinding(this.guiState, 'showFPS', { label: 'Show FPS' })
.on('change', ({ value }) => this.deps.showFPSOverlay(value));
// Native monitor samples the scene clock and keeps a bounded FPS history.
const sceneHost = this.sceneHost;
const stats = {
get fps(): number {
return monitorFrameRate(sceneHost.app.ticker);
},
};
this.place('fps').addBinding(stats, 'fps', {
label: 'FPS',
readonly: true,
view: 'graph',
min: 0,
max: 240,
interval: 500,
bufferSize: 60,
});
buildBGATranscodeFolder.call(this);
this.place('resetSettings')
.addButton({ title: 'Reset settings and reload' })
.on('click', () => {
void this.resetSettings();
});
}
|