@al8b/audio 0.1.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.
Files changed (56) hide show
  1. package/README.md +23 -0
  2. package/dist/constants.d.mts +8 -0
  3. package/dist/constants.d.ts +8 -0
  4. package/dist/constants.js +37 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/constants.mjs +10 -0
  7. package/dist/constants.mjs.map +1 -0
  8. package/dist/core/audio-core.d.mts +98 -0
  9. package/dist/core/audio-core.d.ts +98 -0
  10. package/dist/core/audio-core.js +664 -0
  11. package/dist/core/audio-core.js.map +1 -0
  12. package/dist/core/audio-core.mjs +641 -0
  13. package/dist/core/audio-core.mjs.map +1 -0
  14. package/dist/core/audio-worklet.d.mts +3 -0
  15. package/dist/core/audio-worklet.d.ts +3 -0
  16. package/dist/core/audio-worklet.js +153 -0
  17. package/dist/core/audio-worklet.js.map +1 -0
  18. package/dist/core/audio-worklet.mjs +128 -0
  19. package/dist/core/audio-worklet.mjs.map +1 -0
  20. package/dist/core/index.d.mts +2 -0
  21. package/dist/core/index.d.ts +2 -0
  22. package/dist/core/index.js +666 -0
  23. package/dist/core/index.js.map +1 -0
  24. package/dist/core/index.mjs +641 -0
  25. package/dist/core/index.mjs.map +1 -0
  26. package/dist/devices/beeper.d.mts +21 -0
  27. package/dist/devices/beeper.d.ts +21 -0
  28. package/dist/devices/beeper.js +286 -0
  29. package/dist/devices/beeper.js.map +1 -0
  30. package/dist/devices/beeper.mjs +261 -0
  31. package/dist/devices/beeper.mjs.map +1 -0
  32. package/dist/devices/index.d.mts +3 -0
  33. package/dist/devices/index.d.ts +3 -0
  34. package/dist/devices/index.js +534 -0
  35. package/dist/devices/index.js.map +1 -0
  36. package/dist/devices/index.mjs +507 -0
  37. package/dist/devices/index.mjs.map +1 -0
  38. package/dist/devices/music.d.mts +27 -0
  39. package/dist/devices/music.d.ts +27 -0
  40. package/dist/devices/music.js +104 -0
  41. package/dist/devices/music.js.map +1 -0
  42. package/dist/devices/music.mjs +81 -0
  43. package/dist/devices/music.mjs.map +1 -0
  44. package/dist/devices/sound.d.mts +22 -0
  45. package/dist/devices/sound.d.ts +22 -0
  46. package/dist/devices/sound.js +198 -0
  47. package/dist/devices/sound.js.map +1 -0
  48. package/dist/devices/sound.mjs +175 -0
  49. package/dist/devices/sound.mjs.map +1 -0
  50. package/dist/index.d.mts +4 -0
  51. package/dist/index.d.ts +4 -0
  52. package/dist/index.js +916 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/index.mjs +888 -0
  55. package/dist/index.mjs.map +1 -0
  56. package/package.json +37 -0
