melonjs 19.4.0 → 19.6.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.
Files changed (81) hide show
  1. package/README.md +18 -2
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/settings.d.ts +25 -2
  4. package/build/application/settings.d.ts.map +1 -1
  5. package/build/audio/audio.d.ts +77 -253
  6. package/build/audio/audio.d.ts.map +1 -1
  7. package/build/audio/backend.d.ts +121 -0
  8. package/build/audio/backend.d.ts.map +1 -0
  9. package/build/audio/playback.d.ts +157 -0
  10. package/build/audio/playback.d.ts.map +1 -0
  11. package/build/audio/procedural.d.ts +105 -0
  12. package/build/audio/procedural.d.ts.map +1 -0
  13. package/build/audio/types.d.ts +205 -0
  14. package/build/audio/types.d.ts.map +1 -0
  15. package/build/index.d.ts +6 -3
  16. package/build/index.d.ts.map +1 -1
  17. package/build/index.js +2447 -396
  18. package/build/index.js.map +4 -4
  19. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  20. package/build/level/tiled/TMXTileset.d.ts +12 -0
  21. package/build/level/tiled/TMXTileset.d.ts.map +1 -1
  22. package/build/level/tiled/factories/shape.d.ts +1 -1
  23. package/build/level/tiled/factories/shape.d.ts.map +1 -1
  24. package/build/level/tiled/factories/tile.d.ts.map +1 -1
  25. package/build/loader/loader.d.ts +2 -2
  26. package/build/loader/loader.d.ts.map +1 -1
  27. package/build/loader/parsers/aseprite.d.ts +37 -0
  28. package/build/loader/parsers/aseprite.d.ts.map +1 -0
  29. package/build/physics/adapter.d.ts +560 -0
  30. package/build/physics/adapter.d.ts.map +1 -0
  31. package/build/physics/bounds.d.ts +18 -5
  32. package/build/physics/bounds.d.ts.map +1 -1
  33. package/build/physics/builtin/body.d.ts +605 -0
  34. package/build/physics/builtin/body.d.ts.map +1 -0
  35. package/build/physics/builtin/builtin-adapter.d.ts +91 -0
  36. package/build/physics/builtin/builtin-adapter.d.ts.map +1 -0
  37. package/build/physics/builtin/detector.d.ts +167 -0
  38. package/build/physics/builtin/detector.d.ts.map +1 -0
  39. package/build/physics/builtin/quadtree.d.ts +112 -0
  40. package/build/physics/builtin/quadtree.d.ts.map +1 -0
  41. package/build/physics/builtin/raycast.d.ts +4 -0
  42. package/build/physics/builtin/raycast.d.ts.map +1 -0
  43. package/build/physics/{sat.d.ts → builtin/sat.d.ts} +7 -7
  44. package/build/physics/builtin/sat.d.ts.map +1 -0
  45. package/build/physics/world.d.ts +61 -26
  46. package/build/physics/world.d.ts.map +1 -1
  47. package/build/renderable/collectable.d.ts +7 -1
  48. package/build/renderable/collectable.d.ts.map +1 -1
  49. package/build/renderable/container.d.ts +0 -13
  50. package/build/renderable/container.d.ts.map +1 -1
  51. package/build/renderable/renderable.d.ts +78 -17
  52. package/build/renderable/renderable.d.ts.map +1 -1
  53. package/build/renderable/trigger.d.ts +14 -1
  54. package/build/renderable/trigger.d.ts.map +1 -1
  55. package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
  56. package/build/system/timer.d.ts +0 -5
  57. package/build/system/timer.d.ts.map +1 -1
  58. package/build/video/canvas/canvas_renderer.d.ts +0 -130
  59. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  60. package/build/video/renderer.d.ts +111 -0
  61. package/build/video/renderer.d.ts.map +1 -1
  62. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  63. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  64. package/build/video/webgl/effects/shine.d.ts +87 -0
  65. package/build/video/webgl/effects/shine.d.ts.map +1 -0
  66. package/build/video/webgl/glshader.d.ts +46 -16
  67. package/build/video/webgl/glshader.d.ts.map +1 -1
  68. package/build/video/webgl/shadereffect.d.ts +23 -4
  69. package/build/video/webgl/shadereffect.d.ts.map +1 -1
  70. package/build/video/webgl/utils/uniforms.d.ts +8 -0
  71. package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
  72. package/build/video/webgl/webgl_renderer.d.ts +0 -106
  73. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  74. package/package.json +1 -1
  75. package/build/physics/body.d.ts +0 -351
  76. package/build/physics/body.d.ts.map +0 -1
  77. package/build/physics/detector.d.ts +0 -72
  78. package/build/physics/detector.d.ts.map +0 -1
  79. package/build/physics/quadtree.d.ts +0 -69
  80. package/build/physics/quadtree.d.ts.map +0 -1
  81. package/build/physics/sat.d.ts.map +0 -1
