@korial29/tiny-fps 0.197.0 → 0.198.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.
@@ -2,7 +2,7 @@ import type { Vec3 } from './mesh';
2
2
  import type { Voice } from './sfx';
3
3
  /** A sound that plays on and on, started on its first set. */
4
4
  export interface Loop {
5
- /** Volume and speed (pitch) to move to, eased over a fraction of a second: 0 is silence. */
5
+ /** Volume (a fader, 0 silence and 1 its level) and speed (pitch) to move to, eased over a fraction of a second. */
6
6
  set(volume: number, rate: number): void;
7
7
  }
8
8
  export interface Audio {
@@ -14,11 +14,11 @@ export interface Audio {
14
14
  /** Where the listener is and looks, each frame (yaw as a player's: 0 looks toward -z). */
15
15
  listen(eye: Vec3, yaw: number): void;
16
16
  /**
17
- * Plays the sound `id` (an index into the layers). With `at`, panned left or right by its direction from the listener and
18
- * fainter with distance; without, centred (the own player's sounds). `gain` scales the volume,
19
- * `rate` the speed and so the pitch; over the `radio` as speak() says a line.
17
+ * Plays the sound `id` (an index into the layers). With `at`, placed where it is round the
18
+ * listener and fainter with distance; without, centred (the own player's sounds). `db` is added
19
+ * to its level, `rate` is the speed and so the pitch; over the `radio` as speak() says a line.
20
20
  */
21
- play(id: number, at?: Vec3, gain?: number, rate?: number, radio?: boolean): void;
21
+ play(id: number, at?: Vec3, db?: number, rate?: number, radio?: boolean): void;
22
22
  /**
23
23
  * Says the announcer's line `id` (LINE), centred, the music lowered under it. Lines wait their
24
24
  * turn, two at most and each once; none before the voice is decoded, a moment after unlock.
@@ -30,7 +30,7 @@ export interface Audio {
30
30
  * of squelch before and after it and a hiss under it. False, and silent, until the voices are
31
31
  * decoded.
32
32
  */
33
- speak(id: number, at?: Vec3, gain?: number, rate?: number, radio?: boolean): boolean;
33
+ speak(id: number, at?: Vec3, db?: number, rate?: number, radio?: boolean): boolean;
34
34
  /** The sound `id` (one of LOOPED) as a loop, silent until its first set; the own player's, centred. */
35
35
  loop(id: number): Loop;
36
36
  /** Mutes or unmutes everything, music included. */
@@ -39,6 +39,21 @@ export interface Audio {
39
39
  /** Stops the music and closes the AudioContext. */
40
40
  destroy(): void;
41
41
  }
42
+ /** A level in dB as a gain, and back. */
43
+ export declare const gain: (db: number) => number;
44
+ export declare const db: (g: number) => number;
45
+ /**
46
+ * The mix (the user, 2026-11-20, by ear in the menu's Audio panel): a bus per group of sounds, its
47
+ * level in dB, in LEVELS' order: voices (the announcer, the players' lines and cries), moves,
48
+ * weapons, vehicles and the world, the helmet's breath, the game's events and pickups, then the
49
+ * music. GROUP is each sound's bus, in SOUND order; LOUD a sound's own level over its bus, 0 dB
50
+ * when absent. The game menu's Audio panel changes them for this browser (mix()).
51
+ */
52
+ export declare const LEVELS: number[];
53
+ export declare const LOUD: Record<number, number>;
54
+ export declare const GROUP = "111111111155552022225522222222222222222233344333333333005533002200120120002000";
55
+ /** Sets bus `i` to `db` live, and keeps the mix for the next visit; none, the mix as made. */
56
+ export declare const mix: (i?: number, db?: number) => void;
42
57
  /**
43
58
  * The announcer's sprite (voice/clips.ts), each as base64 and loaded only when asked for: Ogg Opus,
44
59
  * then MP3 where the browser cannot decode the first (older Safari).
@@ -7,6 +7,8 @@ export declare const HUD_CSS: string;
7
7
  export declare const PAUSE: string[];
8
8
  /** The tabs of the title screen's menu, the first one shown first. */
9
9
  export declare const TABS: string[];
10
+ /** The Audio panel's sliders (the user, 2026-11-20): a name, and its bus in LEVELS (audio.ts). */
11
+ export declare const MIXES: [name: string, bus: number][];
10
12
  /** The characters' first names (the user, 2026-11-11: names, not "man" and "woman"), in BODY's order, and the size of the character's picture in pixels. */
11
13
  export declare const CAST: string[];
12
14
  export declare const SHOT: number[];
@@ -40,7 +40,7 @@ export interface Stage {
40
40
  spit(at: Vec3): void;
41
41
  };
42
42
  audio: {
43
- play(id: number, at?: Vec3, gain?: number, rate?: number): void;
43
+ play(id: number, at?: Vec3, db?: number, rate?: number): void;
44
44
  };
45
45
  fx: {
46
46
  quake(k: number): void;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.197.0",
5
+ "version": "0.198.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"