@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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { IMediaInstance as IMediaInstance$1, PlayOptions, Options, SoundLibrary, Sound } from '@pixi/sound';
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
- type IMediaInstance = Omit<IMediaInstance$1, "on" | "destroy" | "init" | "off" | "once" | "toString">;
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 Omit<Options, "complete" | "loaded" | "sprites" | "source"> {
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 Omit<PlayOptions, "complete" | "loaded"> {
80
+ interface SoundPlayOptions extends SoundOptions {
30
81
  /**
31
- * The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
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
- * Whether the sound is paused. If specified, the sound will be paused or unpaused according to the value. If not specified, the sound will play without being paused or unpaused.
88
+ * The offset in seconds from the start of the sound at which to begin playback.
36
89
  */
37
- paused?: boolean;
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 not exist, it will be created.
42
- * If not specified, the sound will be played on the default channel (see `SoundManagerInterface.defaultChannelAlias`).
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" | "paused"> {
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 channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
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<IMediaInstance>;
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<IMediaInstance>;
138
+ play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<MediaInterface>;
78
139
  /**
79
- * Plays a non-persistent sound on this channel.
80
- * The returned media is not tracked by the sound manager and is therefore excluded from save/export state.
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
- stopTransientAll(): this;
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: IMediaInstance[];
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 DistortionFilter = {
144
- type: "DistortionFilter";
145
- amount?: number;
146
- };
147
- type EqualizerFilter = {
148
- type: "EqualizerFilter";
149
- f32?: number;
150
- f64?: number;
151
- f125?: number;
152
- f250?: number;
153
- f500?: number;
154
- f1k?: number;
155
- f2k?: number;
156
- f4k?: number;
157
- f8k?: number;
158
- f16k?: number;
159
- };
160
- type MonoFilter = {
161
- type: "MonoFilter";
162
- };
163
- type ReverbFilter = {
164
- type: "ReverbFilter";
165
- seconds?: number;
166
- decay?: number;
167
- reverse?: boolean;
168
- };
169
- type StereoFilter = {
170
- type: "StereoFilter";
171
- pan?: number;
172
- };
173
- type StreamFilter = {
174
- type: "StreamFilter";
175
- };
176
- type TelephoneFilter = {
177
- type: "TelephoneFilter";
178
- };
179
- type SoundFilterMemory = DistortionFilter | EqualizerFilter | MonoFilter | ReverbFilter | StereoFilter | StreamFilter | TelephoneFilter;
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: Omit<SoundPlayOptions, "filters"> & {
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 extends Omit<SoundLibrary, "init" | "close" | "add" | "play" | "volume" | "speed" | "remove" | "exists" | "find" | "stop" | "pause" | "resume" | "pauseAll" | "resumeAll" | "muteAll" | "unmuteAll" | "stopAll" | "removeAll" | "togglePauseAll"> {
343
+ interface SoundManagerInterface {
344
+ /** Master volume in the range [0, 1]. */
345
+ volumeAll: number;
221
346
  /**
222
- * @deprecated You can define sound assets directly in `PIXI.Assets`
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
- add(alias: string, options: string): Sound;
349
+ speedAll: number;
225
350
  /**
226
- * Plays a sound.
227
- * @param alias The media and sound (asset) alias reference.
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
- play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
234
- play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
354
+ defaultChannelAlias: string;
235
355
  /**
236
- * Plays a non-persistent sound (for example UI/menu sounds).
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
- playTransient(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
358
+ add(alias: string, options: string): void;
243
359
  /**
244
- * Stops all transient media instances started with {@link playTransient}.
245
- * If `channel` is provided only instances on that channel are stopped;
246
- * otherwise all channels are affected.
247
- * @param channel Optional channel alias to limit the operation to.
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
- stopTransientAll(channel?: string): this;
365
+ play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
366
+ play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<MediaInterface>;
251
367
  /**
252
- * Find a media by alias.
253
- * @param alias - The media alias reference.
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
- find(alias: string): IMediaInstance | undefined;
371
+ playTransient(alias: string, options?: Partial<PlayerOptions>): Promise<Player>;
257
372
  /**
258
- * Stops a media and removes it from the manager.
259
- * @param alias - The media alias reference.
373
+ * Find a tracked media instance by alias.
260
374
  */
261
- stop(alias: string): void;
375
+ find(alias: string): MediaInterface | undefined;
262
376
  /**
263
- * Pauses a media.
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
- pause(alias: string): IMediaInstance | undefined;
379
+ stop(alias: string): void;
268
380
  /**
269
- * Resumes a media.
270
- * @param alias - The media alias reference.
271
- * @return Media object.
381
+ * Pause a tracked media instance.
272
382
  */
273
- resume(alias: string): IMediaInstance | undefined;
383
+ pause(alias: string): MediaInterface | undefined;
274
384
  /**
275
- * Edits the options of an existing sound (asset).
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
- edit(alias: string, options: SoundOptions): Promise<void>;
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
- * Pauses any playing sounds.
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 pauses all sounds across all channels (or just the given channel) without
291
- * mutating each media instance's persisted paused option.
292
- * Useful for overlays (for example settings/pause menus) where pause state must not be saved.
293
- * @param channel Optional channel alias to limit the operation to.
294
- * @return Instance for chaining.
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
- * Restores all channels (or just the given channel) after `pauseUnsavedAll()`,
299
- * reapplying each media instance's persisted paused option.
300
- * @param channel Optional channel alias to limit the operation to.
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
- * Mutes all playing sounds.
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
- stopAll(): this;
319
- load(alias: string | string[]): Promise<Sound[]>;
320
- backgroundLoad(alias: string | string[]): Promise<void>;
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
- * Adds a new audio channel with the specified alias(es).
325
- * @param alias The alias or aliases for the new channel.
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
- * Finds and returns the audio channel associated with the given alias. If the channel does not exist, it will be created.
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
- * The default channel alias to use when playing a sound without specifying a channel.
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.7.2";
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, GENERAL_CHANNEL, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, Pause, Repeat, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };
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 };