audioq 2.0.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/info.js ADDED
@@ -0,0 +1,529 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Audio information and progress tracking functions for the audioq package
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.offAudioComplete = exports.offAudioStart = exports.offAudioResume = exports.offAudioPause = exports.onAudioResume = exports.onAudioPause = exports.onAudioComplete = exports.onAudioStart = exports.offQueueChange = exports.onQueueChange = exports.onAudioProgress = exports.getQueueSnapshot = exports.getAllChannelsInfo = exports.getCurrentAudioInfo = exports.audioChannels = exports.getNonWhitelistedChannelProperties = exports.getWhitelistedChannelProperties = void 0;
7
+ exports.offAudioProgress = offAudioProgress;
8
+ const types_1 = require("./types");
9
+ const utils_1 = require("./utils");
10
+ const events_1 = require("./events");
11
+ /**
12
+ * Gets the current list of whitelisted channel properties
13
+ * This is automatically derived from the ExtendedAudioQueueChannel interface
14
+ * @returns Array of whitelisted property names
15
+ * @internal
16
+ */
17
+ const getWhitelistedChannelProperties = () => {
18
+ // Create a sample channel object to extract property names
19
+ const sampleChannel = {
20
+ audioCompleteCallbacks: new Set(),
21
+ audioErrorCallbacks: new Set(),
22
+ audioPauseCallbacks: new Set(),
23
+ audioResumeCallbacks: new Set(),
24
+ audioStartCallbacks: new Set(),
25
+ isPaused: false,
26
+ progressCallbacks: new Map(),
27
+ queue: [],
28
+ queueChangeCallbacks: new Set(),
29
+ volume: 1.0
30
+ };
31
+ // Get all property names from the interface (including optional ones)
32
+ const propertyNames = [
33
+ ...Object.getOwnPropertyNames(sampleChannel),
34
+ // Add optional properties that might not be present on the sample
35
+ 'fadeState',
36
+ 'isLocked',
37
+ 'maxQueueSize',
38
+ 'retryConfig',
39
+ 'volumeConfig', // Legacy property that might still be used
40
+ 'webAudioContext', // Web Audio API context
41
+ 'webAudioNodes' // Web Audio API nodes map
42
+ ];
43
+ return [...new Set(propertyNames)]; // Remove duplicates
44
+ };
45
+ exports.getWhitelistedChannelProperties = getWhitelistedChannelProperties;
46
+ /**
47
+ * Returns the list of non-whitelisted properties found on a specific channel
48
+ * These are properties that will trigger warnings when modified directly
49
+ * @param channelNumber - The channel number to inspect (defaults to 0)
50
+ * @returns Array of property names that are not in the whitelist, or empty array if channel doesn't exist
51
+ * @example
52
+ * ```typescript
53
+ * // Add some custom property to a channel
54
+ * (audioChannels[0] as any).customProperty = 'test';
55
+ *
56
+ * const nonWhitelisted = getNonWhitelistedChannelProperties(0);
57
+ * console.log(nonWhitelisted); // ['customProperty']
58
+ * ```
59
+ * @internal
60
+ */
61
+ const getNonWhitelistedChannelProperties = (channelNumber = 0) => {
62
+ const channel = exports.audioChannels[channelNumber];
63
+ if (!channel) {
64
+ return [];
65
+ }
66
+ const whitelistedProperties = (0, exports.getWhitelistedChannelProperties)();
67
+ const allChannelProperties = Object.getOwnPropertyNames(channel);
68
+ // Filter out properties that are in the whitelist
69
+ const nonWhitelistedProperties = allChannelProperties.filter((property) => !whitelistedProperties.includes(property));
70
+ return nonWhitelistedProperties;
71
+ };
72
+ exports.getNonWhitelistedChannelProperties = getNonWhitelistedChannelProperties;
73
+ /**
74
+ * Global array to store audio channels with their queues and callback management
75
+ * Each channel maintains its own audio queue and event callback sets
76
+ *
77
+ * Note: While you can inspect this array for debugging, direct modification is discouraged.
78
+ * Use the provided API functions for safe channel management.
79
+ */
80
+ exports.audioChannels = new Proxy([], {
81
+ deleteProperty(target, prop) {
82
+ if (typeof prop === 'string' && !isNaN(Number(prop))) {
83
+ // eslint-disable-next-line no-console
84
+ console.warn('Warning: Direct deletion from audioChannels detected. ' +
85
+ 'Consider using stopAllAudioInChannel() for proper cleanup.');
86
+ }
87
+ delete target[prop];
88
+ return true;
89
+ },
90
+ get(target, prop) {
91
+ const value = target[prop];
92
+ // Return channel objects with warnings on modification attempts
93
+ if (typeof value === 'object' &&
94
+ value !== null &&
95
+ typeof prop === 'string' &&
96
+ !isNaN(Number(prop))) {
97
+ return new Proxy(value, {
98
+ set(channelTarget, channelProp, channelValue) {
99
+ // Allow internal modifications but warn about direct property changes
100
+ // Use the automatically-derived whitelist from the interface
101
+ const whitelistedProperties = (0, exports.getWhitelistedChannelProperties)();
102
+ if (typeof channelProp === 'string' && !whitelistedProperties.includes(channelProp)) {
103
+ // eslint-disable-next-line no-console
104
+ console.warn(`Warning: Direct modification of channel.${channelProp} detected. ` +
105
+ 'Use API functions for safer channel management.');
106
+ }
107
+ const key = typeof channelProp === 'symbol' ? channelProp.toString() : channelProp;
108
+ channelTarget[key] = channelValue;
109
+ return true;
110
+ }
111
+ });
112
+ }
113
+ return value;
114
+ },
115
+ set(target, prop, value) {
116
+ // Allow normal array operations
117
+ const key = typeof prop === 'symbol' ? prop.toString() : prop;
118
+ target[key] = value;
119
+ return true;
120
+ }
121
+ });
122
+ /**
123
+ * Validates a channel number against MAX_CHANNELS limit
124
+ * @param channelNumber - The channel number to validate
125
+ * @throws Error if the channel number is invalid
126
+ * @internal
127
+ */
128
+ const validateChannelNumber = (channelNumber) => {
129
+ if (channelNumber < 0) {
130
+ throw new Error('Channel number must be non-negative');
131
+ }
132
+ if (channelNumber >= types_1.MAX_CHANNELS) {
133
+ throw new Error(`Channel number ${channelNumber} exceeds maximum allowed channels (${types_1.MAX_CHANNELS})`);
134
+ }
135
+ };
136
+ /**
137
+ * Gets current audio information for a specific channel
138
+ * @param channelNumber - The channel number (defaults to 0)
139
+ * @returns AudioInfo object or null if no audio is playing
140
+ * @example
141
+ * ```typescript
142
+ * const info = getCurrentAudioInfo(0);
143
+ * if (info) {
144
+ * console.log(`Currently playing: ${info.fileName}`);
145
+ * console.log(`Progress: ${(info.progress * 100).toFixed(1)}%`);
146
+ * }
147
+ * ```
148
+ */
149
+ const getCurrentAudioInfo = (channelNumber = 0) => {
150
+ const channel = exports.audioChannels[channelNumber];
151
+ if (!channel || channel.queue.length === 0) {
152
+ return null;
153
+ }
154
+ const currentAudio = channel.queue[0];
155
+ return (0, utils_1.getAudioInfoFromElement)(currentAudio, channelNumber, exports.audioChannels);
156
+ };
157
+ exports.getCurrentAudioInfo = getCurrentAudioInfo;
158
+ /**
159
+ * Gets audio information for all channels
160
+ * @returns Array of AudioInfo objects (null for channels with no audio)
161
+ * @example
162
+ * ```typescript
163
+ * const allInfo = getAllChannelsInfo();
164
+ * allInfo.forEach((info, channel) => {
165
+ * if (info) {
166
+ * console.log(`Channel ${channel}: ${info.fileName}`);
167
+ * }
168
+ * });
169
+ * ```
170
+ */
171
+ const getAllChannelsInfo = () => {
172
+ const allChannelsInfo = [];
173
+ for (let i = 0; i < exports.audioChannels.length; i++) {
174
+ allChannelsInfo.push((0, exports.getCurrentAudioInfo)(i));
175
+ }
176
+ return allChannelsInfo;
177
+ };
178
+ exports.getAllChannelsInfo = getAllChannelsInfo;
179
+ /**
180
+ * Gets a complete snapshot of the queue state for a specific channel
181
+ * @param channelNumber - The channel number (defaults to 0)
182
+ * @returns QueueSnapshot object or null if channel doesn't exist
183
+ * @example
184
+ * ```typescript
185
+ * const snapshot = getQueueSnapshot();
186
+ * if (snapshot) {
187
+ * console.log(`Queue has ${snapshot.totalItems} items`);
188
+ * console.log(`Currently playing: ${snapshot.items[0]?.fileName}`);
189
+ * }
190
+ * const channelSnapshot = getQueueSnapshot(2);
191
+ * ```
192
+ */
193
+ const getQueueSnapshot = (channelNumber = 0) => {
194
+ return (0, utils_1.createQueueSnapshot)(channelNumber, exports.audioChannels);
195
+ };
196
+ exports.getQueueSnapshot = getQueueSnapshot;
197
+ /**
198
+ * Subscribes to real-time progress updates for a specific channel
199
+ * @param channelNumber - The channel number
200
+ * @param callback - Function to call with audio info updates
201
+ * @throws Error if the channel number exceeds the maximum allowed channels
202
+ * @example
203
+ * ```typescript
204
+ * onAudioProgress(0, (info) => {
205
+ * updateProgressBar(info.progress);
206
+ * updateTimeDisplay(info.currentTime, info.duration);
207
+ * });
208
+ * ```
209
+ */
210
+ const onAudioProgress = (channelNumber, callback) => {
211
+ validateChannelNumber(channelNumber);
212
+ if (!exports.audioChannels[channelNumber]) {
213
+ exports.audioChannels[channelNumber] = {
214
+ audioCompleteCallbacks: new Set(),
215
+ audioErrorCallbacks: new Set(),
216
+ audioPauseCallbacks: new Set(),
217
+ audioResumeCallbacks: new Set(),
218
+ audioStartCallbacks: new Set(),
219
+ isPaused: false,
220
+ progressCallbacks: new Map(),
221
+ queue: [],
222
+ queueChangeCallbacks: new Set(),
223
+ volume: 1.0
224
+ };
225
+ }
226
+ const channel = exports.audioChannels[channelNumber];
227
+ if (!channel.progressCallbacks) {
228
+ channel.progressCallbacks = new Map();
229
+ }
230
+ // Add callback for current audio if exists
231
+ if (channel.queue.length > 0) {
232
+ const currentAudio = channel.queue[0];
233
+ if (!channel.progressCallbacks.has(currentAudio)) {
234
+ channel.progressCallbacks.set(currentAudio, new Set());
235
+ }
236
+ channel.progressCallbacks.get(currentAudio).add(callback);
237
+ // Set up tracking if not already done
238
+ (0, events_1.setupProgressTracking)(currentAudio, channelNumber, exports.audioChannels);
239
+ }
240
+ // Store callback for future audio elements in this channel
241
+ if (!channel.progressCallbacks.has(types_1.GLOBAL_PROGRESS_KEY)) {
242
+ channel.progressCallbacks.set(types_1.GLOBAL_PROGRESS_KEY, new Set());
243
+ }
244
+ channel.progressCallbacks.get(types_1.GLOBAL_PROGRESS_KEY).add(callback);
245
+ };
246
+ exports.onAudioProgress = onAudioProgress;
247
+ /**
248
+ * Removes progress listeners for a specific channel
249
+ * @param channelNumber - The channel number (defaults to 0)
250
+ * @example
251
+ * ```typescript
252
+ * offAudioProgress();
253
+ * offAudioProgress(1); // Stop receiving progress updates for channel 1
254
+ * ```
255
+ */
256
+ function offAudioProgress(channelNumber = 0) {
257
+ const channel = exports.audioChannels[channelNumber];
258
+ if (!(channel === null || channel === void 0 ? void 0 : channel.progressCallbacks))
259
+ return;
260
+ // Clean up event listeners for current audio if exists
261
+ if (channel.queue.length > 0) {
262
+ const currentAudio = channel.queue[0];
263
+ (0, events_1.cleanupProgressTracking)(currentAudio, channelNumber, exports.audioChannels);
264
+ }
265
+ // Clear all callbacks for this channel
266
+ channel.progressCallbacks.clear();
267
+ }
268
+ /**
269
+ * Subscribes to queue change events for a specific channel
270
+ * @param channelNumber - The channel number to monitor
271
+ * @param callback - Function to call when queue changes
272
+ * @throws Error if the channel number exceeds the maximum allowed channels
273
+ * @example
274
+ * ```typescript
275
+ * onQueueChange(0, (snapshot) => {
276
+ * updateQueueDisplay(snapshot.items);
277
+ * updateQueueCount(snapshot.totalItems);
278
+ * });
279
+ * ```
280
+ */
281
+ const onQueueChange = (channelNumber, callback) => {
282
+ validateChannelNumber(channelNumber);
283
+ if (!exports.audioChannels[channelNumber]) {
284
+ exports.audioChannels[channelNumber] = {
285
+ audioCompleteCallbacks: new Set(),
286
+ audioErrorCallbacks: new Set(),
287
+ audioPauseCallbacks: new Set(),
288
+ audioResumeCallbacks: new Set(),
289
+ audioStartCallbacks: new Set(),
290
+ isPaused: false,
291
+ progressCallbacks: new Map(),
292
+ queue: [],
293
+ queueChangeCallbacks: new Set(),
294
+ volume: 1.0
295
+ };
296
+ }
297
+ const channel = exports.audioChannels[channelNumber];
298
+ if (!channel.queueChangeCallbacks) {
299
+ channel.queueChangeCallbacks = new Set();
300
+ }
301
+ channel.queueChangeCallbacks.add(callback);
302
+ };
303
+ exports.onQueueChange = onQueueChange;
304
+ /**
305
+ * Removes queue change listeners for a specific channel
306
+ * @param channelNumber - The channel number (defaults to 0)
307
+ * @example
308
+ * ```typescript
309
+ * offQueueChange(); // Stop receiving queue change notifications for default channel (0)
310
+ * offQueueChange(1); // Stop receiving queue change notifications for channel 1
311
+ * ```
312
+ */
313
+ const offQueueChange = (channelNumber = 0) => {
314
+ const channel = exports.audioChannels[channelNumber];
315
+ if (!(channel === null || channel === void 0 ? void 0 : channel.queueChangeCallbacks))
316
+ return;
317
+ channel.queueChangeCallbacks.clear();
318
+ };
319
+ exports.offQueueChange = offQueueChange;
320
+ /**
321
+ * Subscribes to audio start events for a specific channel
322
+ * @param channelNumber - The channel number to monitor
323
+ * @param callback - Function to call when audio starts playing
324
+ * @throws Error if the channel number exceeds the maximum allowed channels
325
+ * @example
326
+ * ```typescript
327
+ * onAudioStart(0, (info) => {
328
+ * showNowPlaying(info.fileName);
329
+ * setTotalDuration(info.duration);
330
+ * });
331
+ * ```
332
+ */
333
+ const onAudioStart = (channelNumber, callback) => {
334
+ validateChannelNumber(channelNumber);
335
+ if (!exports.audioChannels[channelNumber]) {
336
+ exports.audioChannels[channelNumber] = {
337
+ audioCompleteCallbacks: new Set(),
338
+ audioErrorCallbacks: new Set(),
339
+ audioPauseCallbacks: new Set(),
340
+ audioResumeCallbacks: new Set(),
341
+ audioStartCallbacks: new Set(),
342
+ isPaused: false,
343
+ progressCallbacks: new Map(),
344
+ queue: [],
345
+ queueChangeCallbacks: new Set(),
346
+ volume: 1.0
347
+ };
348
+ }
349
+ const channel = exports.audioChannels[channelNumber];
350
+ if (!channel.audioStartCallbacks) {
351
+ channel.audioStartCallbacks = new Set();
352
+ }
353
+ channel.audioStartCallbacks.add(callback);
354
+ };
355
+ exports.onAudioStart = onAudioStart;
356
+ /**
357
+ * Subscribes to audio complete events for a specific channel
358
+ * @param channelNumber - The channel number to monitor
359
+ * @param callback - Function to call when audio completes
360
+ * @throws Error if the channel number exceeds the maximum allowed channels
361
+ * @example
362
+ * ```typescript
363
+ * onAudioComplete(0, (info) => {
364
+ * logPlaybackComplete(info.fileName);
365
+ * if (info.remainingInQueue === 0) {
366
+ * showQueueComplete();
367
+ * }
368
+ * });
369
+ * ```
370
+ */
371
+ const onAudioComplete = (channelNumber, callback) => {
372
+ validateChannelNumber(channelNumber);
373
+ if (!exports.audioChannels[channelNumber]) {
374
+ exports.audioChannels[channelNumber] = {
375
+ audioCompleteCallbacks: new Set(),
376
+ audioErrorCallbacks: new Set(),
377
+ audioPauseCallbacks: new Set(),
378
+ audioResumeCallbacks: new Set(),
379
+ audioStartCallbacks: new Set(),
380
+ isPaused: false,
381
+ progressCallbacks: new Map(),
382
+ queue: [],
383
+ queueChangeCallbacks: new Set(),
384
+ volume: 1.0
385
+ };
386
+ }
387
+ const channel = exports.audioChannels[channelNumber];
388
+ if (!channel.audioCompleteCallbacks) {
389
+ channel.audioCompleteCallbacks = new Set();
390
+ }
391
+ channel.audioCompleteCallbacks.add(callback);
392
+ };
393
+ exports.onAudioComplete = onAudioComplete;
394
+ /**
395
+ * Subscribes to audio pause events for a specific channel
396
+ * @param channelNumber - The channel number to monitor
397
+ * @param callback - Function to call when audio is paused
398
+ * @throws Error if the channel number exceeds the maximum allowed channels
399
+ * @example
400
+ * ```typescript
401
+ * onAudioPause(0, (channelNumber, info) => {
402
+ * showPauseIndicator();
403
+ * logPauseEvent(info.fileName, info.currentTime);
404
+ * });
405
+ * ```
406
+ */
407
+ const onAudioPause = (channelNumber, callback) => {
408
+ validateChannelNumber(channelNumber);
409
+ if (!exports.audioChannels[channelNumber]) {
410
+ exports.audioChannels[channelNumber] = {
411
+ audioCompleteCallbacks: new Set(),
412
+ audioErrorCallbacks: new Set(),
413
+ audioPauseCallbacks: new Set(),
414
+ audioResumeCallbacks: new Set(),
415
+ audioStartCallbacks: new Set(),
416
+ isPaused: false,
417
+ progressCallbacks: new Map(),
418
+ queue: [],
419
+ queueChangeCallbacks: new Set(),
420
+ volume: 1.0
421
+ };
422
+ }
423
+ const channel = exports.audioChannels[channelNumber];
424
+ if (!channel.audioPauseCallbacks) {
425
+ channel.audioPauseCallbacks = new Set();
426
+ }
427
+ channel.audioPauseCallbacks.add(callback);
428
+ };
429
+ exports.onAudioPause = onAudioPause;
430
+ /**
431
+ * Subscribes to audio resume events for a specific channel
432
+ * @param channelNumber - The channel number to monitor
433
+ * @param callback - Function to call when audio is resumed
434
+ * @throws Error if the channel number exceeds the maximum allowed channels
435
+ * @example
436
+ * ```typescript
437
+ * onAudioResume(0, (channelNumber, info) => {
438
+ * hidePauseIndicator();
439
+ * logResumeEvent(info.fileName, info.currentTime);
440
+ * });
441
+ * ```
442
+ */
443
+ const onAudioResume = (channelNumber, callback) => {
444
+ validateChannelNumber(channelNumber);
445
+ if (!exports.audioChannels[channelNumber]) {
446
+ exports.audioChannels[channelNumber] = {
447
+ audioCompleteCallbacks: new Set(),
448
+ audioErrorCallbacks: new Set(),
449
+ audioPauseCallbacks: new Set(),
450
+ audioResumeCallbacks: new Set(),
451
+ audioStartCallbacks: new Set(),
452
+ isPaused: false,
453
+ progressCallbacks: new Map(),
454
+ queue: [],
455
+ queueChangeCallbacks: new Set(),
456
+ volume: 1.0
457
+ };
458
+ }
459
+ const channel = exports.audioChannels[channelNumber];
460
+ if (!channel.audioResumeCallbacks) {
461
+ channel.audioResumeCallbacks = new Set();
462
+ }
463
+ channel.audioResumeCallbacks.add(callback);
464
+ };
465
+ exports.onAudioResume = onAudioResume;
466
+ /**
467
+ * Removes pause event listeners for a specific channel
468
+ * @param channelNumber - The channel number (defaults to 0)
469
+ * @example
470
+ * ```typescript
471
+ * offAudioPause(); // Stop receiving pause notifications for default channel (0)
472
+ * offAudioPause(1); // Stop receiving pause notifications for channel 1
473
+ * ```
474
+ */
475
+ const offAudioPause = (channelNumber = 0) => {
476
+ const channel = exports.audioChannels[channelNumber];
477
+ if (!(channel === null || channel === void 0 ? void 0 : channel.audioPauseCallbacks))
478
+ return;
479
+ channel.audioPauseCallbacks.clear();
480
+ };
481
+ exports.offAudioPause = offAudioPause;
482
+ /**
483
+ * Removes resume event listeners for a specific channel
484
+ * @param channelNumber - The channel number (defaults to 0)
485
+ * @example
486
+ * ```typescript
487
+ * offAudioResume(); // Stop receiving resume notifications for default channel (0)
488
+ * offAudioResume(1); // Stop receiving resume notifications for channel 1
489
+ * ```
490
+ */
491
+ const offAudioResume = (channelNumber = 0) => {
492
+ const channel = exports.audioChannels[channelNumber];
493
+ if (!(channel === null || channel === void 0 ? void 0 : channel.audioResumeCallbacks))
494
+ return;
495
+ channel.audioResumeCallbacks.clear();
496
+ };
497
+ exports.offAudioResume = offAudioResume;
498
+ /**
499
+ * Removes audio start event listeners for a specific channel
500
+ * @param channelNumber - The channel number (defaults to 0)
501
+ * @example
502
+ * ```typescript
503
+ * offAudioStart(); // Stop receiving start notifications for default channel (0)
504
+ * offAudioStart(1); // Stop receiving start notifications for channel 1
505
+ * ```
506
+ */
507
+ const offAudioStart = (channelNumber = 0) => {
508
+ const channel = exports.audioChannels[channelNumber];
509
+ if (!(channel === null || channel === void 0 ? void 0 : channel.audioStartCallbacks))
510
+ return;
511
+ channel.audioStartCallbacks.clear();
512
+ };
513
+ exports.offAudioStart = offAudioStart;
514
+ /**
515
+ * Removes audio complete event listeners for a specific channel
516
+ * @param channelNumber - The channel number (defaults to 0)
517
+ * @example
518
+ * ```typescript
519
+ * offAudioComplete(); // Stop receiving completion notifications for default channel (0)
520
+ * offAudioComplete(1); // Stop receiving completion notifications for channel 1
521
+ * ```
522
+ */
523
+ const offAudioComplete = (channelNumber = 0) => {
524
+ const channel = exports.audioChannels[channelNumber];
525
+ if (!(channel === null || channel === void 0 ? void 0 : channel.audioCompleteCallbacks))
526
+ return;
527
+ channel.audioCompleteCallbacks.clear();
528
+ };
529
+ exports.offAudioComplete = offAudioComplete;
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @fileoverview Pause and resume management functions for the audioq package
3
+ */
4
+ import { FadeType } from './types';
5
+ /**
6
+ * Pauses the currently playing audio in a specific channel with smooth volume fade
7
+ * @param fadeType - Type of fade transition to apply
8
+ * @param channelNumber - The channel number to pause (defaults to 0)
9
+ * @param duration - Optional custom fade duration in milliseconds (uses fadeType default if not provided)
10
+ * @returns Promise that resolves when the pause and fade are complete
11
+ * @example
12
+ * ```typescript
13
+ * await pauseWithFade(FadeType.Gentle, 0); // Pause with gentle fade out over 800ms
14
+ * await pauseWithFade(FadeType.Dramatic, 1, 1500); // Pause with dramatic fade out over 1.5s
15
+ * await pauseWithFade(FadeType.Linear, 2, 500); // Linear pause with custom 500ms fade
16
+ * ```
17
+ */
18
+ export declare const pauseWithFade: (fadeType?: FadeType, channelNumber?: number, duration?: number) => Promise<void>;
19
+ /**
20
+ * Resumes the currently paused audio in a specific channel with smooth volume fade
21
+ * Uses the complementary fade curve automatically based on the pause fade type, or allows override
22
+ * @param fadeType - Optional fade type to override the stored fade type from pause
23
+ * @param channelNumber - The channel number to resume (defaults to 0)
24
+ * @param duration - Optional custom fade duration in milliseconds (uses stored or fadeType default if not provided)
25
+ * @returns Promise that resolves when the resume and fade are complete
26
+ * @example
27
+ * ```typescript
28
+ * await resumeWithFade(); // Resume with automatically paired fade curve from pause
29
+ * await resumeWithFade(FadeType.Dramatic, 0); // Override with dramatic fade
30
+ * await resumeWithFade(FadeType.Linear, 0, 1000); // Override with linear fade over 1 second
31
+ * ```
32
+ */
33
+ export declare const resumeWithFade: (fadeType?: FadeType, channelNumber?: number, duration?: number) => Promise<void>;
34
+ /**
35
+ * Toggles pause/resume state for a specific channel with integrated fade
36
+ * @param fadeType - Type of fade transition to apply when pausing
37
+ * @param channelNumber - The channel number to toggle (defaults to 0)
38
+ * @param duration - Optional custom fade duration in milliseconds (uses fadeType default if not provided)
39
+ * @returns Promise that resolves when the toggle and fade are complete
40
+ * @example
41
+ * ```typescript
42
+ * await togglePauseWithFade(FadeType.Gentle, 0); // Toggle with gentle fade
43
+ * await togglePauseWithFade(FadeType.Dramatic, 0, 500); // Toggle with custom 500ms fade
44
+ * ```
45
+ */
46
+ export declare const togglePauseWithFade: (fadeType?: FadeType, channelNumber?: number, duration?: number) => Promise<void>;
47
+ /**
48
+ * Pauses all currently playing audio across all channels with smooth volume fade
49
+ * @param fadeType - Type of fade transition to apply to all channels
50
+ * @param duration - Optional custom fade duration in milliseconds (uses fadeType default if not provided)
51
+ * @returns Promise that resolves when all channels are paused and faded
52
+ * @example
53
+ * ```typescript
54
+ * await pauseAllWithFade(FadeType.Dramatic); // Pause everything with dramatic fade
55
+ * await pauseAllWithFade(FadeType.Gentle, 1200); // Pause all channels with custom 1.2s fade
56
+ * ```
57
+ */
58
+ export declare const pauseAllWithFade: (fadeType?: FadeType, duration?: number) => Promise<void>;
59
+ /**
60
+ * Resumes all currently paused audio across all channels with smooth volume fade
61
+ * Uses automatically paired fade curves based on each channel's pause fade type, or allows override
62
+ * @param fadeType - Optional fade type to override stored fade types for all channels
63
+ * @param duration - Optional custom fade duration in milliseconds (uses stored or fadeType default if not provided)
64
+ * @returns Promise that resolves when all channels are resumed and faded
65
+ * @example
66
+ * ```typescript
67
+ * await resumeAllWithFade(); // Resume everything with paired fade curves
68
+ * await resumeAllWithFade(FadeType.Gentle, 800); // Override all channels with gentle fade over 800ms
69
+ * await resumeAllWithFade(undefined, 600); // Use stored fade types with custom 600ms duration
70
+ * ```
71
+ */
72
+ export declare const resumeAllWithFade: (fadeType?: FadeType, duration?: number) => Promise<void>;
73
+ /**
74
+ * Toggles pause/resume state for all channels with integrated fade
75
+ * If any channels are playing, all will be paused with fade
76
+ * If all channels are paused, all will be resumed with fade
77
+ * @param fadeType - Type of fade transition to apply when pausing
78
+ * @param duration - Optional custom fade duration in milliseconds (uses fadeType default if not provided)
79
+ * @returns Promise that resolves when all toggles and fades are complete
80
+ * @example
81
+ * ```typescript
82
+ * await togglePauseAllWithFade(FadeType.Gentle); // Global toggle with gentle fade
83
+ * await togglePauseAllWithFade(FadeType.Dramatic, 600); // Global toggle with custom 600ms fade
84
+ * ```
85
+ */
86
+ export declare const togglePauseAllWithFade: (fadeType?: FadeType, duration?: number) => Promise<void>;
87
+ /**
88
+ * Pauses the currently playing audio in a specific channel
89
+ * @param channelNumber - The channel number to pause (defaults to 0)
90
+ * @returns Promise that resolves when the audio is paused
91
+ * @example
92
+ * ```typescript
93
+ * await pauseChannel(0); // Pause audio in channel 0
94
+ * await pauseChannel(); // Pause audio in default channel
95
+ * ```
96
+ */
97
+ export declare const pauseChannel: (channelNumber?: number) => Promise<void>;
98
+ /**
99
+ * Resumes the currently paused audio in a specific channel
100
+ * @param channelNumber - The channel number to resume (defaults to 0)
101
+ * @returns Promise that resolves when the audio starts playing
102
+ * @example
103
+ * ```typescript
104
+ * await resumeChannel(0); // Resume audio in channel 0
105
+ * await resumeChannel(); // Resume audio in default channel
106
+ * ```
107
+ */
108
+ export declare const resumeChannel: (channelNumber?: number) => Promise<void>;
109
+ /**
110
+ * Toggles pause/resume state for a specific channel
111
+ * @param channelNumber - The channel number to toggle (defaults to 0)
112
+ * @returns Promise that resolves when the toggle is complete
113
+ * @example
114
+ * ```typescript
115
+ * await togglePauseChannel(0); // Toggle pause state for channel 0
116
+ * ```
117
+ */
118
+ export declare const togglePauseChannel: (channelNumber?: number) => Promise<void>;
119
+ /**
120
+ * Pauses all currently playing audio across all channels
121
+ * @returns Promise that resolves when all audio is paused
122
+ * @example
123
+ * ```typescript
124
+ * await pauseAllChannels(); // Pause everything
125
+ * ```
126
+ */
127
+ export declare const pauseAllChannels: () => Promise<void>;
128
+ /**
129
+ * Resumes all currently paused audio across all channels
130
+ * @returns Promise that resolves when all audio is resumed
131
+ * @example
132
+ * ```typescript
133
+ * await resumeAllChannels(); // Resume everything that was paused
134
+ * ```
135
+ */
136
+ export declare const resumeAllChannels: () => Promise<void>;
137
+ /**
138
+ * Checks if a specific channel is currently paused
139
+ * @param channelNumber - The channel number to check (defaults to 0)
140
+ * @returns True if the channel is paused, false otherwise
141
+ * @example
142
+ * ```typescript
143
+ * const isPaused = isChannelPaused(0);
144
+ * console.log(`Channel 0 is ${isPaused ? 'paused' : 'playing'}`);
145
+ * ```
146
+ */
147
+ export declare const isChannelPaused: (channelNumber?: number) => boolean;
148
+ /**
149
+ * Gets the pause state of all channels
150
+ * @returns Array of boolean values indicating pause state for each channel
151
+ * @example
152
+ * ```typescript
153
+ * const pauseStates = getAllChannelsPauseState();
154
+ * pauseStates.forEach((isPaused, index) => {
155
+ * console.log(`Channel ${index}: ${isPaused ? 'paused' : 'playing'}`);
156
+ * });
157
+ * ```
158
+ */
159
+ export declare const getAllChannelsPauseState: () => boolean[];
160
+ /**
161
+ * Toggles pause/resume state for all channels globally
162
+ * If any channels are currently playing, all channels will be paused
163
+ * If all channels are paused, all channels will be resumed
164
+ * @returns Promise that resolves when the toggle is complete
165
+ * @example
166
+ * ```typescript
167
+ * await togglePauseAllChannels(); // Pause all if any are playing, resume all if all are paused
168
+ * ```
169
+ */
170
+ export declare const togglePauseAllChannels: () => Promise<void>;