@drincs/pixi-vn 1.6.4 → 1.8.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/README.md +47 -53
- package/dist/{HistoryChoiceMenuOption-DM4wqiGt.d.ts → HistoryChoiceMenuOption-BP9Tsbyd.d.ts} +1 -2
- package/dist/{HistoryChoiceMenuOption-iazqoVVm.d.cts → HistoryChoiceMenuOption-DSSNUXEq.d.cts} +1 -2
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +56 -51
- package/dist/canvas.d.ts +56 -51
- package/dist/canvas.mjs +2 -2
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-L4IHQ3VT.mjs → chunk-3SLELYPF.mjs} +1 -1
- package/dist/chunk-6HI66YQL.mjs +1 -0
- package/dist/chunk-XYO5SLSM.mjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +1 -1
- package/dist/history.d.ts +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -9
- package/dist/index.d.cts +289 -114
- package/dist/index.d.ts +289 -114
- package/dist/index.mjs +2 -9
- package/dist/motion.cjs +1 -1
- package/dist/motion.d.cts +3 -1
- package/dist/motion.d.ts +3 -1
- package/dist/motion.mjs +1 -1
- package/dist/narration.cjs +2 -2
- package/dist/narration.d.cts +3 -3
- package/dist/narration.d.ts +3 -3
- package/dist/narration.mjs +2 -2
- package/dist/pixi/browser.js +183 -171
- package/dist/sound.cjs +1 -1
- package/dist/sound.d.cts +337 -132
- package/dist/sound.d.ts +337 -132
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +63 -12
- package/dist/storage.d.ts +63 -12
- package/dist/storage.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +10 -1
- package/dist/vite.d.ts +10 -1
- package/dist/vite.mjs +1 -1
- package/package.json +21 -13
- package/dist/chunk-D45QSSXG.mjs +0 -1
- package/dist/chunk-EWW7VYPM.mjs +0 -1
- package/dist/chunk-ZW3MIPMS.mjs +0 -1
- /package/dist/{chunk-XSN6P5JL.mjs → chunk-JMOSOAGB.mjs} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlayerOptions, Player, ToneAudioNode, Param, 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
2
|
import * as canvasUtils from '@drincs/pixi-vn/canvas';
|
|
3
3
|
import { StoredChoiceInterface, StorageElementType as StorageElementType$1, OpenedLabel as OpenedLabel$1 } from '@drincs/pixi-vn/canvas';
|
|
4
4
|
export * from '@drincs/pixi-vn/canvas';
|
|
@@ -22,29 +22,94 @@ import { CharacterInterface, GameStepState } from '@drincs/pixi-vn';
|
|
|
22
22
|
import { Difference } from 'microdiff';
|
|
23
23
|
import { Devtools } from '@pixi/devtools';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
interface MediaInterface extends Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state"> {
|
|
26
|
+
/**
|
|
27
|
+
* Whether the sound is currently paused.
|
|
28
|
+
*/
|
|
29
|
+
paused: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use {@link mute} instead.
|
|
32
|
+
*/
|
|
33
|
+
muted: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use {@link playbackRate} instead.
|
|
36
|
+
*/
|
|
37
|
+
speed: number;
|
|
38
|
+
}
|
|
39
|
+
interface MediaMemory extends Partial<Omit<PlayerOptions, "url" | "volume">> {
|
|
40
|
+
/**
|
|
41
|
+
* The volume of this sound in the linear range [0, 1], where 0 is silence
|
|
42
|
+
* and 1 is full volume. Stored and restored in linear form; converted
|
|
43
|
+
* to/from Tone.js decibels internally.
|
|
44
|
+
*/
|
|
45
|
+
volume?: number;
|
|
46
|
+
elapsed: number | undefined;
|
|
47
|
+
paused: boolean;
|
|
48
|
+
delay?: number;
|
|
49
|
+
}
|
|
26
50
|
|
|
27
|
-
interface SoundOptions extends
|
|
51
|
+
interface SoundOptions extends Pick<Partial<PlayerOptions>, "loop" | "autostart" | "fadeIn" | "fadeOut" | "mute" | "loopEnd" | "loopStart" | "reverse" | "playbackRate"> {
|
|
52
|
+
/**
|
|
53
|
+
* The volume of this sound in the linear range [0, 1], where 0 is silence
|
|
54
|
+
* and 1 is full volume. This is converted to decibels internally before
|
|
55
|
+
* being passed to the Tone.js Player.
|
|
56
|
+
*/
|
|
57
|
+
volume?: number;
|
|
58
|
+
/**
|
|
59
|
+
* A collection of audio filters/effects to apply to this sound.
|
|
60
|
+
*
|
|
61
|
+
* Install "tone" for the full list of available filters.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import * as Tone from "tone";
|
|
66
|
+
*
|
|
67
|
+
* const filters = [new Tone.FeedbackDelay("8n", 0.5)];
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filters?: ToneAudioNode[];
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use {@link playbackRate} instead.
|
|
73
|
+
*/
|
|
74
|
+
speed?: number;
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Use {@link mute} instead.
|
|
77
|
+
*/
|
|
78
|
+
muted?: boolean;
|
|
28
79
|
}
|
|
29
|
-
interface SoundPlayOptions extends
|
|
80
|
+
interface SoundPlayOptions extends SoundOptions {
|
|
30
81
|
/**
|
|
31
|
-
* The delay in seconds before playback
|
|
82
|
+
* The delay in seconds before playback starts. If specified, playback is
|
|
83
|
+
* scheduled to begin after the delay has elapsed rather than starting
|
|
84
|
+
* immediately in a paused state.
|
|
32
85
|
*/
|
|
33
86
|
delay?: number;
|
|
87
|
+
/**
|
|
88
|
+
* The offset in seconds from the start of the sound at which to begin playback.
|
|
89
|
+
*/
|
|
90
|
+
elapsed?: number;
|
|
34
91
|
}
|
|
35
92
|
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
36
93
|
/**
|
|
37
|
-
* The alias of the audio channel to play the sound on. If the channel does
|
|
38
|
-
*
|
|
94
|
+
* The alias of the audio channel to play the sound on. If the channel does
|
|
95
|
+
* not exist it will be created automatically.
|
|
96
|
+
* Defaults to `SoundManagerInterface.defaultChannelAlias` ("general").
|
|
39
97
|
*/
|
|
40
98
|
channel?: string;
|
|
41
99
|
}
|
|
42
100
|
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
|
|
43
101
|
/**
|
|
44
102
|
* Whether this channel is a background channel.
|
|
45
|
-
* Background channels are special
|
|
103
|
+
* Background channels are special: media playing on them is not stopped
|
|
104
|
+
* when a scene changes, but continues in the background.
|
|
46
105
|
*/
|
|
47
106
|
background?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The stereo pan position for this channel in the range [-1, 1].
|
|
109
|
+
* -1 is full left, 0 is centre, 1 is full right.
|
|
110
|
+
* Defaults to 0.
|
|
111
|
+
*/
|
|
112
|
+
pan?: number;
|
|
48
113
|
}
|
|
49
114
|
|
|
50
115
|
interface AudioChannelInterface {
|
|
@@ -60,7 +125,7 @@ interface AudioChannelInterface {
|
|
|
60
125
|
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
61
126
|
* has not yet loaded.
|
|
62
127
|
*/
|
|
63
|
-
play(alias: string, options?: SoundPlayOptions): Promise<
|
|
128
|
+
play(alias: string, options?: SoundPlayOptions): Promise<MediaInterface>;
|
|
64
129
|
/**
|
|
65
130
|
* Plays a sound.
|
|
66
131
|
* @param mediaAlias The media alias reference.
|
|
@@ -70,7 +135,12 @@ interface AudioChannelInterface {
|
|
|
70
135
|
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
71
136
|
* has not yet loaded.
|
|
72
137
|
*/
|
|
73
|
-
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<
|
|
138
|
+
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<MediaInterface>;
|
|
139
|
+
/**
|
|
140
|
+
* The stereo pan position for this channel in the range [-1, 1].
|
|
141
|
+
* -1 is full left, 0 is centre, 1 is full right.
|
|
142
|
+
*/
|
|
143
|
+
pan: number;
|
|
74
144
|
/**
|
|
75
145
|
* The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
|
|
76
146
|
*/
|
|
@@ -82,7 +152,7 @@ interface AudioChannelInterface {
|
|
|
82
152
|
/**
|
|
83
153
|
* The MediaInstances currently playing through this channel. This is read-only and cannot be modified directly. Use the play method to add new MediaInstances to this channel.
|
|
84
154
|
*/
|
|
85
|
-
readonly mediaInstances:
|
|
155
|
+
readonly mediaInstances: MediaInterface[];
|
|
86
156
|
/**
|
|
87
157
|
* Whether this channel is a background channel.
|
|
88
158
|
* Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
|
|
@@ -108,45 +178,128 @@ interface AudioChannelInterface {
|
|
|
108
178
|
* @return `true` if all sounds are muted.
|
|
109
179
|
*/
|
|
110
180
|
toggleMuteAll(): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Useful for inserting channel-wide audio effects such as reverb, delay or EQ.
|
|
183
|
+
*
|
|
184
|
+
* Install "tone" to use this method.
|
|
185
|
+
*
|
|
186
|
+
* @param nodes One or more Tone.js {@link ToneAudioNode} instances to chain in series.
|
|
187
|
+
* @return Instance for chaining.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* import * as Tone from "tone";
|
|
192
|
+
*
|
|
193
|
+
* const channel = sound.findChannel("music");
|
|
194
|
+
*
|
|
195
|
+
* // Create a reverb effect and wait for its impulse response to be ready.
|
|
196
|
+
* const reverb = new Tone.Reverb({ decay: 2.5 });
|
|
197
|
+
*
|
|
198
|
+
* // Route the channel through the reverb to the master output.
|
|
199
|
+
* channel.chain(reverb);
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
chain(...nodes: ToneAudioNode[]): this;
|
|
203
|
+
/**
|
|
204
|
+
* **Advanced** — the raw `Tone.Param<"decibels">` for this channel's volume.
|
|
205
|
+
*
|
|
206
|
+
* Unlike the {@link volume} property (which uses a linear 0–1 scale), this
|
|
207
|
+
* Param works directly in **decibels** and exposes all Tone.js automation
|
|
208
|
+
* methods such as `rampTo`, `linearRampTo`, and `exponentialRampTo`.
|
|
209
|
+
*
|
|
210
|
+
* Use this when you need to smoothly automate volume over time instead of
|
|
211
|
+
* setting it instantly.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* const channel = sound.findChannel("music");
|
|
216
|
+
*
|
|
217
|
+
* // Fade the volume from its current level to -12 dB over 3 seconds.
|
|
218
|
+
* channel.volumeParam.rampTo(-12, 3);
|
|
219
|
+
*
|
|
220
|
+
* // Fade to silence over 2 seconds.
|
|
221
|
+
* channel.volumeParam.rampTo(-Infinity, 2);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
readonly volumeParam: Param<"decibels">;
|
|
225
|
+
/**
|
|
226
|
+
* **Advanced** — the raw `Tone.Param<"audioRange">` for this channel's
|
|
227
|
+
* stereo pan position.
|
|
228
|
+
*
|
|
229
|
+
* Unlike the {@link pan} property (which sets the value instantly), this
|
|
230
|
+
* Param exposes all Tone.js automation methods such as `rampTo`,
|
|
231
|
+
* `linearRampTo`, and `exponentialRampTo`.
|
|
232
|
+
*
|
|
233
|
+
* Use this when you need to smoothly automate panning over time instead of
|
|
234
|
+
* setting it instantly. Values range from -1 (full left) to 1 (full right).
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* const channel = sound.findChannel("music");
|
|
239
|
+
*
|
|
240
|
+
* // Gradually pan to the left over 3 seconds.
|
|
241
|
+
* channel.panParam.rampTo(-1, 3);
|
|
242
|
+
*
|
|
243
|
+
* // Return to centre over 2 seconds.
|
|
244
|
+
* channel.panParam.rampTo(0, 2);
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
readonly panParam: Param<"audioRange">;
|
|
111
248
|
}
|
|
112
249
|
|
|
113
|
-
type
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
250
|
+
type SoundFilterMemory = ({
|
|
251
|
+
filterType: "ReverbFilter";
|
|
252
|
+
} & Omit<Partial<ReverbOptions>, "context">) | ({
|
|
253
|
+
filterType: "FeedbackDelayFilter";
|
|
254
|
+
} & Omit<Partial<FeedbackDelayOptions>, "context">) | ({
|
|
255
|
+
filterType: "FreeverbFilter";
|
|
256
|
+
} & Omit<Partial<FreeverbOptions>, "context">) | ({
|
|
257
|
+
filterType: "DelayFilter";
|
|
258
|
+
} & Omit<Partial<DelayOptions>, "context">) | ({
|
|
259
|
+
filterType: "PingPongDelayFilter";
|
|
260
|
+
} & Omit<Partial<PingPongDelayOptions>, "context">) | ({
|
|
261
|
+
filterType: "GateFilter";
|
|
262
|
+
} & Omit<Partial<GateOptions>, "context">) | ({
|
|
263
|
+
filterType: "AutoFilterFilter";
|
|
264
|
+
} & Omit<Partial<AutoFilterOptions>, "context">) | ({
|
|
265
|
+
filterType: "BiquadFilterFilter";
|
|
266
|
+
} & Omit<Partial<BiquadFilterOptions>, "context">) | ({
|
|
267
|
+
filterType: "OnePoleFilterFilter";
|
|
268
|
+
} & Omit<Partial<OnePoleFilterOptions>, "context" | "frequency">) | ({
|
|
269
|
+
filterType: "FeedbackCombFilterFilter";
|
|
270
|
+
} & Omit<Partial<FeedbackCombFilterOptions>, "context">) | ({
|
|
271
|
+
filterType: "CustomFilter";
|
|
272
|
+
} & Omit<Partial<FilterOptions>, "context">) | ({
|
|
273
|
+
filterType: "ChorusFilter";
|
|
274
|
+
} & Omit<Partial<ChorusOptions>, "context">) | ({
|
|
275
|
+
filterType: "PhaserFilter";
|
|
276
|
+
} & Omit<Partial<PhaserOptions>, "context">) | ({
|
|
277
|
+
filterType: "TremoloFilter";
|
|
278
|
+
} & Omit<Partial<TremoloOptions>, "context">) | ({
|
|
279
|
+
filterType: "VibratoFilter";
|
|
280
|
+
} & Omit<Partial<VibratoOptions>, "context">) | ({
|
|
281
|
+
filterType: "CompressorFilter";
|
|
282
|
+
} & Omit<Partial<CompressorOptions>, "context">) | ({
|
|
283
|
+
filterType: "MidSideCompressorFilter";
|
|
284
|
+
} & Omit<Partial<MidSideCompressorOptions>, "context">) | ({
|
|
285
|
+
filterType: "MultibandCompressorFilter";
|
|
286
|
+
} & Omit<Partial<MultibandCompressorOptions>, "context">) | ({
|
|
287
|
+
filterType: "LimiterFilter";
|
|
288
|
+
} & Omit<Partial<LimiterOptions>, "context">) | ({
|
|
289
|
+
filterType: "GreaterThanFilter";
|
|
290
|
+
} & Omit<Partial<GreaterThanOptions>, "context">) | ({
|
|
291
|
+
filterType: "GreaterThanZeroFilter";
|
|
292
|
+
} & Omit<Partial<GreaterThanZeroOptions>, "context">) | ({
|
|
293
|
+
filterType: "DistortionFilter";
|
|
294
|
+
} & Omit<Partial<DistortionOptions>, "context">) | ({
|
|
295
|
+
filterType: "BitCrusherFilter";
|
|
296
|
+
} & Omit<Partial<BitCrusherOptions>, "context">) | ({
|
|
297
|
+
filterType: "Panner3DFilter";
|
|
298
|
+
} & Omit<Partial<Panner3DOptions>, "context">) | ({
|
|
299
|
+
filterType: "AutoPannerFilter";
|
|
300
|
+
} & Omit<Partial<AutoPannerOptions>, "context">) | ({
|
|
301
|
+
filterType: "StereoWidenerFilter";
|
|
302
|
+
} & Omit<Partial<StereoWidenerOptions>, "context">);
|
|
150
303
|
|
|
151
304
|
interface ExportedSound {
|
|
152
305
|
options: SoundOptions;
|
|
@@ -164,7 +317,6 @@ interface ExportedSoundPlay extends SoundPlay {
|
|
|
164
317
|
* Interface exported sounds
|
|
165
318
|
*/
|
|
166
319
|
interface SoundGameState {
|
|
167
|
-
filters?: SoundFilterMemory[];
|
|
168
320
|
/**
|
|
169
321
|
* @deprecated
|
|
170
322
|
*/
|
|
@@ -176,108 +328,130 @@ interface SoundGameState {
|
|
|
176
328
|
channelAlias: string;
|
|
177
329
|
soundAlias: string;
|
|
178
330
|
stepCounter: number;
|
|
179
|
-
options:
|
|
331
|
+
options: MediaMemory & {
|
|
180
332
|
filters?: SoundFilterMemory[];
|
|
333
|
+
delay?: number;
|
|
181
334
|
};
|
|
182
|
-
|
|
335
|
+
/**
|
|
336
|
+
* @deprecated Use options.paused instead.
|
|
337
|
+
*/
|
|
338
|
+
paused?: boolean;
|
|
183
339
|
};
|
|
184
340
|
};
|
|
185
341
|
}
|
|
186
342
|
|
|
187
|
-
interface SoundManagerInterface
|
|
343
|
+
interface SoundManagerInterface {
|
|
344
|
+
/** Master volume in the range [0, 1]. */
|
|
345
|
+
volumeAll: number;
|
|
346
|
+
/**
|
|
347
|
+
* @deprecated Global playback speed. This is not a well-supported feature and may be removed in a future release. Use individual sound speed options instead.
|
|
348
|
+
*/
|
|
349
|
+
speedAll: number;
|
|
350
|
+
/**
|
|
351
|
+
* The default channel alias used when playing a sound without specifying a
|
|
352
|
+
* channel. Defaults to `"general"`.
|
|
353
|
+
*/
|
|
354
|
+
defaultChannelAlias: string;
|
|
188
355
|
/**
|
|
189
|
-
* @deprecated
|
|
356
|
+
* @deprecated Register sound assets directly via `PIXI.Assets` instead.
|
|
190
357
|
*/
|
|
191
|
-
add(alias: string, options: string):
|
|
358
|
+
add(alias: string, options: string): void;
|
|
192
359
|
/**
|
|
193
360
|
* Plays a sound.
|
|
194
361
|
* @param alias The media and sound (asset) alias reference.
|
|
195
|
-
* @param options The options
|
|
196
|
-
* @
|
|
197
|
-
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
198
|
-
* has not yet loaded.
|
|
362
|
+
* @param options The options.
|
|
363
|
+
* @returns The media instance (resolves immediately if already loaded).
|
|
199
364
|
*/
|
|
200
|
-
play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<
|
|
201
|
-
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<
|
|
365
|
+
play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
|
|
366
|
+
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
|
|
202
367
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* @return Media object.
|
|
368
|
+
* Plays a non-persistent ("transient") sound (e.g. UI / menu sounds).
|
|
369
|
+
* Transient playback is not tracked in save/export state.
|
|
206
370
|
*/
|
|
207
|
-
|
|
371
|
+
playTransient(alias: string, options?: Partial<PlayerOptions>): Promise<Player>;
|
|
208
372
|
/**
|
|
209
|
-
*
|
|
210
|
-
* @param alias - The media alias reference.
|
|
373
|
+
* Find a tracked media instance by alias.
|
|
211
374
|
*/
|
|
212
|
-
|
|
375
|
+
find(alias: string): MediaInterface | undefined;
|
|
213
376
|
/**
|
|
214
|
-
*
|
|
215
|
-
* @param alias - The media alias reference.
|
|
216
|
-
* @return Media object.
|
|
377
|
+
* Stop a tracked media instance and remove it from the manager.
|
|
217
378
|
*/
|
|
218
|
-
|
|
379
|
+
stop(alias: string): void;
|
|
219
380
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param alias - The media alias reference.
|
|
222
|
-
* @return Media object.
|
|
381
|
+
* Pause a tracked media instance.
|
|
223
382
|
*/
|
|
224
|
-
|
|
383
|
+
pause(alias: string): MediaInterface | undefined;
|
|
225
384
|
/**
|
|
226
|
-
*
|
|
227
|
-
* If the asset is not yet loaded, it will be loaded with the new options.
|
|
385
|
+
* Resume a paused media instance.
|
|
228
386
|
*/
|
|
229
|
-
|
|
387
|
+
resume(alias: string): MediaInterface | undefined;
|
|
388
|
+
/** Duration in seconds of the loaded sound with the given alias. */
|
|
389
|
+
duration(alias: string): number;
|
|
390
|
+
/** Toggle mute on all sounds. Returns the new muted state. */
|
|
391
|
+
toggleMuteAll(): boolean;
|
|
230
392
|
/**
|
|
231
|
-
*
|
|
232
|
-
* @return Instance for chaining.
|
|
393
|
+
* Whether all sounds are currently muted. Note that individual channels or media instances may still be muted or unmuted; this is just the global master mute state.
|
|
233
394
|
*/
|
|
395
|
+
readonly muted: boolean;
|
|
396
|
+
/** Mute all sounds. */
|
|
397
|
+
muteAll(): this;
|
|
398
|
+
/** Unmute all sounds. */
|
|
399
|
+
unmuteAll(): this;
|
|
400
|
+
/** Stop all sounds. */
|
|
401
|
+
stopAll(): this;
|
|
402
|
+
/** Pause all sounds. */
|
|
234
403
|
pauseAll(): this;
|
|
235
|
-
/**
|
|
236
|
-
* Resumes any sounds.
|
|
237
|
-
* @return Instance for chaining.
|
|
238
|
-
*/
|
|
404
|
+
/** Resume all sounds. */
|
|
239
405
|
resumeAll(): this;
|
|
240
406
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
407
|
+
* Temporarily pause all currently-playing sounds (or just those in the given
|
|
408
|
+
* channel) without persisting the paused state. Useful for overlays / pause
|
|
409
|
+
* menus.
|
|
410
|
+
*
|
|
411
|
+
* Only sounds that are **actively playing** at the time of the call are paused;
|
|
412
|
+
* sounds that were already paused beforehand are left untouched so that they
|
|
413
|
+
* remain paused when {@link resumeUnsavedAll} is called later.
|
|
414
|
+
*
|
|
415
|
+
* When called without a channel argument all transient players started with
|
|
416
|
+
* {@link playTransient} are also stopped.
|
|
243
417
|
*/
|
|
244
|
-
|
|
418
|
+
pauseUnsavedAll(channel?: string): this;
|
|
245
419
|
/**
|
|
246
|
-
*
|
|
247
|
-
* @
|
|
420
|
+
* Resume all sounds (or just those in the given channel) that were paused by
|
|
421
|
+
* the most recent call to {@link pauseUnsavedAll}. Sounds that were already
|
|
422
|
+
* paused before `pauseUnsavedAll` was called are **not** resumed.
|
|
248
423
|
*/
|
|
249
|
-
|
|
424
|
+
resumeUnsavedAll(channel?: string): this;
|
|
250
425
|
/**
|
|
251
|
-
*
|
|
252
|
-
* @return Instance for chaining.
|
|
426
|
+
* Stop all transient media instances started with {@link playTransient}.
|
|
253
427
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
428
|
+
stopTransientAll(): this;
|
|
429
|
+
/** Load one or more sound assets. */
|
|
430
|
+
load(...alias: string[]): Promise<void>;
|
|
431
|
+
/** Trigger background loading of one or more sound assets. */
|
|
432
|
+
backgroundLoad(...alias: string[]): Promise<void>;
|
|
433
|
+
/** Trigger background loading of a sound bundle. */
|
|
257
434
|
backgroundLoadBundle(alias: string): Promise<void>;
|
|
435
|
+
/** Stop all sounds and clear internal state. */
|
|
258
436
|
clear(): void;
|
|
259
437
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* @returns The created AudioChannelInterface instance, or undefined if a channel with the alias already exists.
|
|
438
|
+
* Add a new audio channel.
|
|
439
|
+
* Returns the created channel, or `undefined` if the alias already exists.
|
|
263
440
|
*/
|
|
264
441
|
addChannel(alias: string | string[], options?: ChannelOptions): AudioChannelInterface | undefined;
|
|
265
442
|
/**
|
|
266
|
-
*
|
|
267
|
-
* @param alias The alias of the audio channel to find.
|
|
268
|
-
* @returns The AudioChannelInterface instance associated with the alias.
|
|
443
|
+
* Find the channel for the given alias, creating it if it does not yet exist.
|
|
269
444
|
*/
|
|
270
445
|
findChannel(alias: string): AudioChannelInterface;
|
|
271
|
-
/**
|
|
272
|
-
* Returns an array of all existing audio channels.
|
|
273
|
-
*/
|
|
446
|
+
/** All registered audio channels. */
|
|
274
447
|
readonly channels: AudioChannelInterface[];
|
|
275
448
|
/**
|
|
276
|
-
*
|
|
277
|
-
* By default, this is set to `GENERAL_CHANNEL` ("general"), but it can be changed to any string; if the channel does not yet exist, it will be created on demand when used.
|
|
449
|
+
* Export the current sound state, including currently playing sounds and their options, for saving or debugging purposes. This is not guaranteed to be stable across versions and may contain implementation details; it is not intended for use in general application code.
|
|
278
450
|
*/
|
|
279
|
-
defaultChannelAlias: string;
|
|
280
451
|
export(): SoundGameState;
|
|
452
|
+
/**
|
|
453
|
+
* Restore a sound state exported by {@link export}. This will stop any currently playing sounds and replace them with the sounds specified in the exported state. This is not guaranteed to be stable across versions and may contain implementation details; it is not intended for use in general application code.
|
|
454
|
+
*/
|
|
281
455
|
restore(data: object): Promise<void>;
|
|
282
456
|
}
|
|
283
457
|
|
|
@@ -535,7 +709,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
|
|
|
535
709
|
elements: CanvasBaseItemMemory[];
|
|
536
710
|
}
|
|
537
711
|
|
|
538
|
-
var version = "1.
|
|
712
|
+
var version = "1.8.0";
|
|
539
713
|
|
|
540
714
|
/**
|
|
541
715
|
* @deprecated
|
|
@@ -552,10 +726,6 @@ declare function Pause(duration: number): PauseType;
|
|
|
552
726
|
* Is a special alias to indicate the game layer.
|
|
553
727
|
*/
|
|
554
728
|
declare const CANVAS_APP_GAME_LAYER_ALIAS = "__game_layer__";
|
|
555
|
-
/**
|
|
556
|
-
* The default audio channel for sounds that don't specify one.
|
|
557
|
-
*/
|
|
558
|
-
declare const GENERAL_CHANNEL = "general";
|
|
559
729
|
declare const SYSTEM_RESERVED_STORAGE_KEYS: {
|
|
560
730
|
/**
|
|
561
731
|
* The key of the current dialogue memory
|
|
@@ -850,7 +1020,12 @@ declare namespace Game {
|
|
|
850
1020
|
/**
|
|
851
1021
|
* Load the save data
|
|
852
1022
|
* @param data The save data
|
|
853
|
-
|
|
1023
|
+
*/
|
|
1024
|
+
function restoreGameState(data: GameState): Promise<void>;
|
|
1025
|
+
/**
|
|
1026
|
+
* @deprecated Use `restoreGameState(data)` (without the `navigate` argument) and configure navigation via `Game.init({ navigate })` or `Game.onNavigate(...)`.
|
|
1027
|
+
* @param data The save data
|
|
1028
|
+
* @param navigate Navigation function to use for this restore call.
|
|
854
1029
|
*/
|
|
855
1030
|
function restoreGameState(data: GameState, navigate: (path: string) => void | Promise<void>): Promise<void>;
|
|
856
1031
|
/**
|
|
@@ -979,4 +1154,4 @@ declare const _default: {
|
|
|
979
1154
|
PIXIVN_VERSION: string;
|
|
980
1155
|
};
|
|
981
1156
|
|
|
982
|
-
export { CANVAS_APP_GAME_LAYER_ALIAS, CachedMap,
|
|
1157
|
+
export { CANVAS_APP_GAME_LAYER_ALIAS, CachedMap, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, Pause, Repeat, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };
|