osu-beatmap-renderer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "osu-beatmap-renderer",
3
+ "version": "0.1.0",
4
+ "description": "Standalone osu! beatmap renderer powered by PixiJS. Parses .osu files and renders hit objects with hitsounds.",
5
+ "type": "module",
6
+ "main": "dist/osu-beatmap-renderer.js",
7
+ "module": "dist/osu-beatmap-renderer.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/osu-beatmap-renderer.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "src"
16
+ ],
17
+ "scripts": {
18
+ "build": "vite build",
19
+ "dev": "vite --config vite.demo.config.js"
20
+ },
21
+ "peerDependencies": {
22
+ "pixi.js": ">=7.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "pixi.js": "^8.6.6",
26
+ "vite": "^6.3.1"
27
+ },
28
+ "keywords": [
29
+ "osu",
30
+ "beatmap",
31
+ "renderer",
32
+ "pixi",
33
+ "pixijs"
34
+ ],
35
+ "license": "MIT"
36
+ }
@@ -0,0 +1,29 @@
1
+ const DEFAULT_AUDIO_OFFSET_MS = 100;
2
+
3
+ let globalAudioOffsetMs = DEFAULT_AUDIO_OFFSET_MS;
4
+ const listeners = new Set();
5
+
6
+ export function getGlobalAudioOffsetMs() {
7
+ return globalAudioOffsetMs;
8
+ }
9
+
10
+ export function setGlobalAudioOffsetMs(ms) {
11
+ const next = Number(ms) || 0;
12
+ if (next === globalAudioOffsetMs) {
13
+ return;
14
+ }
15
+ globalAudioOffsetMs = next;
16
+ for (const listener of listeners) {
17
+ listener(globalAudioOffsetMs);
18
+ }
19
+ }
20
+
21
+ export function subscribeGlobalAudioOffset(listener) {
22
+ if (typeof listener !== "function") {
23
+ return () => {};
24
+ }
25
+ listeners.add(listener);
26
+ return () => {
27
+ listeners.delete(listener);
28
+ };
29
+ }