@drincs/pixi-vn 1.8.25 → 1.9.1

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 (55) hide show
  1. package/README.md +66 -33
  2. package/dist/{ContainerMemory-D2HtgX7w.d.cts → ContainerMemory-BpDgacyr.d.cts} +2 -15
  3. package/dist/{ContainerMemory-D2HtgX7w.d.ts → ContainerMemory-BpDgacyr.d.ts} +2 -15
  4. package/dist/{HistoryChoiceMenuOption-DVMD78W7.d.cts → HistoryChoiceMenuOption-BxMSXnyI.d.cts} +1 -1
  5. package/dist/{HistoryChoiceMenuOption-B8RfQz5H.d.ts → HistoryChoiceMenuOption-hSI4SHV-.d.ts} +1 -1
  6. package/dist/{HistoryGameState-CmjUtlkV.d.ts → HistoryGameState-C8ATx9K6.d.ts} +1 -1
  7. package/dist/{HistoryGameState-C28NcKKl.d.cts → HistoryGameState-CGfvq5iL.d.cts} +1 -1
  8. package/dist/{HistoryStep-G9dUn0Lf.d.cts → HistoryStep-WGB6nA4N.d.cts} +5 -0
  9. package/dist/{HistoryStep-G9dUn0Lf.d.ts → HistoryStep-WGB6nA4N.d.ts} +5 -0
  10. package/dist/{OpenedLabel-DLfFuZgk.d.ts → OpenedLabel-CmRdzTXP.d.ts} +1 -1
  11. package/dist/{OpenedLabel-BxfL31aQ.d.cts → OpenedLabel-Cmd675NI.d.cts} +1 -1
  12. package/dist/SoundGameState-C_6ZsQX6.d.cts +186 -0
  13. package/dist/SoundGameState-C_6ZsQX6.d.ts +186 -0
  14. package/dist/{StorageGameState-CtjNJpvE.d.cts → StorageGameState-C3PGrFPr.d.cts} +2 -2
  15. package/dist/{StorageGameState-BJy57o6K.d.ts → StorageGameState-jAexrJLj.d.ts} +2 -2
  16. package/dist/canvas.cjs +2 -2
  17. package/dist/canvas.d.cts +267 -26
  18. package/dist/canvas.d.ts +267 -26
  19. package/dist/canvas.mjs +2 -2
  20. package/dist/characters.cjs +1 -1
  21. package/dist/characters.mjs +1 -1
  22. package/dist/chunk-HD353M4B.mjs +1 -0
  23. package/dist/chunk-I7DOUH5V.mjs +1 -0
  24. package/dist/history.cjs +1 -1
  25. package/dist/history.d.cts +38 -15
  26. package/dist/history.d.ts +38 -15
  27. package/dist/history.mjs +1 -1
  28. package/dist/index.cjs +2 -2
  29. package/dist/index.d.cts +152 -34
  30. package/dist/index.d.ts +152 -34
  31. package/dist/index.mjs +2 -2
  32. package/dist/motion.cjs +1 -1
  33. package/dist/motion.mjs +1 -1
  34. package/dist/narration.cjs +2 -2
  35. package/dist/narration.d.cts +196 -52
  36. package/dist/narration.d.ts +196 -52
  37. package/dist/narration.mjs +2 -2
  38. package/dist/pixi/browser.js +163 -152
  39. package/dist/sound.cjs +1 -1
  40. package/dist/sound.d.cts +313 -6
  41. package/dist/sound.d.ts +313 -6
  42. package/dist/sound.mjs +1 -1
  43. package/dist/storage.cjs +1 -1
  44. package/dist/storage.d.cts +50 -3
  45. package/dist/storage.d.ts +50 -3
  46. package/dist/storage.mjs +1 -1
  47. package/dist/vite.cjs +4 -2
  48. package/dist/vite.d.cts +19 -0
  49. package/dist/vite.d.ts +19 -0
  50. package/dist/vite.mjs +4 -2
  51. package/package.json +3 -2
  52. package/dist/SoundManagerInterface-Dd0b88_N.d.cts +0 -436
  53. package/dist/SoundManagerInterface-Dd0b88_N.d.ts +0 -436
  54. package/dist/chunk-GIYMPXBT.mjs +0 -1
  55. package/dist/chunk-IWAXXFXE.mjs +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pixi’VN - PixiJS Game Engine
2
2
 