package/README.md CHANGED
@@ -62,12 +62,17 @@ Graphics
62
62
 
63
63
  Sound
64
64
  - Web Audio support with 3D spatial audio and stereo panning based on [Howler](https://howlerjs.com)
65
+ - Built-in procedural audio primitives (envelope-shaped oscillators, white/pink/brown noise) for SFX without sample assets
66
+ - Direct `AudioContext` / master-gain accessors for custom WebAudio graphs that mix with the engine's master volume / mute
65
67
 
66
68
  Physics
67
69
  - Polygon (SAT) based collision algorithm for accurate detection and response
68
- - Fast Broad-phase collision detection using spatial partitioning (QuadTree)
70
+ - Fast broad-phase collision detection using spatial partitioning (QuadTree)
71
+ - Raycast and AABB region queries with precise entry geometry
72
+ - Collision lifecycle hooks on every `Renderable`
69
73
  - Collision filtering for optimized automatic collision detection
70
74
  - Multiple shapes per body for complex hitboxes
75
+ - Pluggable `PhysicsAdapter` interface for custom physics via official adapters
71
76
 
72
77
  Input
73
78
  - Mouse and Touch device support (with mouse emulation)
@@ -93,6 +98,7 @@ Level Editor
93
98
  - Multiple layers with per-layer alpha, tinting and blend modes (multiple background/foreground, collision and Image layers)
94
99
  - Parallax scrolling via Image layers, with parallax origin support
95
100
  - Animated and multiple Tileset support, tile sub-rectangles, embedded base64 images
101
+ - Native `.aseprite` / `.ase` tileset images (Tiled 1.11+ qaseprite plugin workflow), with frame tags auto-mapped to per-tile animations — no PNG export step required
96
102
  - Tileset transparency settings
97
103
  - Rectangle, Ellipse, Polygon, Polyline and Capsule (round-rect) object shapes
98
104
  - Tiled Objects with custom properties (string, number, boolean, color, file, object, list/array and class-typed)
@@ -106,7 +112,7 @@ Level Editor
106
112
  Assets
107
113
  - Asynchronous asset loading with progress tracking
108
114
  - A fully customizable preloader
109
- - Support for images, JSON, TMX/TSX, audio, video, binary and fonts
115
+ - Support for images, JSON, TMX/TSX, `.aseprite` / `.ase` binary, audio, video, binary and fonts
110
116
 
111
117
  Core
112
118
  - `Application` class as the modern entry point with built-in pause, resume, and `freeze()` (hit-stop) primitives
@@ -212,9 +218,19 @@ Here is the list of official plugins maintained by the melonJS team:
212
218
  - [debug-plugin](https://github.com/melonjs/melonJS/tree/master/packages/debug-plugin) - a debug panel for inspecting game objects
213
219
  - [tiled-inflate-plugin](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) - enable loading and parsing of zlib, gzip and zstd compressed [Tiled](https://www.mapeditor.org/) maps
214
220
  - [spine-plugin](https://github.com/melonjs/melonJS/tree/master/packages/spine-plugin) - [Spine](http://esotericsoftware.com) runtime integration to render Spine skeletal animations
221
+ - [capacitor-plugin](https://github.com/melonjs/melonJS/tree/master/packages/capacitor-plugin) - bridges [Capacitor](https://capacitorjs.com/)'s native lifecycle (pause/resume, hardware back-button, orientation lock, splash) for melonJS games wrapped as iOS / Android apps
215
222
 
216
223
  If you wish to develop your own plugin, we also provide a [plugin template](https://github.com/melonjs/plugin-template) to help you get started.
217
224
 
225
+ Physics Adapters
226
+ -------------------------------------------------------------------------------
227
+ Since 19.5, melonJS exposes a `PhysicsAdapter` interface so the same game code can run on either the built-in SAT physics (default) or a third-party rigid-body engine, selected via the `physic` option on `Application`. Two official adapter packages, maintained by the melonJS team:
228
+
229
+ - **[@melonjs/matter-adapter](https://github.com/melonjs/melonJS/tree/master/packages/matter-adapter)** — [matter-js](https://brm.io/matter-js/) integration. Rotational dynamics, constraints (springs / hinges / pins), sleeping bodies, continuous collision detection, raycasts. Showcased by the [Matter Platformer](https://melonjs.github.io/melonJS/examples/#/platformer-matter) and [Pool (Matter)](https://melonjs.github.io/melonJS/examples/#/pool-matter) examples.
230
+ - **[@melonjs/planck-adapter](https://github.com/melonjs/melonJS/tree/master/packages/planck-adapter)** — [planck.js](https://piqnt.com/planck.js/) integration (faithful Box2D 2.3.0 port). Native joints, CCD bullet flag, sleeping bodies, native raycasts, per-body gravity scale. Showcased by the [Neon Plinko (Planck)](https://melonjs.github.io/melonJS/examples/#/plinko-planck) example.
231
+
232
+ See the [Migrating to the Physics Adapter API](https://github.com/melonjs/melonJS/wiki/Migrating-to-the-Physics-Adapter-API), [Switching Physics Adapters](https://github.com/melonjs/melonJS/wiki/Switching-Physics-Adapters), and [BuiltinAdapter Quirks](https://github.com/melonjs/melonJS/wiki/BuiltinAdapter-Quirks) wiki pages for migration guides and the per-adapter behaviour table.
233
+
218
234
  Installation
219
235
  -------------------------------------------------------------------------------
220
236
 
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AA8BxC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAMnD,OAAO,KAAK,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC/B;;OAEG;IACH,aAAa,EAAG,WAAW,CAAC;IAE5B;;OAEG;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAG,KAAK,CAAC;IAEd;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAG,2BAA2B,CAAC;IAEvC;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;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EAEvB;IAED;;;;;;OAMG;IACH,aAAa,IAAI,IAAI;IAErB;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAevB;;;OAGG;IACH,gBAAgB,IAAI,WAAW;IAI/B;;;;;OAKG;IACH,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED;;;;;;;OAOG;IACH,MAAM,IAAI,IAAI;IAId;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY,GAAE,OAAc,GAAG,IAAI;IAyC3C;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAInC;;;OAGG;IACH,MAAM,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,cAAc;IACd,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKzB,cAAc;IACd,OAAO,IAAI,IAAI;IASf,cAAc;IACd,QAAQ,IAAI,IAAI;IAShB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA+C1B;;OAEG;IACH,IAAI,IAAI,IAAI;CAqBZ;AAED;;;;;GAKG;AACH,eAAO,IAAI,IAAI,EAAE,WAAW,CAAC;AAE7B;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,QAE9C"}
@@ -3,11 +3,23 @@
3
3
  * @import Renderer from "./../video/renderer.js";
4
4
  */
5
5
  import { RendererType } from "../const";
6
+ import { PhysicsAdapter } from "../physics/adapter";
6
7
  import Renderer from "../video/renderer";
7
8
  import { Batcher } from "../video/webgl/batchers/batcher";
8
9
  import { ScaleMethod } from "./scaleMethods";
9
10
  type BlendMode = "normal" | "multiply" | "lighter" | "additive" | "screen";
10
- type PhysicsType = "builtin" | "none";
11
+ /**
12
+ * How the application's physics is configured.
13
+ *
14
+ * - `"builtin"` (default): auto-construct a {@link BuiltinAdapter} with default options.
15
+ * - `"none"`: keep an adapter for API compatibility but skip the per-frame `step()` call (frozen world).
16
+ * - `PhysicsAdapter` instance: use the given adapter (e.g. `new BuiltinAdapter({ gravity })`,
17
+ * or `new MatterAdapter()` from `@melonjs/matter-adapter`).
18
+ * - `{ adapter: PhysicsAdapter }`: explicit form, reserved for future per-app physics options.
19
+ */
20
+ type PhysicsType = "builtin" | "none" | PhysicsAdapter | {
21
+ adapter: PhysicsAdapter;
22
+ };
11
23
  type PowerPreference = "default" | "low-power";
12
24
  export type ApplicationSettings = {
13
25
  /**
@@ -60,7 +72,18 @@ export type ApplicationSettings = {
60
72
  */
61
73
  blendMode: BlendMode;
62
74
  /**
63
- * the physic system to use (default: "builtin", or "none" to disable builtin physic)
75
+ * The physics system to use. Accepts:
76
+ * - `"builtin"` (default) — the built-in SAT physics adapter
77
+ * - `"none"` — disables physics; `World.step` skips the simulation,
78
+ * the world container behaves like a pure scene graph
79
+ * - a `PhysicsAdapter` instance — e.g. `new MatterAdapter()` from
80
+ * `@melonjs/matter-adapter`, or any third-party adapter
81
+ * - `{ adapter: PhysicsAdapter }` — explicit form, reserved for
82
+ * future per-app physics options
83
+ *
84
+ * The adapter's `physicLabel` becomes `world.physic` so user code
85
+ * can branch on the active engine without importing the concrete
86
+ * adapter class (`app.world.physic === "matter"`, etc.).
64
87
  * @default "builtin"
65
88
  */
66
89
  physic: PhysicsType;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/application/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,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IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -1,53 +1,38 @@
1
1
  /**
2
- * Sound asset descriptor used by the audio loader
3
- */
4
- interface SoundAsset {
5
- name: string;
6
- src: string;
7
- autoplay?: boolean;
8
- loop?: boolean;
9
- stream?: boolean;
10
- html5?: boolean;
11
- }
12
- /**
13
- * Load settings for audio resources
14
- */
15
- interface LoadSettings {
16
- nocache?: string;
17
- withCredentials?: boolean;
18
- }
19
- /**
20
- * Panner attributes for spatial audio
21
- */
22
- interface PannerAttributes {
23
- coneInnerAngle?: number;
24
- coneOuterAngle?: number;
25
- coneOuterGain?: number;
26
- distanceModel?: string;
27
- maxDistance?: number;
28
- refDistance?: number;
29
- rolloffFactor?: number;
30
- panningModel?: string;
31
- }
32
- /**
33
- * Specify either to stop on audio loading error or not<br>
34
- * if true, melonJS will throw an exception and stop loading<br>
35
- * if false, melonJS will disable sounds and output a warning message
36
- * in the console<br>
37
- * @default true
38
- */
39
- export declare let stopOnAudioError: boolean;
40
- /**
41
- * Initialize and configure the audio support.<br>
42
- * For a maximum browser coverage the recommendation is to use at least two of them,
43
- * typically default to webm and then fallback to mp3 for the best balance of small filesize and high quality,
44
- * webm has nearly full browser coverage with a great combination of compression and quality, and mp3 will fallback gracefully for other browsers.
45
- * It is important to remember that melonJS selects the first compatible sound based on the list of extensions and given order passed here.
46
- * So if you want webm to be used before mp3, you need to put the audio format in that order.
47
- * @param [format="mp3"] - audio format to prioritize ("mp3"|"mpeg"|"opus"|"ogg"|"oga"|"wav"|"aac"|"caf"|"m4a"|"m4b"|"mp4"|"weba"|"webm"|"dolby"|"flac")
48
- * @returns Indicates whether audio initialization was successful
49
- * @example
50
- * // initialize the "sound engine", giving "webm" as default desired audio format, and "mp3" as a fallback
2
+ * `me.audio` the audio module's public surface.
3
+ *
4
+ * Composition:
5
+ * - {@link ./backend.ts} — shared internal state + the two WebAudio
6
+ * escape hatches (`getAudioContext`, `getMasterGain`) + the
7
+ * `stopOnAudioError` flag.
8
+ * - {@link ./playback.ts} — file-based playback (`load`, `play`,
9
+ * `pause`, `resume`, `stop`, `fade`, `seek`, `rate`, `stereo`,
10
+ * `position`, `orientation`, `panner`).
11
+ * - {@link ./procedural.ts} — procedural primitives (`tone`, `noise`).
12
+ * - {@link ./types.ts} — public TypeScript shapes.
13
+ *
14
+ * This file owns the remaining lifecycle / track / mix / unload
15
+ * helpers, plus the barrel re-exports that compose the namespace.
16
+ */
17
+ export { getAudioContext, getMasterGain, stopOnAudioError, } from "./backend.ts";
18
+ export { fade, load, orientation, panner, pause, play, position, rate, resume, seek, stereo, stop, } from "./playback.ts";
19
+ export { noise, tone } from "./procedural.ts";
20
+ export type { LoadSettings, NoiseFilter, NoiseOptions, PannerAttributes, SoundAsset, ToneOptions, } from "./types.ts";
21
+ /**
22
+ * Initialize and configure the audio module.
23
+ *
24
+ * For maximum browser coverage, list at least two formats — typically
25
+ * webm first then mp3. Webm has near-universal modern coverage with
26
+ * great compression / quality balance; mp3 covers older browsers.
27
+ * Order matters: melonJS picks the first compatible format from the
28
+ * list, so put the preferred one first.
29
+ * @param format - Comma-separated audio formats to prioritize.
30
+ * One or more of: `"mp3"`, `"mpeg"`, `"opus"`, `"ogg"`, `"oga"`,
31
+ * `"wav"`, `"aac"`, `"caf"`, `"m4a"`, `"m4b"`, `"mp4"`, `"weba"`,
32
+ * `"webm"`, `"dolby"`, `"flac"`. Defaults to `"mp3"`.
33
+ * @returns `true` when audio support was successfully initialised.
34
+ * @example
35
+ * // initialise with webm preferred, mp3 as fallback
51
36
  * if (!me.audio.init("webm,mp3")) {
52
37
  * alert("Sorry but your browser does not support html 5 audio !");
53
38
  * return;
@@ -56,254 +41,93 @@ export declare let stopOnAudioError: boolean;
56
41
  */
57
42
  export declare function init(format?: string): boolean;
58
43
  /**
59
- * check if the given audio format is supported
60
- * @param codec - the audio format to check for support
61
- * @returns return true if the given audio format is supported
44
+ * Check whether the given audio codec is supported by the browser.
45
+ * @param codec - The audio format to check.
46
+ * @returns `true` when the format is supported.
62
47
  * @category Audio
63
48
  */
64
49
  export declare function hasFormat(codec: string): boolean;
65
50
  /**
66
- * check if audio (HTML5 or WebAudio) is supported
67
- * @returns return true if audio (HTML5 or WebAudio) is supported
51
+ * Check whether audio (HTML5 or WebAudio) is supported by the browser.
52
+ * @returns `true` when at least one audio backend is available.
68
53
  * @category Audio
69
54
  */
70
55
  export declare function hasAudio(): boolean;
71
56
  /**
72
- * enable audio output <br>
73
- * only useful if audio supported and previously disabled through
74
- * @see {@link disable}
57
+ * Enable audio output. Only useful if audio is supported and was
58
+ * previously disabled through {@link disable}.
75
59
  * @category Audio
76
60
  */
77
61
  export declare function enable(): void;
78
62
  /**
79
- * disable audio output
63
+ * Disable audio output.
80
64
  * @category Audio
81
65
  */
82
66
  export declare function disable(): void;
83
67
  /**
84
- * Load an audio file
85
- * @param sound - sound asset descriptor
86
- * @param [onloadcb] - function to be called when the resource is loaded
87
- * @param [onerrorcb] - function to be called in case of error
88
- * @param [settings] - custom settings to apply to the request (@link https://developer.mozilla.org/en-US/docs/Web/API/fetch#options)
89
- * @returns the amount of asset loaded (always 1 if successful)
90
- * @category Audio
91
- */
92
- export declare function load(sound: SoundAsset, onloadcb?: () => void, onerrorcb?: () => void, settings?: LoadSettings): number;
93
- /**
94
- * play the specified sound
95
- * @param sound_name - audio clip name - case sensitive
96
- * @param [loop=false] - loop audio
97
- * @param [onend] - Function to call when sound instance ends playing.
98
- * @param [volume=default] - Float specifying volume (0.0 - 1.0 values accepted).
99
- * @returns the sound instance ID.
100
- * @example
101
- * // play the "cling" audio clip
102
- * me.audio.play("cling");
103
- * // play & repeat the "engine" audio clip
104
- * me.audio.play("engine", true);
105
- * // play the "gameover_sfx" audio clip and call myFunc when finished
106
- * me.audio.play("gameover_sfx", false, myFunc);
107
- * // play the "gameover_sfx" audio clip with a lower volume level
108
- * me.audio.play("gameover_sfx", false, null, 0.5);
109
- * @category Audio
110
- */
111
- export declare function play(sound_name: string, loop?: boolean, onend?: (() => void) | null, volume?: number): number;
112
- /**
113
- * Fade a currently playing sound between two volumes.
114
- * @param sound_name - audio clip name - case sensitive
115
- * @param from - Volume to fade from (0.0 to 1.0).
116
- * @param to - Volume to fade to (0.0 to 1.0).
117
- * @param duration - Time in milliseconds to fade.
118
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will fade.
119
- * @category Audio
120
- */
121
- export declare function fade(sound_name: string, from: number, to: number, duration: number, id?: number): void;
122
- /**
123
- * get/set the position of playback for a sound.
124
- * @param sound_name - audio clip name - case sensitive
125
- * @param args - optional seek position (in seconds) and optional sound instance ID
126
- * @returns return the current seek position (if no extra parameters were given)
127
- * @example
128
- * // return the current position of the background music
129
- * let current_pos = me.audio.seek("dst-gameforest");
130
- * // set back the position of the background music to the beginning
131
- * me.audio.seek("dst-gameforest", 0);
132
- * @category Audio
133
- */
134
- export declare function seek(sound_name: string, ...args: number[]): number;
135
- /**
136
- * get or set the rate of playback for a sound.
137
- * @param sound_name - audio clip name - case sensitive
138
- * @param args - optional playback rate (0.5 to 4.0, with 1.0 being normal speed) and optional sound instance ID
139
- * @returns return the current playback rate (if no extra parameters were given)
140
- * @example
141
- * // get the playback rate of the background music
142
- * let rate = me.audio.rate("dst-gameforest");
143
- * // speed up the playback of the background music
144
- * me.audio.rate("dst-gameforest", 2.0);
145
- * @category Audio
146
- */
147
- export declare function rate(sound_name: string, ...args: number[]): number;
148
- /**
149
- * get or set the stereo panning for the specified sound.
150
- * @param sound_name - audio clip name - case sensitive
151
- * @param [pan] - the panning value - A value of -1.0 is all the way left and 1.0 is all the way right.
152
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
153
- * @returns the current panning value
154
- * @example
155
- * me.audio.stereo("cling", -1);
156
- * @category Audio
157
- */
158
- export declare function stereo(sound_name: string, pan?: number, id?: number): number;
159
- /**
160
- * get or set the 3D spatial position for the specified sound.
161
- * @param sound_name - audio clip name - case sensitive
162
- * @param x - the x-position of the audio source.
163
- * @param y - the y-position of the audio source.
164
- * @param z - the z-position of the audio source.
165
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
166
- * @returns the current 3D spatial position: [x, y, z]
167
- * @category Audio
168
- */
169
- export declare function position(sound_name: string, x: number, y: number, z: number, id?: number): number[];
170
- /**
171
- * Get/set the direction the audio source is pointing in the 3D cartesian coordinate space.
172
- * Depending on how direction the sound is, based on the `cone` attributes, a sound pointing away from the listener can be quiet or silent.
173
- * @param sound_name - audio clip name - case sensitive
174
- * @param x - the x-orientation of the audio source.
175
- * @param y - the y-orientation of the audio source.
176
- * @param z - the z-orientation of the audio source.
177
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
178
- * @returns the current 3D spatial orientation: [x, y, z]
179
- * @category Audio
180
- */
181
- export declare function orientation(sound_name: string, x: number, y: number, z: number, id?: number): number[];
182
- /**
183
- * get or set the panner node's attributes for a sound or group of sounds.
184
- * See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Web_audio_spatialization_basics#creating_a_panner_node}
185
- * @param sound_name - audio clip name - case sensitive
186
- * @param [attributes] - the panner attributes to set
187
- * @param [attributes.coneInnerAngle=360] - A parameter for directional audio sources, this is an angle, in degrees, inside of which there will be no volume reduction.
188
- * @param [attributes.coneOuterAngle=360] - A parameter for directional audio sources, this is an angle, in degrees, outside of which the volume will be reduced to a constant value of `coneOuterGain`.
189
- * @param [attributes.coneOuterGain=0] - A parameter for directional audio sources, this is the gain outside of the `coneOuterAngle`. It is a linear value in the range `[0, 1]`.
190
- * @param [attributes.distanceModel="inverse"] - Determines algorithm used to reduce volume as audio moves away from listener. Can be `linear`, `inverse` or `exponential.
191
- * @param [attributes.maxDistance=10000] - The maximum distance between source and listener, after which the volume will not be reduced any further.
192
- * @param [attributes.refDistance=1] - A reference distance for reducing volume as source moves further from the listener. This is simply a variable of the distance model and has a different effect depending on which model is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
193
- * @param [attributes.rolloffFactor=1] - How quickly the volume reduces as source moves from listener. This is simply a variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` with `inverse` and `exponential`.
194
- * @param [attributes.panningModel="HRTF"] - Determines which spatialization algorithm is used to position audio. Can be `HRTF` or `equalpower`.
195
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
196
- * @returns current panner attributes.
197
- * @example
198
- * me.audio.panner("cling", {
199
- * panningModel: 'HRTF',
200
- * refDistance: 0.8,
201
- * rolloffFactor: 2.5,
202
- * distanceModel: 'exponential'
203
- * });
204
- * @category Audio
205
- */
206
- export declare function panner(sound_name: string, attributes?: PannerAttributes, id?: number): PannerAttributes;
207
- /**
208
- * stop the specified sound on all channels
209
- * @param [sound_name] - audio clip name (case sensitive). If none is passed, all sounds are stopped.
210
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will stop.
211
- * @example
212
- * me.audio.stop("cling");
213
- * @category Audio
214
- */
215
- export declare function stop(sound_name?: string, id?: number): void;
216
- /**
217
- * pause the specified sound on all channels<br>
218
- * this function does not reset the currentTime property
219
- * @param sound_name - audio clip name - case sensitive
220
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will pause.
221
- * @example
222
- * me.audio.pause("cling");
223
- * @category Audio
224
- */
225
- export declare function pause(sound_name: string, id?: number): void;
226
- /**
227
- * resume the specified sound on all channels<br>
228
- * @param sound_name - audio clip name - case sensitive
229
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will resume.
230
- * @example
231
- * // play an audio clip
232
- * let id = me.audio.play("myClip");
233
- * ...
234
- * // pause it
235
- * me.audio.pause("myClip", id);
236
- * ...
237
- * // resume
238
- * me.audio.resume("myClip", id);
239
- * @category Audio
240
- */
241
- export declare function resume(sound_name: string, id?: number): void;
242
- /**
243
- * play the specified audio track<br>
244
- * this function automatically set the loop property to true<br>
245
- * and keep track of the current sound being played.
246
- * @param sound_name - audio track name - case sensitive
247
- * @param [volume=default] - Float specifying volume (0.0 - 1.0 values accepted).
248
- * @returns the sound instance ID.
68
+ * Play the specified audio track. Automatically loops the clip and
69
+ * tracks it as the current track for {@link stopTrack} / {@link pauseTrack}
70
+ * / {@link resumeTrack}.
71
+ * @param sound_name - Audio track name (case-sensitive).
72
+ * @param volume - Playback volume, `0.0..1.0`. Defaults to the current
73
+ * global volume.
74
+ * @returns The sound instance ID.
249
75
  * @example
250
76
  * me.audio.playTrack("awesome_music");
251
77
  * @category Audio
252
78
  */
253
79
  export declare function playTrack(sound_name: string, volume?: number): number;
254
80
  /**
255
- * stop the current audio track
81
+ * Stop the current audio track.
256
82
  * @see {@link playTrack}
257
83
  * @example
258
- * // play an awesome music
259
84
  * me.audio.playTrack("awesome_music");
260
- * // stop the current music
261
85
  * me.audio.stopTrack();
262
86
  * @category Audio
263
87
  */
264
88
  export declare function stopTrack(): void;
265
89
  /**
266
- * pause the current audio track
90
+ * Pause the current audio track.
267
91
  * @example
268
92
  * me.audio.pauseTrack();
269
93
  * @category Audio
270
94
  */
271
95
  export declare function pauseTrack(): void;
272
96
  /**
273
- * resume the previously paused audio track
97
+ * Resume the previously paused audio track.
274
98
  * @example
275
- * // play an awesome music
276
99
  * me.audio.playTrack("awesome_music");
277
- * // pause the audio track
278
100
  * me.audio.pauseTrack();
279
- * // resume the music
280
101
  * me.audio.resumeTrack();
281
102
  * @category Audio
282
103
  */
283
104
  export declare function resumeTrack(): void;
284
105
  /**
285
- * returns the current track Id
286
- * @returns audio track name
106
+ * Return the name of the current audio track, or `null` if none is set.
107
+ * @returns The current track name, or `null`.
287
108
  * @category Audio
288
109
  */
289
110
  export declare function getCurrentTrack(): string | null;
290
111
  /**
291
- * set the default global volume
292
- * @param volume - Float specifying volume (0.0 - 1.0 values accepted).
112
+ * Set the default global volume.
113
+ * @param volume - Volume value, `0.0..1.0`.
293
114
  * @category Audio
294
115
  */
295
116
  export declare function setVolume(volume: number): void;
296
117
  /**
297
- * get the default global volume
298
- * @returns current volume value in Float [0.0 - 1.0] .
118
+ * Get the default global volume.
119
+ * @returns The current volume value, `0.0..1.0`.
299
120
  * @category Audio
300
121
  */
301
122
  export declare function getVolume(): number;
302
123
  /**
303
- * mute or unmute the specified sound, but does not pause the playback.
304
- * @param sound_name - audio clip name - case sensitive
305
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will mute.
306
- * @param [shouldMute=true] - True to mute and false to unmute
124
+ * Mute or unmute the specified sound. Playback continues; only the
125
+ * audible output is suppressed.
126
+ * @param sound_name - Audio clip name (case-sensitive).
127
+ * @param id - Sound instance ID. When omitted, all sounds in the group
128
+ * are affected.
129
+ * @param shouldMute - `true` to mute, `false` to unmute. Defaults to
130
+ * `true`.
307
131
  * @example
308
132
  * // mute the background music
309
133
  * me.audio.mute("awesome_music");
@@ -311,43 +135,43 @@ export declare function getVolume(): number;
311
135
  */
312
136
  export declare function mute(sound_name: string, id?: number, shouldMute?: boolean): void;
313
137
  /**
314
- * unmute the specified sound
315
- * @param sound_name - audio clip name
316
- * @param [id] - the sound instance ID. If none is passed, all sounds in group will unmute.
138
+ * Unmute the specified sound.
139
+ * @param sound_name - Audio clip name (case-sensitive).
140
+ * @param id - Sound instance ID. When omitted, all sounds in the group
141
+ * are affected.
317
142
  * @category Audio
318
143
  */
319
144
  export declare function unmute(sound_name: string, id?: number): void;
320
145
  /**
321
- * mute all audio
146
+ * Mute all audio.
322
147
  * @category Audio
323
148
  */
324
149
  export declare function muteAll(): void;
325
150
  /**
326
- * unmute all audio
151
+ * Unmute all audio.
327
152
  * @category Audio
328
153
  */
329
154
  export declare function unmuteAll(): void;
330
155
  /**
331
- * Returns true if audio is muted globally.
332
- * @returns true if audio is muted globally
156
+ * Return whether audio is currently muted globally.
157
+ * @returns `true` when audio is muted globally.
333
158
  * @category Audio
334
159
  */
335
160
  export declare function muted(): boolean;
336
161
  /**
337
- * unload specified audio track to free memory
338
- * @param sound_name - audio track name - case sensitive
339
- * @returns true if unloaded
162
+ * Unload the specified audio track to free memory.
163
+ * @param sound_name - Audio track name (case-sensitive).
164
+ * @returns `true` when the track was found and unloaded.
340
165
  * @example
341
166
  * me.audio.unload("awesome_music");
342
167
  * @category Audio
343
168
  */
344
169
  export declare function unload(sound_name: string): boolean;
345
170
  /**
346
- * unload all audio to free memory
171
+ * Unload every loaded audio track to free memory.
347
172
  * @example
348
173
  * me.audio.unloadAll();
349
174
  * @category Audio
350
175
  */
351
176
  export declare function unloadAll(): void;
352
- export {};
353
177
  //# sourceMappingURL=audio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/audio/audio.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,YAAY;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,UAAU,gBAAgB;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAwDD;;;;;;GAMG;AAEH,eAAO,IAAI,gBAAgB,EAAE,OAAc,CAAC;AAE5C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