@@ -0,0 +1,664 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/core/audio-core.ts
22
+ var audio_core_exports = {};
23
+ __export(audio_core_exports, {
24
+ AudioCore: () => AudioCore
25
+ });
26
+ module.exports = __toCommonJS(audio_core_exports);
27
+ var import_diagnostics = require("@al8b/diagnostics");
28
+
29
+ // src/constants.ts
30
+ var A4_FREQUENCY = 440;
31
+ var SEMITONE_RATIO = 2 ** (1 / 12);
32
+ var A4_MIDI_NOTE = 69;
33
+
34
+ // src/devices/beeper.ts
35
+ var Beeper = class {
36
+ static {
37
+ __name(this, "Beeper");
38
+ }
39
+ audio;
40
+ notes = {};
41
+ plainNotes = {};
42
+ currentOctave = 5;
43
+ currentDuration = 0.5;
44
+ currentVolume = 0.5;
45
+ currentSpan = 1;
46
+ currentWaveform = "square";
47
+ constructor(audio) {
48
+ this.audio = audio;
49
+ this.initializeNotes();
50
+ }
51
+ /**
52
+ * Initialize note mappings
53
+ */
54
+ initializeNotes() {
55
+ const noteNames = [
56
+ [
57
+ "C",
58
+ "DO"
59
+ ],
60
+ [
61
+ "C#",
62
+ "DO#",
63
+ "Db",
64
+ "REb"
65
+ ],
66
+ [
67
+ "D",
68
+ "RE"
69
+ ],
70
+ [
71
+ "D#",
72
+ "RE#",
73
+ "Eb",
74
+ "MIb"
75
+ ],
76
+ [
77
+ "E",
78
+ "MI"
79
+ ],
80
+ [
81
+ "F",
82
+ "FA"
83
+ ],
84
+ [
85
+ "F#",
86
+ "FA#",
87
+ "Gb",
88
+ "SOLb"
89
+ ],
90
+ [
91
+ "G",
92
+ "SOL"
93
+ ],
94
+ [
95
+ "G#",
96
+ "SOL#",
97
+ "Ab",
98
+ "LAb"
99
+ ],
100
+ [
101
+ "A",
102
+ "LA"
103
+ ],
104
+ [
105
+ "A#",
106
+ "LA#",
107
+ "Bb",
108
+ "SIb"
109
+ ],
110
+ [
111
+ "B",
112
+ "SI"
113
+ ]
114
+ ];
115
+ for (let i = 0; i <= 127; i++) {
116
+ this.notes[i] = i;
117
+ const oct = Math.floor(i / 12) - 1;
118
+ for (const n of noteNames[i % 12]) {
119
+ this.notes[n + oct] = i;
120
+ }
121
+ if (oct === -1) {
122
+ for (const n of noteNames[i % 12]) {
123
+ this.plainNotes[n] = i;
124
+ }
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Parse and play beep sequence
130
+ */
131
+ beep(input) {
132
+ let status = "normal";
133
+ const sequence = [];
134
+ const loops = [];
135
+ let note;
136
+ const parsed = input.split(" ");
137
+ for (const t of parsed) {
138
+ if (t === "") continue;
139
+ switch (status) {
140
+ case "normal":
141
+ if (this.notes[t] !== void 0) {
142
+ note = this.notes[t];
143
+ this.currentOctave = Math.floor(note / 12);
144
+ sequence.push({
145
+ frequency: A4_FREQUENCY * SEMITONE_RATIO ** (note - A4_MIDI_NOTE),
146
+ volume: this.currentVolume,
147
+ span: this.currentSpan,
148
+ duration: this.currentDuration,
149
+ waveform: this.currentWaveform
150
+ });
151
+ } else if (this.plainNotes[t] !== void 0) {
152
+ note = this.plainNotes[t] + this.currentOctave * 12;
153
+ sequence.push({
154
+ frequency: A4_FREQUENCY * SEMITONE_RATIO ** (note - A4_MIDI_NOTE),
155
+ volume: this.currentVolume,
156
+ span: this.currentSpan,
157
+ duration: this.currentDuration,
158
+ waveform: this.currentWaveform
159
+ });
160
+ } else if ([
161
+ "square",
162
+ "sine",
163
+ "saw",
164
+ "noise"
165
+ ].includes(t)) {
166
+ this.currentWaveform = t;
167
+ } else if ([
168
+ "tempo",
169
+ "duration",
170
+ "volume",
171
+ "span",
172
+ "loop",
173
+ "to"
174
+ ].includes(t)) {
175
+ status = t;
176
+ } else if (t === "-") {
177
+ sequence.push({
178
+ frequency: A4_FREQUENCY,
179
+ volume: 0,
180
+ span: this.currentSpan,
181
+ duration: this.currentDuration,
182
+ waveform: this.currentWaveform
183
+ });
184
+ } else if (t === "end") {
185
+ if (loops.length > 0 && sequence.length > 0) {
186
+ sequence.push({
187
+ frequency: A4_FREQUENCY,
188
+ volume: 0,
189
+ span: this.currentSpan,
190
+ duration: 0,
191
+ waveform: this.currentWaveform
192
+ });
193
+ const lop = loops.splice(loops.length - 1, 1)[0];
194
+ sequence[sequence.length - 1].loopto = lop.start;
195
+ sequence[sequence.length - 1].repeats = lop.repeats;
196
+ }
197
+ }
198
+ break;
199
+ case "tempo": {
200
+ status = "normal";
201
+ const tempo = Number.parseFloat(t);
202
+ if (!Number.isNaN(tempo) && tempo > 0) {
203
+ this.currentDuration = 60 / tempo;
204
+ }
205
+ break;
206
+ }
207
+ case "duration": {
208
+ status = "normal";
209
+ const duration = Number.parseFloat(t);
210
+ if (!Number.isNaN(duration) && duration > 0) {
211
+ this.currentDuration = duration / 1e3;
212
+ }
213
+ break;
214
+ }
215
+ case "volume": {
216
+ status = "normal";
217
+ const volume = Number.parseFloat(t);
218
+ if (!Number.isNaN(volume)) {
219
+ this.currentVolume = volume / 100;
220
+ }
221
+ break;
222
+ }
223
+ case "span": {
224
+ status = "normal";
225
+ const span = Number.parseFloat(t);
226
+ if (!Number.isNaN(span)) {
227
+ this.currentSpan = span / 100;
228
+ }
229
+ break;
230
+ }
231
+ case "loop": {
232
+ status = "normal";
233
+ loops.push({
234
+ start: sequence.length
235
+ });
236
+ const repeats = Number.parseFloat(t);
237
+ if (!Number.isNaN(repeats)) {
238
+ loops[loops.length - 1].repeats = repeats;
239
+ }
240
+ break;
241
+ }
242
+ case "to":
243
+ status = "normal";
244
+ if (note !== void 0) {
245
+ let n;
246
+ if (this.notes[t] !== void 0) {
247
+ n = this.notes[t];
248
+ } else if (this.plainNotes[t] !== void 0) {
249
+ n = this.plainNotes[t] + this.currentOctave * 12;
250
+ }
251
+ if (n !== void 0 && n !== note) {
252
+ const step = n > note ? 1 : -1;
253
+ for (let i = note + step; step > 0 ? i <= n : i >= n; i += step) {
254
+ sequence.push({
255
+ frequency: A4_FREQUENCY * SEMITONE_RATIO ** (i - A4_MIDI_NOTE),
256
+ volume: this.currentVolume,
257
+ span: this.currentSpan,
258
+ duration: this.currentDuration,
259
+ waveform: this.currentWaveform
260
+ });
261
+ }
262
+ note = n;
263
+ }
264
+ }
265
+ break;
266
+ }
267
+ }
268
+ if (loops.length > 0 && sequence.length > 0) {
269
+ const lop = loops.splice(loops.length - 1, 1)[0];
270
+ sequence.push({
271
+ frequency: A4_FREQUENCY,
272
+ volume: 0,
273
+ span: this.currentSpan,
274
+ duration: 0,
275
+ waveform: this.currentWaveform
276
+ });
277
+ sequence[sequence.length - 1].loopto = lop.start;
278
+ sequence[sequence.length - 1].repeats = lop.repeats;
279
+ }
280
+ this.audio.addBeeps(sequence);
281
+ }
282
+ };
283
+
284
+ // src/core/audio-worklet.ts
285
+ var AUDIO_WORKLET_CODE = `
286
+ class L8bAudioProcessor extends AudioWorkletProcessor {
287
+ constructor() {
288
+ super();
289
+ this.beeps = [];
290
+ this.last = 0;
291
+ this.port.onmessage = (event) => {
292
+ const data = JSON.parse(event.data);
293
+ if (data.name === "cancel_beeps") {
294
+ this.beeps = [];
295
+ } else if (data.name === "beep") {
296
+ const seq = data.sequence;
297
+ // Link sequence notes together
298
+ for (let i = 0; i < seq.length; i++) {
299
+ const note = seq[i];
300
+ if (i > 0) {
301
+ seq[i - 1].next = note;
302
+ }
303
+ // Resolve loopto index to actual note reference
304
+ if (note.loopto != null) {
305
+ note.loopto = seq[note.loopto];
306
+ }
307
+ // Initialize phase and time
308
+ note.phase = 0;
309
+ note.time = 0;
310
+ }
311
+ // Add first note to beeps queue
312
+ if (seq.length > 0) {
313
+ this.beeps.push(seq[0]);
314
+ }
315
+ }
316
+ };
317
+ }
318
+
319
+ process(inputs, outputs, parameters) {
320
+ const output = outputs[0];
321
+
322
+ for (let i = 0; i < output.length; i++) {
323
+ const channel = output[i];
324
+
325
+ if (i > 0) {
326
+ // Copy first channel to other channels
327
+ for (let j = 0; j < channel.length; j++) {
328
+ channel[j] = output[0][j];
329
+ }
330
+ } else {
331
+ // Generate audio for first channel
332
+ for (let j = 0; j < channel.length; j++) {
333
+ let sig = 0;
334
+
335
+ for (let k = this.beeps.length - 1; k >= 0; k--) {
336
+ const b = this.beeps[k];
337
+ let volume = b.volume;
338
+
339
+ if (b.time / b.duration > b.span) {
340
+ volume = 0;
341
+ }
342
+
343
+ // Generate waveform
344
+ switch (b.waveform) {
345
+ case "square":
346
+ sig += b.phase > 0.5 ? volume : -volume;
347
+ break;
348
+ case "saw":
349
+ sig += (b.phase * 2 - 1) * volume;
350
+ break;
351
+ case "noise":
352
+ sig += (Math.random() * 2 - 1) * volume;
353
+ break;
354
+ default: // sine
355
+ sig += Math.sin(b.phase * Math.PI * 2) * volume;
356
+ }
357
+
358
+ b.phase = (b.phase + b.increment) % 1;
359
+ b.time += 1;
360
+
361
+ if (b.time >= b.duration) {
362
+ b.time = 0;
363
+
364
+ if (b.loopto != null) {
365
+ if (b.repeats != null && b.repeats > 0) {
366
+ if (b.loopcount == null) {
367
+ b.loopcount = 0;
368
+ }
369
+ b.loopcount++;
370
+
371
+ if (b.loopcount >= b.repeats) {
372
+ b.loopcount = 0;
373
+ if (b.next != null) {
374
+ b.next.phase = b.phase;
375
+ this.beeps[k] = b.next;
376
+ } else {
377
+ this.beeps.splice(k, 1);
378
+ }
379
+ } else {
380
+ b.loopto.phase = b.phase;
381
+ this.beeps[k] = b.loopto;
382
+ }
383
+ } else {
384
+ b.loopto.phase = b.phase;
385
+ this.beeps[k] = b.loopto;
386
+ }
387
+ } else if (b.next != null) {
388
+ b.next.phase = b.phase;
389
+ this.beeps[k] = b.next;
390
+ } else {
391
+ this.beeps.splice(k, 1);
392
+ }
393
+ }
394
+ }
395
+
396
+ this.last = this.last * 0.9 + sig * 0.1;
397
+ channel[j] = this.last;
398
+ }
399
+ }
400
+ }
401
+
402
+ return true;
403
+ }
404
+ }
405
+
406
+ registerProcessor("l8b-audio-processor", L8bAudioProcessor);
407
+ `;
408
+
409
+ // src/core/audio-core.ts
410
+ var AudioCore = class {
411
+ static {
412
+ __name(this, "AudioCore");
413
+ }
414
+ context;
415
+ buffer = [];
416
+ playing = [];
417
+ wakeupList = [];
418
+ workletNode;
419
+ beeper;
420
+ runtime;
421
+ masterVolume = 1;
422
+ constructor(runtime) {
423
+ this.runtime = runtime;
424
+ this.getContext();
425
+ }
426
+ /**
427
+ * Check if audio context is running
428
+ */
429
+ isStarted() {
430
+ return this.context.state === "running";
431
+ }
432
+ /**
433
+ * Add item to wakeup list (for mobile audio activation)
434
+ */
435
+ addToWakeUpList(item) {
436
+ this.wakeupList.push(item);
437
+ }
438
+ interfaceCache = null;
439
+ /**
440
+ * Set master volume (0-1). Applied as a multiplier to all sound/music playback.
441
+ */
442
+ setVolume(volume) {
443
+ this.masterVolume = Math.max(0, Math.min(1, volume));
444
+ }
445
+ /**
446
+ * Get current master volume (0-1)
447
+ */
448
+ getVolume() {
449
+ return this.masterVolume;
450
+ }
451
+ /**
452
+ * Get interface for game code
453
+ */
454
+ getInterface() {
455
+ if (this.interfaceCache) {
456
+ return this.interfaceCache;
457
+ }
458
+ this.interfaceCache = {
459
+ beep: /* @__PURE__ */ __name((sequence) => this.beep(sequence), "beep"),
460
+ cancelBeeps: /* @__PURE__ */ __name(() => this.cancelBeeps(), "cancelBeeps"),
461
+ playSound: /* @__PURE__ */ __name((sound, volume, pitch, pan, loopit) => this.playSound(sound, volume, pitch, pan, loopit), "playSound"),
462
+ playMusic: /* @__PURE__ */ __name((music, volume, loopit) => this.playMusic(music, volume, loopit), "playMusic"),
463
+ setVolume: /* @__PURE__ */ __name((volume) => this.setVolume(volume), "setVolume"),
464
+ getVolume: /* @__PURE__ */ __name(() => this.getVolume(), "getVolume"),
465
+ stopAll: /* @__PURE__ */ __name(() => this.stopAll(), "stopAll")
466
+ };
467
+ return this.interfaceCache;
468
+ }
469
+ /**
470
+ * Play sound effect
471
+ */
472
+ playSound(sound, volume = 1, pitch = 1, pan = 0, loopit = false) {
473
+ if (typeof sound === "string") {
474
+ const soundName = sound.replace(/\//g, "-");
475
+ const s = this.runtime.sounds[soundName];
476
+ if (!s) {
477
+ (0, import_diagnostics.reportRuntimeError)(this.runtime?.listener, import_diagnostics.APIErrorCode.E7013, {
478
+ soundName
479
+ });
480
+ return 0;
481
+ }
482
+ return s.play(volume * this.masterVolume, pitch, pan, loopit);
483
+ }
484
+ return 0;
485
+ }
486
+ /**
487
+ * Play music
488
+ */
489
+ playMusic(music, volume = 1, loopit = false) {
490
+ if (typeof music === "string") {
491
+ const musicName = music.replace(/\//g, "-");
492
+ const m = this.runtime.music[musicName];
493
+ if (!m) {
494
+ (0, import_diagnostics.reportRuntimeError)(this.runtime?.listener, import_diagnostics.APIErrorCode.E7014, {
495
+ musicName
496
+ });
497
+ return 0;
498
+ }
499
+ return m.play(volume * this.masterVolume, loopit);
500
+ }
501
+ return 0;
502
+ }
503
+ /**
504
+ * Get or create audio context (lazy initialization - created on first use)
505
+ * Note: Browser may suspend context until user interaction, which is handled automatically
506
+ */
507
+ getContext() {
508
+ if (!this.context) {
509
+ const AudioContextClass = window.AudioContext || window.webkitAudioContext;
510
+ this.context = new AudioContextClass();
511
+ if (this.context.state !== "running") {
512
+ const activate = /* @__PURE__ */ __name(() => {
513
+ if (this.context && this.context.state !== "running") {
514
+ this.context.resume();
515
+ if (this.beeper) {
516
+ this.start();
517
+ }
518
+ for (const item of this.wakeupList) {
519
+ item.wakeUp();
520
+ }
521
+ document.body.removeEventListener("touchend", activate);
522
+ document.body.removeEventListener("mouseup", activate);
523
+ document.body.removeEventListener("click", activate);
524
+ document.body.removeEventListener("keydown", activate);
525
+ }
526
+ }, "activate");
527
+ document.body.addEventListener("touchend", activate, {
528
+ once: true
529
+ });
530
+ document.body.addEventListener("mouseup", activate, {
531
+ once: true
532
+ });
533
+ document.body.addEventListener("click", activate, {
534
+ once: true
535
+ });
536
+ document.body.addEventListener("keydown", activate, {
537
+ once: true
538
+ });
539
+ } else if (this.beeper) {
540
+ this.start();
541
+ }
542
+ }
543
+ return this.context;
544
+ }
545
+ /**
546
+ * Start audio processor
547
+ */
548
+ async start() {
549
+ if (this.workletNode) return;
550
+ try {
551
+ const blob = new Blob([
552
+ AUDIO_WORKLET_CODE
553
+ ], {
554
+ type: "application/javascript"
555
+ });
556
+ const url = URL.createObjectURL(blob);
557
+ await this.context.audioWorklet.addModule(url);
558
+ this.workletNode = new AudioWorkletNode(this.context, "l8b-audio-processor");
559
+ this.workletNode.connect(this.context.destination);
560
+ this.flushBuffer();
561
+ } catch (e) {
562
+ (0, import_diagnostics.reportRuntimeError)(this.runtime?.listener, import_diagnostics.APIErrorCode.E7012, {
563
+ error: String(e)
564
+ });
565
+ }
566
+ }
567
+ /**
568
+ * Flush buffered messages
569
+ */
570
+ flushBuffer() {
571
+ if (!this.workletNode) return;
572
+ while (this.buffer.length > 0) {
573
+ this.workletNode.port.postMessage(this.buffer.splice(0, 1)[0]);
574
+ }
575
+ }
576
+ /**
577
+ * Get or create beeper
578
+ */
579
+ getBeeper() {
580
+ if (!this.beeper) {
581
+ this.beeper = new Beeper(this);
582
+ if (this.context.state === "running") {
583
+ this.start();
584
+ }
585
+ }
586
+ return this.beeper;
587
+ }
588
+ /**
589
+ * Play beep sequence
590
+ */
591
+ beep(sequence) {
592
+ this.getBeeper().beep(sequence);
593
+ }
594
+ /**
595
+ * Add beeps to audio processor
596
+ */
597
+ addBeeps(beeps) {
598
+ for (const b of beeps) {
599
+ b.duration *= this.context.sampleRate;
600
+ b.increment = b.frequency / this.context.sampleRate;
601
+ }
602
+ if (this.workletNode) {
603
+ this.workletNode.port.postMessage(JSON.stringify({
604
+ name: "beep",
605
+ sequence: beeps
606
+ }));
607
+ } else {
608
+ this.buffer.push(JSON.stringify({
609
+ name: "beep",
610
+ sequence: beeps
611
+ }));
612
+ }
613
+ }
614
+ /**
615
+ * Cancel all beeps
616
+ */
617
+ cancelBeeps() {
618
+ if (this.workletNode) {
619
+ this.workletNode.port.postMessage(JSON.stringify({
620
+ name: "cancel_beeps"
621
+ }));
622
+ } else {
623
+ this.buffer.push(JSON.stringify({
624
+ name: "cancel_beeps"
625
+ }));
626
+ }
627
+ this.stopAll();
628
+ }
629
+ /**
630
+ * Add playing sound/music to list
631
+ */
632
+ addPlaying(item) {
633
+ this.playing.push(item);
634
+ }
635
+ /**
636
+ * Remove playing sound/music from list
637
+ */
638
+ removePlaying(item) {
639
+ const index = this.playing.indexOf(item);
640
+ if (index >= 0) {
641
+ this.playing.splice(index, 1);
642
+ }
643
+ }
644
+ /**
645
+ * Stop all playing sounds/music
646
+ */
647
+ stopAll() {
648
+ for (const p of this.playing) {
649
+ try {
650
+ p.stop();
651
+ } catch (err) {
652
+ (0, import_diagnostics.reportRuntimeError)(this.runtime?.listener, import_diagnostics.APIErrorCode.E7016, {
653
+ error: String(err)
654
+ });
655
+ }
656
+ }
657
+ this.playing = [];
658
+ }
659
+ };
660
+ // Annotate the CommonJS export names for ESM import in node:
661
+ 0 && (module.exports = {
662
+ AudioCore
663
+ });
664
+ //# sourceMappingURL=audio-core.js.map