3
- ![pixi-vn-cover](https://github.com/user-attachments/assets/28c41fe1-c539-4ebb-b7d4-8cb9f79e089e)
3
+ ![pixi-vn-cover](https://github.com/user-attachments/assets/6a4951d3-459f-4f8d-ae3d-1342a55570e9)
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/@drincs/pixi-vn" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/npm/v/@drincs/pixi-vn?label=version" alt="npm version"></a>
@@ -10,37 +10,59 @@
10
10
  <a target="_blank" href="https://discord.gg/E95FZWakzp" rel="noopener noreferrer nofollow"><img alt="Discord" src="https://img.shields.io/discord/1263071210011496501?color=7289da&label=discord"></a>
11
11
  </p>
12
12
 
13
- Pixi’VN is a very versatile and powerful 2D game engine. It is based on JavaScript/TypeScript and [PixiJS](https://pixijs.com/).
13
+ Pixi’VN is a very versatile and powerful story-driven engine. It is based on JavaScript/TypeScript and [PixiJS](https://pixijs.com/), and supports animated characters through [Spine 2D](https://esotericsoftware.com/) and [Live2D](https://www.live2d.com/).
14
14
 
15
- It provides the following features:
15
+ Pixi’VN aims to be an innovative and fast engine, and puts a strong emphasis on AI-assisted development: an AI agent can start your game, gain all the knowledge it needs about your project through [Agent Skills](#agent-skills), and test the game by launching it in a browser — with the ability to keep driving it from the outside while it plays.
16
16
 
17
- - narrative management
18
- - provides a 2D canvas
19
- - providing functionality to play sounds and music
20
- - storage to set and get game variables.
21
- - saves the current state of the entire game at each "story step" giving the possibility to go back
22
- - functionality to save and load the current state of the game.
17
+ You can use narrative languages that are able to take full advantage of the engine's features, as well as any custom features you add to your project. Currently supported:
23
18
 
24
- For a quick start, various [project templates](#project-initialization) are available. Less experienced developers can use these templates without much knowledge of JavaScript/TypeScript.
19
+ - [_ink_](https://pixi-vn.com/ink/ink)
25
20
 
26
- You have the option to use various types of narrative languages ​​(in addition to JavaScript/TypeScript). Currently you can use the following:
21
+ ## Templates
27
22
 
28
- - [_ink_](https://pixi-vn.com/ink/ink)
23
+ For a quick start, various project templates are available, built with React. Less experienced developers can use these templates without much knowledge of JavaScript/TypeScript.
24
+
25
+ - **[Visual Novel](https://pixi-vn.com/start/make-visual-novel)**: a classic dialogue-driven experience, with characters, backgrounds, and choices.
26
+ - **[Point & Click Adventure](https://pixi-vn.com/nqtr/make-point-and-click)**: an adventure game where the player explores scenes and interacts with objects and characters.
27
+ - **Interactive Fiction**: feels like reading a book. Unlike a visual novel, images are shown as vignettes, just as illustrations would appear on a page.
28
+
29
+ To create a new project from a template, run:
30
+
31
+ ```npm
32
+ npm create pixi-vn@latest
33
+ ```
34
+
35
+ ### Distribution
29
36
 
30
- Pixi’VN does not provide built-in components to create the game UI. Instead, you should use external JavaScript frameworks to build your UI. This allows you to leverage systems such as React, Vue, etc., to create complex and high-performance **UI screens**.
37
+ Pixi’VN is independent of any distribution technology, but strong emphasis is being placed on [Roves](https://roves.pixi-vn.com/), built by the same team behind Pixi’VN.
38
+
39
+ | Platform | [Roves](https://roves.pixi-vn.com/) | [Tauri](https://v2.tauri.app/) | [Electron](https://www.electronjs.org/) |
40
+ | -------- | -- | -- | -- |
41
+ | Windows | ✅ | ✅ | ✅ |
42
+ | macOS | ✅ | ✅ | ✅ |
43
+ | Linux | ✅ | ✅ | ✅ |
44
+ | Android | ✅ | ✅ | ❌ |
45
+ | iOS | 🚧 | ✅ | ❌ |
46
+ | Nintendo | 🚧 | ❌ | ❌ |
47
+ | PlayStation | 🚧 | ❌ | ❌ |
48
+ | Xbox | 🚧 | ❌ | ❌ |
31
49
 
32
50
  ## Wiki
33
51
 
34
- - [Why Pixi’VN?](https://pixi-vn.com/start/why)
35
- - [Ren'Py vs Pixi’VN](https://pixi-vn.com/start/versus-renpy)
36
52
  - [Quick Start](https://pixi-vn.com/start/getting-started)
37
53
  - [Templates](https://pixi-vn.com/start/templates)
38
- - Make your first:
39
- - [Visual Novel](https://pixi-vn.com/start/make-visual-novel)
40
- - [Point & Click Adventure](https://pixi-vn.com/nqtr/make-point-and-click)
41
- - [RPG game](https://pixi-vn.com/start/make-rpg)
42
- - [IDE or graphical editor](https://pixi-vn.com/start/make-ide)
43
- - [Game engine](https://pixi-vn.com/start/make-game-engine)
54
+ - Features:
55
+ - [Characters](https://pixi-vn.com/start/character)
56
+ - [Narration](https://pixi-vn.com/start/narration)
57
+ - [Assets](https://pixi-vn.com/start/assets)
58
+ - [Canvas WebGL/WebGPU](https://pixi-vn.com/start/canvas)
59
+ - [Sounds and music](https://pixi-vn.com/start/sound)
60
+ - [Storage](https://pixi-vn.com/start/storage)
61
+ - [User Interface (UI)](https://pixi-vn.com/start/interface)
62
+ - [Minigames](https://pixi-vn.com/start/minigames)
63
+ - [AI-Generated Content](https://pixi-vn.com/start/ai-generated-content)
64
+ - [Save and load](https://pixi-vn.com/start/save)
65
+ - [Distribution](https://pixi-vn.com/start/distribution)
44
66
 
45
67
  ## Prerequisites
46
68
 
@@ -52,18 +74,6 @@ Before starting, you must have the following tools installed:
52
74
  - [Cursor](https://www.cursor.com/)
53
75
  - [VSCodium](https://vscodium.com/)
54
76
 
55
- ## Project Initialization
56
-
57
- If you want to start from a new project, you can use the following command to initialize a new project with the Pixi’VN templates:
58
-
59
- ```npm
60
- npm create pixi-vn@latest
61
- ```
62
-
63
- You can see the list of available templates and interactive demos <DynamicLink href="/start/templates">here</DynamicLink>.
64
-
65
- After the project is initialized, open the project directory with your text editor (VSCode is recommended) and start developing your project.
66
-
67
77
  ## Installation
68
78
 
69
79
  To install the Pixi’VN package in an existing JavaScript project, use one of the following commands:
@@ -135,3 +145,26 @@ body {
135
145
  overflow: hidden;
136
146
  }
137
147
  ```
148
+
149
+ ## Agent Skills
150
+
151
+ Pixi'VN ships a set of [Agent Skills](https://www.skills.sh/) that teach AI coding assistants (like Claude Code) how to correctly use each part of the engine. If you use Claude Code, you can install all of them into your project with:
152
+
153
+ ```npm
154
+ npx skills add DRincs-Productions/pixi-vn --all
155
+ ```
156
+
157
+ This installs every skill below and prompts you to pick which ones to keep. To install only specific ones, add `--skill <name>` (repeat the flag to install several, e.g. `--skill canvas --skill sound`). Use `--list` instead of installing to just see what's available. Available skills:
158
+
159
+ - `getting-started` — installing the package and initializing the `Game`
160
+ - `assets` — local vs. online assets, the manifest/bundle/alias system, and loading strategy
161
+ - `canvas` — images, sprites, text, video, transitions and effects
162
+ - `characters` — defining and registering characters
163
+ - `history` — going back/rewinding and reading the narration backlog
164
+ - `narration` — labels, dialogue and choices
165
+ - `saves` — exporting/restoring game state and persisting save files
166
+ - `sound` — music, sound effects and audio channels
167
+ - `storage` — game variables, flags and stored classes
168
+ - `testing` — driving/inspecting a running game from an AI agent or script via `Game.testing`, for automated play-testing
169
+ - `ui` — mounting HTML/PixiJS UI layers over the canvas, screen navigation, theming, and connecting UI to storage
170
+ - `migration` — upgrading an existing project to the current version
@@ -82,19 +82,6 @@ interface TickerHistory<TArgs extends TickerArgs> {
82
82
  paused?: boolean;
83
83
  }
84
84
 
85
- type PauseType = {
86
- /**
87
- * The type of the value
88
- */
89
- type: "pause";
90
- /**
91
- * Duration in seconds
92
- */
93
- duration: number;
94
- };
95
-
96
- type RepeatType = "repeat";
97
-
98
85
  interface TickersStep<TArgs extends TickerArgs> {
99
86
  /**
100
87
  * Ticker class name
@@ -124,7 +111,7 @@ interface TickersSequence {
124
111
  /**
125
112
  * The steps of the tickers
126
113
  */
127
- steps: (TickersStep<any> | RepeatType | PauseType)[];
114
+ steps: TickersStep<any>[];
128
115
  }
129
116
 
130
117
  /**
@@ -389,4 +376,4 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
389
376
  elements: CanvasBaseItemMemory[];
390
377
  }
391
378
 
392
- export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
379
+ export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
@@ -82,19 +82,6 @@ interface TickerHistory<TArgs extends TickerArgs> {
82
82
  paused?: boolean;
83
83
  }
84
84
 
85
- type PauseType = {
86
- /**
87
- * The type of the value
88
- */
89
- type: "pause";
90
- /**
91
- * Duration in seconds
92
- */
93
- duration: number;
94
- };
95
-
96
- type RepeatType = "repeat";
97
-
98
85
  interface TickersStep<TArgs extends TickerArgs> {
99
86
  /**
100
87
  * Ticker class name
@@ -124,7 +111,7 @@ interface TickersSequence {
124
111
  /**
125
112
  * The steps of the tickers
126
113
  */
127
- steps: (TickersStep<any> | RepeatType | PauseType)[];
114
+ steps: TickersStep<any>[];
128
115
  }
129
116
 
130
117
  /**
@@ -389,4 +376,4 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
389
376
  elements: CanvasBaseItemMemory[];
390
377
  }
391
378
 
392
- export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type PauseType as P, type RepeatType as R, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
379
+ export { type AdditionalPositionsExtensionProps as A, type CanvasBaseItemMemory as C, type ListenerExtensionMemory as L, type OnEventsHandlers as O, type TickerArgs as T, type Ticker as a, CanvasBaseItem as b, type TickerInfo as c, type TickersSequence as d, type CanvasGameState as e, type ContainerChild as f, type ListenerExtension as g, type AdditionalPositionsExtension as h, type ContainerMemory as i, type TickerHistory as j, addListenerHandler as k, analizePositionsExtensionProps as l };
@@ -1,5 +1,5 @@
1
1
  import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
2
- import { D as DialogueInterface } from './HistoryStep-G9dUn0Lf.cjs';
2
+ import { D as DialogueInterface } from './HistoryStep-WGB6nA4N.cjs';
3
3
 
4
4
  type CloseType = "close";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
2
- import { D as DialogueInterface } from './HistoryStep-G9dUn0Lf.js';
2
+ import { D as DialogueInterface } from './HistoryStep-WGB6nA4N.js';
3
3
 
4
4
  type CloseType = "close";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { GameStepState } from '@drincs/pixi-vn';
2
- import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.js';
2
+ import { H as HistoryStep } from './HistoryStep-WGB6nA4N.js';
3
3
 
4
4
  /**
5
5
  * Interface exported step data
@@ -1,5 +1,5 @@
1
1
  import { GameStepState } from '@drincs/pixi-vn';
2
- import { H as HistoryStep } from './HistoryStep-G9dUn0Lf.cjs';
2
+ import { H as HistoryStep } from './HistoryStep-WGB6nA4N.cjs';
3
3
 
4
4
  /**
5
5
  * Interface exported step data
@@ -91,6 +91,11 @@ interface HistoryStep {
91
91
  * The input value of the player
92
92
  */
93
93
  inputValue?: StorageElementType;
94
+ /**
95
+ * Whether this step requested an input from the player (regardless of whether a
96
+ * default value was provided, unlike {@link inputValue} which is only set when one is).
97
+ */
98
+ isRequiredInput?: boolean;
94
99
  /**
95
100
  * The choice made by the player
96
101
  */
@@ -91,6 +91,11 @@ interface HistoryStep {
91
91
  * The input value of the player
92
92
  */
93
93
  inputValue?: StorageElementType;
94
+ /**
95
+ * Whether this step requested an input from the player (regardless of whether a
96
+ * default value was provided, unlike {@link inputValue} which is only set when one is).
97
+ */
98
+ isRequiredInput?: boolean;
94
99
  /**
95
100
  * The choice made by the player
96
101
  */
@@ -1,4 +1,4 @@
1
- import { L as LabelIdType } from './HistoryStep-G9dUn0Lf.js';
1
+ import { L as LabelIdType } from './HistoryStep-WGB6nA4N.js';
2
2
 
3
3
  interface OpenedLabel {
4
4
  label: LabelIdType;
@@ -1,4 +1,4 @@
1
- import { L as LabelIdType } from './HistoryStep-G9dUn0Lf.cjs';
1
+ import { L as LabelIdType } from './HistoryStep-WGB6nA4N.cjs';
2
2
 
3
3
  interface OpenedLabel {
4
4
  label: LabelIdType;
@@ -0,0 +1,186 @@
1
+ import { PlayerOptions, Player, ToneAudioNode, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
2
+
3
+ interface MediaInterface extends Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state"> {
4
+ /**
5
+ * Whether the sound is currently paused.
6
+ */
7
+ paused: boolean;
8
+ /**
9
+ * @deprecated Use {@link mute} instead.
10
+ */
11
+ muted: boolean;
12
+ /**
13
+ * @deprecated Use {@link playbackRate} instead.
14
+ */
15
+ speed: number;
16
+ }
17
+ interface MediaMemory extends Partial<Omit<PlayerOptions, "url" | "volume">> {
18
+ /**
19
+ * The volume of this sound in the linear range [0, 1], where 0 is silence
20
+ * and 1 is full volume. Stored and restored in linear form; converted
21
+ * to/from Tone.js decibels internally.
22
+ */
23
+ volume?: number;
24
+ elapsed: number | undefined;
25
+ paused: boolean;
26
+ delay?: number;
27
+ }
28
+
29
+ interface SoundOptions extends Pick<Partial<PlayerOptions>, "loop" | "autostart" | "fadeIn" | "fadeOut" | "mute" | "loopEnd" | "loopStart" | "reverse" | "playbackRate"> {
30
+ /**
31
+ * The volume of this sound in the linear range [0, 1], where 0 is silence
32
+ * and 1 is full volume. This is converted to decibels internally before
33
+ * being passed to the Tone.js Player.
34
+ */
35
+ volume?: number;
36
+ /**
37
+ * A collection of audio filters/effects to apply to this sound.
38
+ *
39
+ * Install "tone" for the full list of available filters.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import * as Tone from "tone";
44
+ *
45
+ * const filters = [new Tone.FeedbackDelay("8n", 0.5)];
46
+ * ```
47
+ */
48
+ filters?: ToneAudioNode[];
49
+ /**
50
+ * @deprecated Use {@link playbackRate} instead.
51
+ */
52
+ speed?: number;
53
+ /**
54
+ * @deprecated Use {@link mute} instead.
55
+ */
56
+ muted?: boolean;
57
+ }
58
+ interface SoundPlayOptions extends SoundOptions {
59
+ /**
60
+ * The delay in seconds before playback starts. If specified, playback is
61
+ * scheduled to begin after the delay has elapsed rather than starting
62
+ * immediately in a paused state.
63
+ */
64
+ delay?: number;
65
+ /**
66
+ * The offset in seconds from the start of the sound at which to begin playback.
67
+ */
68
+ elapsed?: number;
69
+ }
70
+ interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
71
+ /**
72
+ * The alias of the audio channel to play the sound on. If the channel does
73
+ * not exist it will be created automatically.
74
+ * Defaults to `SoundManagerInterface.defaultChannelAlias` ("general").
75
+ */
76
+ channel?: string;
77
+ }
78
+ interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
79
+ /**
80
+ * Whether this channel is a background channel.
81
+ * Background channels are special: media playing on them is not stopped
82
+ * when a scene changes, but continues in the background.
83
+ */
84
+ background?: boolean;
85
+ /**
86
+ * The stereo pan position for this channel in the range [-1, 1].
87
+ * -1 is full left, 0 is centre, 1 is full right.
88
+ * Defaults to 0.
89
+ */
90
+ pan?: number;
91
+ }
92
+
93
+ type SoundFilterMemory = ({
94
+ filterType: "ReverbFilter";
95
+ } & Omit<Partial<ReverbOptions>, "context">) | ({
96
+ filterType: "FeedbackDelayFilter";
97
+ } & Omit<Partial<FeedbackDelayOptions>, "context">) | ({
98
+ filterType: "FreeverbFilter";
99
+ } & Omit<Partial<FreeverbOptions>, "context">) | ({
100
+ filterType: "DelayFilter";
101
+ } & Omit<Partial<DelayOptions>, "context">) | ({
102
+ filterType: "PingPongDelayFilter";
103
+ } & Omit<Partial<PingPongDelayOptions>, "context">) | ({
104
+ filterType: "GateFilter";
105
+ } & Omit<Partial<GateOptions>, "context">) | ({
106
+ filterType: "AutoFilterFilter";
107
+ } & Omit<Partial<AutoFilterOptions>, "context">) | ({
108
+ filterType: "BiquadFilterFilter";
109
+ } & Omit<Partial<BiquadFilterOptions>, "context">) | ({
110
+ filterType: "OnePoleFilterFilter";
111
+ } & Omit<Partial<OnePoleFilterOptions>, "context" | "frequency">) | ({
112
+ filterType: "FeedbackCombFilterFilter";
113
+ } & Omit<Partial<FeedbackCombFilterOptions>, "context">) | ({
114
+ filterType: "CustomFilter";
115
+ } & Omit<Partial<FilterOptions>, "context">) | ({
116
+ filterType: "ChorusFilter";
117
+ } & Omit<Partial<ChorusOptions>, "context">) | ({
118
+ filterType: "PhaserFilter";
119
+ } & Omit<Partial<PhaserOptions>, "context">) | ({
120
+ filterType: "TremoloFilter";
121
+ } & Omit<Partial<TremoloOptions>, "context">) | ({
122
+ filterType: "VibratoFilter";
123
+ } & Omit<Partial<VibratoOptions>, "context">) | ({
124
+ filterType: "CompressorFilter";
125
+ } & Omit<Partial<CompressorOptions>, "context">) | ({
126
+ filterType: "MidSideCompressorFilter";
127
+ } & Omit<Partial<MidSideCompressorOptions>, "context">) | ({
128
+ filterType: "MultibandCompressorFilter";
129
+ } & Omit<Partial<MultibandCompressorOptions>, "context">) | ({
130
+ filterType: "LimiterFilter";
131
+ } & Omit<Partial<LimiterOptions>, "context">) | ({
132
+ filterType: "GreaterThanFilter";
133
+ } & Omit<Partial<GreaterThanOptions>, "context">) | ({
134
+ filterType: "GreaterThanZeroFilter";
135
+ } & Omit<Partial<GreaterThanZeroOptions>, "context">) | ({
136
+ filterType: "DistortionFilter";
137
+ } & Omit<Partial<DistortionOptions>, "context">) | ({
138
+ filterType: "BitCrusherFilter";
139
+ } & Omit<Partial<BitCrusherOptions>, "context">) | ({
140
+ filterType: "Panner3DFilter";
141
+ } & Omit<Partial<Panner3DOptions>, "context">) | ({
142
+ filterType: "AutoPannerFilter";
143
+ } & Omit<Partial<AutoPannerOptions>, "context">) | ({
144
+ filterType: "StereoWidenerFilter";
145
+ } & Omit<Partial<StereoWidenerOptions>, "context">);
146
+
147
+ interface ExportedSound {
148
+ options: SoundOptions;
149
+ filters?: SoundFilterMemory[];
150
+ }
151
+ interface SoundPlay {
152
+ stepIndex: number;
153
+ paused: boolean;
154
+ options?: SoundPlayOptions | string;
155
+ }
156
+ interface ExportedSoundPlay extends SoundPlay {
157
+ sound: ExportedSound;
158
+ }
159
+ /**
160
+ * Interface exported sounds
161
+ */
162
+ interface SoundGameState {
163
+ /**
164
+ * @deprecated
165
+ */
166
+ soundsPlaying?: {
167
+ [key: string]: ExportedSoundPlay;
168
+ };
169
+ mediaInstances: {
170
+ [key: string]: {
171
+ channelAlias: string;
172
+ soundAlias: string;
173
+ stepCounter: number;
174
+ options: MediaMemory & {
175
+ filters?: SoundFilterMemory[];
176
+ delay?: number;
177
+ };
178
+ /**
179
+ * @deprecated Use options.paused instead.
180
+ */
181
+ paused?: boolean;
182
+ };
183
+ };
184
+ }
185
+
186
+ export type { ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, SoundPlayOptions as a, SoundPlayOptionsWithChannel as b, MediaMemory as c, ExportedSoundPlay as d, SoundOptions as e, SoundPlay as f };
@@ -0,0 +1,186 @@
1
+ import { PlayerOptions, Player, ToneAudioNode, ReverbOptions, FeedbackDelayOptions, FreeverbOptions, DelayOptions, PingPongDelayOptions, GateOptions, AutoFilterOptions, BiquadFilterOptions, OnePoleFilterOptions, FeedbackCombFilterOptions, FilterOptions, ChorusOptions, PhaserOptions, TremoloOptions, VibratoOptions, CompressorOptions, MidSideCompressorOptions, MultibandCompressorOptions, LimiterOptions, GreaterThanOptions, GreaterThanZeroOptions, DistortionOptions, BitCrusherOptions, Panner3DOptions, AutoPannerOptions, StereoWidenerOptions } from 'tone';
2
+
3
+ interface MediaInterface extends Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state"> {
4
+ /**
5
+ * Whether the sound is currently paused.
6
+ */
7
+ paused: boolean;
8
+ /**
9
+ * @deprecated Use {@link mute} instead.
10
+ */
11
+ muted: boolean;
12
+ /**
13
+ * @deprecated Use {@link playbackRate} instead.
14
+ */
15
+ speed: number;
16
+ }
17
+ interface MediaMemory extends Partial<Omit<PlayerOptions, "url" | "volume">> {
18
+ /**
19
+ * The volume of this sound in the linear range [0, 1], where 0 is silence
20
+ * and 1 is full volume. Stored and restored in linear form; converted
21
+ * to/from Tone.js decibels internally.
22
+ */
23
+ volume?: number;
24
+ elapsed: number | undefined;
25
+ paused: boolean;
26
+ delay?: number;
27
+ }
28
+
29
+ interface SoundOptions extends Pick<Partial<PlayerOptions>, "loop" | "autostart" | "fadeIn" | "fadeOut" | "mute" | "loopEnd" | "loopStart" | "reverse" | "playbackRate"> {
30
+ /**
31
+ * The volume of this sound in the linear range [0, 1], where 0 is silence
32
+ * and 1 is full volume. This is converted to decibels internally before
33
+ * being passed to the Tone.js Player.
34
+ */
35
+ volume?: number;
36
+ /**
37
+ * A collection of audio filters/effects to apply to this sound.
38
+ *
39
+ * Install "tone" for the full list of available filters.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import * as Tone from "tone";
44
+ *
45
+ * const filters = [new Tone.FeedbackDelay("8n", 0.5)];
46
+ * ```
47
+ */
48
+ filters?: ToneAudioNode[];
49
+ /**
50
+ * @deprecated Use {@link playbackRate} instead.
51
+ */
52
+ speed?: number;
53
+ /**
54
+ * @deprecated Use {@link mute} instead.
55
+ */
56
+ muted?: boolean;
57
+ }
58
+ interface SoundPlayOptions extends SoundOptions {
59
+ /**
60
+ * The delay in seconds before playback starts. If specified, playback is
61
+ * scheduled to begin after the delay has elapsed rather than starting
62
+ * immediately in a paused state.
63
+ */
64
+ delay?: number;
65
+ /**
66
+ * The offset in seconds from the start of the sound at which to begin playback.
67
+ */
68
+ elapsed?: number;
69
+ }
70
+ interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
71
+ /**
72
+ * The alias of the audio channel to play the sound on. If the channel does
73
+ * not exist it will be created automatically.
74
+ * Defaults to `SoundManagerInterface.defaultChannelAlias` ("general").
75
+ */
76
+ channel?: string;
77
+ }
78
+ interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
79
+ /**
80
+ * Whether this channel is a background channel.
81
+ * Background channels are special: media playing on them is not stopped
82
+ * when a scene changes, but continues in the background.
83
+ */
84
+ background?: boolean;
85
+ /**
86
+ * The stereo pan position for this channel in the range [-1, 1].
87
+ * -1 is full left, 0 is centre, 1 is full right.
88
+ * Defaults to 0.
89
+ */
90
+ pan?: number;
91
+ }
92
+
93
+ type SoundFilterMemory = ({
94
+ filterType: "ReverbFilter";
95
+ } & Omit<Partial<ReverbOptions>, "context">) | ({
96
+ filterType: "FeedbackDelayFilter";
97
+ } & Omit<Partial<FeedbackDelayOptions>, "context">) | ({
98
+ filterType: "FreeverbFilter";
99
+ } & Omit<Partial<FreeverbOptions>, "context">) | ({
100
+ filterType: "DelayFilter";
101
+ } & Omit<Partial<DelayOptions>, "context">) | ({
102
+ filterType: "PingPongDelayFilter";
103
+ } & Omit<Partial<PingPongDelayOptions>, "context">) | ({
104
+ filterType: "GateFilter";
105
+ } & Omit<Partial<GateOptions>, "context">) | ({
106
+ filterType: "AutoFilterFilter";
107
+ } & Omit<Partial<AutoFilterOptions>, "context">) | ({
108
+ filterType: "BiquadFilterFilter";
109
+ } & Omit<Partial<BiquadFilterOptions>, "context">) | ({
110
+ filterType: "OnePoleFilterFilter";
111
+ } & Omit<Partial<OnePoleFilterOptions>, "context" | "frequency">) | ({
112
+ filterType: "FeedbackCombFilterFilter";
113
+ } & Omit<Partial<FeedbackCombFilterOptions>, "context">) | ({
114
+ filterType: "CustomFilter";
115
+ } & Omit<Partial<FilterOptions>, "context">) | ({
116
+ filterType: "ChorusFilter";
117
+ } & Omit<Partial<ChorusOptions>, "context">) | ({
118
+ filterType: "PhaserFilter";
119
+ } & Omit<Partial<PhaserOptions>, "context">) | ({
120
+ filterType: "TremoloFilter";
121
+ } & Omit<Partial<TremoloOptions>, "context">) | ({
122
+ filterType: "VibratoFilter";
123
+ } & Omit<Partial<VibratoOptions>, "context">) | ({
124
+ filterType: "CompressorFilter";
125
+ } & Omit<Partial<CompressorOptions>, "context">) | ({
126
+ filterType: "MidSideCompressorFilter";
127
+ } & Omit<Partial<MidSideCompressorOptions>, "context">) | ({
128
+ filterType: "MultibandCompressorFilter";
129
+ } & Omit<Partial<MultibandCompressorOptions>, "context">) | ({
130
+ filterType: "LimiterFilter";
131
+ } & Omit<Partial<LimiterOptions>, "context">) | ({
132
+ filterType: "GreaterThanFilter";
133
+ } & Omit<Partial<GreaterThanOptions>, "context">) | ({
134
+ filterType: "GreaterThanZeroFilter";
135
+ } & Omit<Partial<GreaterThanZeroOptions>, "context">) | ({
136
+ filterType: "DistortionFilter";
137
+ } & Omit<Partial<DistortionOptions>, "context">) | ({
138
+ filterType: "BitCrusherFilter";
139
+ } & Omit<Partial<BitCrusherOptions>, "context">) | ({
140
+ filterType: "Panner3DFilter";
141
+ } & Omit<Partial<Panner3DOptions>, "context">) | ({
142
+ filterType: "AutoPannerFilter";
143
+ } & Omit<Partial<AutoPannerOptions>, "context">) | ({
144
+ filterType: "StereoWidenerFilter";
145
+ } & Omit<Partial<StereoWidenerOptions>, "context">);
146
+
147
+ interface ExportedSound {
148
+ options: SoundOptions;
149
+ filters?: SoundFilterMemory[];
150
+ }
151
+ interface SoundPlay {
152
+ stepIndex: number;
153
+ paused: boolean;
154
+ options?: SoundPlayOptions | string;
155
+ }
156
+ interface ExportedSoundPlay extends SoundPlay {
157
+ sound: ExportedSound;
158
+ }
159
+ /**
160
+ * Interface exported sounds
161
+ */
162
+ interface SoundGameState {
163
+ /**
164
+ * @deprecated
165
+ */
166
+ soundsPlaying?: {
167
+ [key: string]: ExportedSoundPlay;
168
+ };
169
+ mediaInstances: {
170
+ [key: string]: {
171
+ channelAlias: string;
172
+ soundAlias: string;
173
+ stepCounter: number;
174
+ options: MediaMemory & {
175
+ filters?: SoundFilterMemory[];
176
+ delay?: number;
177
+ };
178
+ /**
179
+ * @deprecated Use options.paused instead.
180
+ */
181
+ paused?: boolean;
182
+ };
183
+ };
184
+ }
185
+
186
+ export type { ChannelOptions as C, ExportedSound as E, MediaInterface as M, SoundGameState as S, SoundPlayOptions as a, SoundPlayOptionsWithChannel as b, MediaMemory as c, ExportedSoundPlay as d, SoundOptions as e, SoundPlay as f };
@@ -7,7 +7,7 @@ interface StorageGameStateItem<T = StorageElementType> {
7
7
  /**
8
8
  * Interface exported storage data
9
9
  */
10
- type StorageGameState = {
10
+ interface StorageGameState {
11
11
  /**
12
12
  * @deprecated
13
13
  */
@@ -22,6 +22,6 @@ type StorageGameState = {
22
22
  */
23
23
  flags?: string[];
24
24
  main: StorageGameStateItem[];
25
- };
25
+ }
26
26
 
27
27
  export type { StorageGameState as S };