@drincs/pixi-vn 1.7.2 → 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/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.mjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-X4NBVTSJ.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.d.cts +1 -1
- package/dist/history.d.ts +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +272 -166
- package/dist/index.d.ts +272 -166
- package/dist/index.mjs +2 -2
- 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/sound.cjs +1 -1
- package/dist/sound.d.cts +326 -181
- package/dist/sound.d.ts +326 -181
- package/dist/sound.mjs +1 -1
- package/dist/storage.mjs +1 -1
- package/package.json +11 -8
- package/dist/chunk-4KCAZKAJ.mjs +0 -1
- package/dist/chunk-HNGW4ITF.mjs +0 -1
- package/dist/chunk-YDNEIPJP.mjs +0 -1
package/dist/index.d.ts
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,33 +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;
|
|
34
87
|
/**
|
|
35
|
-
*
|
|
88
|
+
* The offset in seconds from the start of the sound at which to begin playback.
|
|
36
89
|
*/
|
|
37
|
-
|
|
90
|
+
elapsed?: number;
|
|
38
91
|
}
|
|
39
92
|
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
40
93
|
/**
|
|
41
|
-
* The alias of the audio channel to play the sound on. If the channel does
|
|
42
|
-
*
|
|
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").
|
|
43
97
|
*/
|
|
44
98
|
channel?: string;
|
|
45
99
|
}
|
|
46
|
-
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"
|
|
100
|
+
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
|
|
47
101
|
/**
|
|
48
102
|
* Whether this channel is a background channel.
|
|
49
|
-
* 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.
|
|
50
105
|
*/
|
|
51
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;
|
|
52
113
|
}
|
|
53
114
|
|
|
54
115
|
interface AudioChannelInterface {
|
|
@@ -64,7 +125,7 @@ interface AudioChannelInterface {
|
|
|
64
125
|
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
65
126
|
* has not yet loaded.
|
|
66
127
|
*/
|
|
67
|
-
play(alias: string, options?: SoundPlayOptions): Promise<
|
|
128
|
+
play(alias: string, options?: SoundPlayOptions): Promise<MediaInterface>;
|
|
68
129
|
/**
|
|
69
130
|
* Plays a sound.
|
|
70
131
|
* @param mediaAlias The media alias reference.
|
|
@@ -74,22 +135,12 @@ interface AudioChannelInterface {
|
|
|
74
135
|
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
75
136
|
* has not yet loaded.
|
|
76
137
|
*/
|
|
77
|
-
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<
|
|
138
|
+
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<MediaInterface>;
|
|
78
139
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @param soundAlias The sound (asset) alias reference.
|
|
82
|
-
* @param options The options.
|
|
83
|
-
* @return The sound instance.
|
|
84
|
-
*/
|
|
85
|
-
playTransient(soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
|
|
86
|
-
/**
|
|
87
|
-
* Stops all media instances that were started with {@link playTransient} on this channel.
|
|
88
|
-
* Instances that have already ended are automatically removed, so this only affects
|
|
89
|
-
* those that are still playing or paused.
|
|
90
|
-
* @return Instance for chaining.
|
|
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.
|
|
91
142
|
*/
|
|
92
|
-
|
|
143
|
+
pan: number;
|
|
93
144
|
/**
|
|
94
145
|
* The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
|
|
95
146
|
*/
|
|
@@ -101,7 +152,7 @@ interface AudioChannelInterface {
|
|
|
101
152
|
/**
|
|
102
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.
|
|
103
154
|
*/
|
|
104
|
-
readonly mediaInstances:
|
|
155
|
+
readonly mediaInstances: MediaInterface[];
|
|
105
156
|
/**
|
|
106
157
|
* Whether this channel is a background channel.
|
|
107
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.
|
|
@@ -117,17 +168,6 @@ interface AudioChannelInterface {
|
|
|
117
168
|
* @return Instance for chaining.
|
|
118
169
|
*/
|
|
119
170
|
pauseAll(): this;
|
|
120
|
-
/**
|
|
121
|
-
* Temporarily pauses this channel without mutating each media instance's persisted paused option.
|
|
122
|
-
* Useful for overlays (for example settings/pause menus) where pause state must not be saved.
|
|
123
|
-
* @return Instance for chaining.
|
|
124
|
-
*/
|
|
125
|
-
pauseUnsavedAll(): this;
|
|
126
|
-
/**
|
|
127
|
-
* Restores this channel after `pauseUnsavedAll()`, reapplying each media instance's persisted paused option.
|
|
128
|
-
* @return Instance for chaining.
|
|
129
|
-
*/
|
|
130
|
-
resumeUnsavedAll(): this;
|
|
131
171
|
/**
|
|
132
172
|
* Resumes any sounds.
|
|
133
173
|
* @return Instance for chaining.
|
|
@@ -138,45 +178,128 @@ interface AudioChannelInterface {
|
|
|
138
178
|
* @return `true` if all sounds are muted.
|
|
139
179
|
*/
|
|
140
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">;
|
|
141
248
|
}
|
|
142
249
|
|
|
143
|
-
type
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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">);
|
|
180
303
|
|
|
181
304
|
interface ExportedSound {
|
|
182
305
|
options: SoundOptions;
|
|
@@ -194,7 +317,6 @@ interface ExportedSoundPlay extends SoundPlay {
|
|
|
194
317
|
* Interface exported sounds
|
|
195
318
|
*/
|
|
196
319
|
interface SoundGameState {
|
|
197
|
-
filters?: SoundFilterMemory[];
|
|
198
320
|
/**
|
|
199
321
|
* @deprecated
|
|
200
322
|
*/
|
|
@@ -206,8 +328,9 @@ interface SoundGameState {
|
|
|
206
328
|
channelAlias: string;
|
|
207
329
|
soundAlias: string;
|
|
208
330
|
stepCounter: number;
|
|
209
|
-
options:
|
|
331
|
+
options: MediaMemory & {
|
|
210
332
|
filters?: SoundFilterMemory[];
|
|
333
|
+
delay?: number;
|
|
211
334
|
};
|
|
212
335
|
/**
|
|
213
336
|
* @deprecated Use options.paused instead.
|
|
@@ -217,131 +340,118 @@ interface SoundGameState {
|
|
|
217
340
|
};
|
|
218
341
|
}
|
|
219
342
|
|
|
220
|
-
interface SoundManagerInterface
|
|
343
|
+
interface SoundManagerInterface {
|
|
344
|
+
/** Master volume in the range [0, 1]. */
|
|
345
|
+
volumeAll: number;
|
|
221
346
|
/**
|
|
222
|
-
* @deprecated
|
|
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.
|
|
223
348
|
*/
|
|
224
|
-
|
|
349
|
+
speedAll: number;
|
|
225
350
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* @param options The options
|
|
229
|
-
* @return The sound instance,
|
|
230
|
-
* this cannot be reused after it is done playing. Returns a Promise if the sound
|
|
231
|
-
* has not yet loaded.
|
|
351
|
+
* The default channel alias used when playing a sound without specifying a
|
|
352
|
+
* channel. Defaults to `"general"`.
|
|
232
353
|
*/
|
|
233
|
-
|
|
234
|
-
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
354
|
+
defaultChannelAlias: string;
|
|
235
355
|
/**
|
|
236
|
-
*
|
|
237
|
-
* This playback is not tracked in save/export state.
|
|
238
|
-
* @param alias The sound (asset) alias reference.
|
|
239
|
-
* @param options The options.
|
|
240
|
-
* @return The sound instance.
|
|
356
|
+
* @deprecated Register sound assets directly via `PIXI.Assets` instead.
|
|
241
357
|
*/
|
|
242
|
-
|
|
358
|
+
add(alias: string, options: string): void;
|
|
243
359
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* @
|
|
248
|
-
* @return Instance for chaining.
|
|
360
|
+
* Plays a sound.
|
|
361
|
+
* @param alias The media and sound (asset) alias reference.
|
|
362
|
+
* @param options The options.
|
|
363
|
+
* @returns The media instance (resolves immediately if already loaded).
|
|
249
364
|
*/
|
|
250
|
-
|
|
365
|
+
play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
|
|
366
|
+
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
|
|
251
367
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* @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.
|
|
255
370
|
*/
|
|
256
|
-
|
|
371
|
+
playTransient(alias: string, options?: Partial<PlayerOptions>): Promise<Player>;
|
|
257
372
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @param alias - The media alias reference.
|
|
373
|
+
* Find a tracked media instance by alias.
|
|
260
374
|
*/
|
|
261
|
-
|
|
375
|
+
find(alias: string): MediaInterface | undefined;
|
|
262
376
|
/**
|
|
263
|
-
*
|
|
264
|
-
* @param alias - The media alias reference.
|
|
265
|
-
* @return Media object.
|
|
377
|
+
* Stop a tracked media instance and remove it from the manager.
|
|
266
378
|
*/
|
|
267
|
-
|
|
379
|
+
stop(alias: string): void;
|
|
268
380
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @param alias - The media alias reference.
|
|
271
|
-
* @return Media object.
|
|
381
|
+
* Pause a tracked media instance.
|
|
272
382
|
*/
|
|
273
|
-
|
|
383
|
+
pause(alias: string): MediaInterface | undefined;
|
|
274
384
|
/**
|
|
275
|
-
*
|
|
276
|
-
* If the asset is not yet loaded, it will be loaded with the new options.
|
|
385
|
+
* Resume a paused media instance.
|
|
277
386
|
*/
|
|
278
|
-
|
|
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;
|
|
279
392
|
/**
|
|
280
|
-
*
|
|
281
|
-
* @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.
|
|
282
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. */
|
|
283
403
|
pauseAll(): this;
|
|
284
|
-
/**
|
|
285
|
-
* Resumes any sounds.
|
|
286
|
-
* @return Instance for chaining.
|
|
287
|
-
*/
|
|
404
|
+
/** Resume all sounds. */
|
|
288
405
|
resumeAll(): this;
|
|
289
406
|
/**
|
|
290
|
-
* Temporarily
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
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.
|
|
295
417
|
*/
|
|
296
418
|
pauseUnsavedAll(channel?: string): this;
|
|
297
419
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* @return Instance for chaining.
|
|
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.
|
|
302
423
|
*/
|
|
303
424
|
resumeUnsavedAll(channel?: string): this;
|
|
304
425
|
/**
|
|
305
|
-
*
|
|
306
|
-
* @return Instance for chaining.
|
|
307
|
-
*/
|
|
308
|
-
muteAll(): this;
|
|
309
|
-
/**
|
|
310
|
-
* Unmutes all playing sounds.
|
|
311
|
-
* @return Instance for chaining.
|
|
312
|
-
*/
|
|
313
|
-
unmuteAll(): this;
|
|
314
|
-
/**
|
|
315
|
-
* Stops all sounds.
|
|
316
|
-
* @return Instance for chaining.
|
|
426
|
+
* Stop all transient media instances started with {@link playTransient}.
|
|
317
427
|
*/
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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. */
|
|
321
434
|
backgroundLoadBundle(alias: string): Promise<void>;
|
|
435
|
+
/** Stop all sounds and clear internal state. */
|
|
322
436
|
clear(): void;
|
|
323
437
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* @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.
|
|
327
440
|
*/
|
|
328
441
|
addChannel(alias: string | string[], options?: ChannelOptions): AudioChannelInterface | undefined;
|
|
329
442
|
/**
|
|
330
|
-
*
|
|
331
|
-
* @param alias The alias of the audio channel to find.
|
|
332
|
-
* @returns The AudioChannelInterface instance associated with the alias.
|
|
443
|
+
* Find the channel for the given alias, creating it if it does not yet exist.
|
|
333
444
|
*/
|
|
334
445
|
findChannel(alias: string): AudioChannelInterface;
|
|
335
|
-
/**
|
|
336
|
-
* Returns an array of all existing audio channels.
|
|
337
|
-
*/
|
|
446
|
+
/** All registered audio channels. */
|
|
338
447
|
readonly channels: AudioChannelInterface[];
|
|
339
448
|
/**
|
|
340
|
-
*
|
|
341
|
-
* 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.
|
|
342
450
|
*/
|
|
343
|
-
defaultChannelAlias: string;
|
|
344
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
|
+
*/
|
|
345
455
|
restore(data: object): Promise<void>;
|
|
346
456
|
}
|
|
347
457
|
|
|
@@ -599,7 +709,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
|
|
|
599
709
|
elements: CanvasBaseItemMemory[];
|
|
600
710
|
}
|
|
601
711
|
|
|
602
|
-
var version = "1.
|
|
712
|
+
var version = "1.8.0";
|
|
603
713
|
|
|
604
714
|
/**
|
|
605
715
|
* @deprecated
|
|
@@ -616,10 +726,6 @@ declare function Pause(duration: number): PauseType;
|
|
|
616
726
|
* Is a special alias to indicate the game layer.
|
|
617
727
|
*/
|
|
618
728
|
declare const CANVAS_APP_GAME_LAYER_ALIAS = "__game_layer__";
|
|
619
|
-
/**
|
|
620
|
-
* The default audio channel for sounds that don't specify one.
|
|
621
|
-
*/
|
|
622
|
-
declare const GENERAL_CHANNEL = "general";
|
|
623
729
|
declare const SYSTEM_RESERVED_STORAGE_KEYS: {
|
|
624
730
|
/**
|
|
625
731
|
* The key of the current dialogue memory
|
|
@@ -1048,4 +1154,4 @@ declare const _default: {
|
|
|
1048
1154
|
PIXIVN_VERSION: string;
|
|
1049
1155
|
};
|
|
1050
1156
|
|
|
1051
|
-
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 };
|