@gui-chat-plugin/music 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/core.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/style.css +1 -1
- package/dist/vue.cjs +4 -1
- package/dist/vue.js +4398 -52
- package/package.json +14 -14
package/dist/vue.js
CHANGED
|
@@ -1,51 +1,4397 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./samples-C8a37dDP.js";
|
|
2
2
|
import { createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, toDisplayString as p, vModelText as m, watch as h, withDirectives as g } from "vue";
|
|
3
3
|
import { OpenSheetMusicDisplay as _ } from "opensheetmusicdisplay";
|
|
4
|
-
import v from "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { jsPDF as v } from "jspdf";
|
|
5
|
+
import { svg2pdf as y } from "svg2pdf.js";
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
|
+
var b = Object.create, x = Object.defineProperty, S = Object.getOwnPropertyDescriptor, C = Object.getOwnPropertyNames, w = Object.getPrototypeOf, T = Object.prototype.hasOwnProperty, E = (e, t) => () => (e && (t = e(e = 0)), t), D = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), O = (e, t) => {
|
|
8
|
+
let n = {};
|
|
9
|
+
for (var r in e) x(n, r, {
|
|
10
|
+
get: e[r],
|
|
11
|
+
enumerable: !0
|
|
12
|
+
});
|
|
13
|
+
return t || x(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
+
}, k = (e, t, n, r) => {
|
|
15
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = C(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !T.call(e, s) && s !== n && x(e, s, {
|
|
16
|
+
get: ((e) => t[e]).bind(null, s),
|
|
17
|
+
enumerable: !(r = S(t, s)) || r.enumerable
|
|
18
|
+
});
|
|
19
|
+
return e;
|
|
20
|
+
}, A = (e, t, n) => (n = e == null ? {} : b(w(e)), k(t || !e || !e.__esModule ? x(n, "default", {
|
|
21
|
+
value: e,
|
|
22
|
+
enumerable: !0
|
|
23
|
+
}) : n, e)), j = (e) => T.call(e, "module.exports") ? e["module.exports"] : k(x({}, "__esModule", { value: !0 }), e), M = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
24
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
25
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
26
|
+
}), ee = class {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.steps = [];
|
|
29
|
+
}
|
|
30
|
+
[Symbol.iterator]() {
|
|
31
|
+
return this.steps.values();
|
|
32
|
+
}
|
|
33
|
+
createStep(e) {
|
|
34
|
+
let t = this.steps.find((t) => t.tick === e);
|
|
35
|
+
return t || (t = {
|
|
36
|
+
tick: e,
|
|
37
|
+
notes: []
|
|
38
|
+
}, this.steps.push(t)), t;
|
|
39
|
+
}
|
|
40
|
+
addNote(e, t) {
|
|
41
|
+
(this.steps.find((t) => t.tick === e) ?? this.createStep(e)).notes.push(t);
|
|
42
|
+
}
|
|
43
|
+
delete(e) {
|
|
44
|
+
let t = this.steps.findIndex((t) => t.tick === e.tick);
|
|
45
|
+
t != null && this.steps.splice(t, 1);
|
|
46
|
+
}
|
|
47
|
+
sort() {
|
|
48
|
+
return this.steps.sort((e, t) => e.tick - t.tick), this;
|
|
49
|
+
}
|
|
50
|
+
getFirstEmptyTick() {
|
|
51
|
+
return this.sort().steps.filter((e) => !e.notes.length)[0].tick;
|
|
52
|
+
}
|
|
53
|
+
}, te = class {
|
|
54
|
+
constructor(e, t, n) {
|
|
55
|
+
this.stepQueue = new ee(), this.stepQueueIndex = 0, this.scheduledTicks = /* @__PURE__ */ new Set(), this.currentTick = 0, this.currentTickTimestamp = 0, this.audioContextStartTime = 0, this.schedulerIntervalHandle = null, this.scheduleInterval = 200, this.schedulePeriod = 500, this.tickDenominator = 1024, this.lastTickOffset = 300, this.playing = !1, this.noteSchedulingCallback = n, this.wholeNoteLength = e, this.audioContext = t;
|
|
56
|
+
}
|
|
57
|
+
get schedulePeriodTicks() {
|
|
58
|
+
return this.schedulePeriod / this.tickDuration;
|
|
59
|
+
}
|
|
60
|
+
get audioContextTime() {
|
|
61
|
+
return this.audioContext ? (this.audioContext.currentTime - this.audioContextStartTime) * 1e3 : 0;
|
|
62
|
+
}
|
|
63
|
+
get tickDuration() {
|
|
64
|
+
return this.wholeNoteLength / this.tickDenominator;
|
|
65
|
+
}
|
|
66
|
+
get calculatedTick() {
|
|
67
|
+
return this.currentTick + Math.round((this.audioContextTime - this.currentTickTimestamp) / this.tickDuration);
|
|
68
|
+
}
|
|
69
|
+
start() {
|
|
70
|
+
this.playing = !0, this.stepQueue.sort(), this.audioContextStartTime = this.audioContext.currentTime, this.currentTickTimestamp = this.audioContextTime, this.schedulerIntervalHandle ||= window.setInterval(() => this.scheduleIterationStep(), this.scheduleInterval);
|
|
71
|
+
}
|
|
72
|
+
setIterationStep(e) {
|
|
73
|
+
e = Math.min(this.stepQueue.steps.length - 1, e), this.stepQueueIndex = e, this.currentTick = this.stepQueue.steps[this.stepQueueIndex].tick;
|
|
74
|
+
}
|
|
75
|
+
pause() {
|
|
76
|
+
this.playing = !1;
|
|
77
|
+
}
|
|
78
|
+
resume() {
|
|
79
|
+
this.playing = !0, this.currentTickTimestamp = this.audioContextTime;
|
|
80
|
+
}
|
|
81
|
+
reset() {
|
|
82
|
+
this.playing = !1, this.currentTick = 0, this.currentTickTimestamp = 0, this.stepQueueIndex = 0, clearInterval(this.scheduleInterval), this.schedulerIntervalHandle = null;
|
|
83
|
+
}
|
|
84
|
+
loadNotes(e) {
|
|
85
|
+
let t = this.lastTickOffset;
|
|
86
|
+
this.stepQueue.steps.length > 0 && (t = this.stepQueue.getFirstEmptyTick());
|
|
87
|
+
for (let n of e) if (!n.IsGrace) for (let e of n.Notes) this.stepQueue.addNote(t, e), this.stepQueue.createStep(t + e.Length.RealValue * this.tickDenominator);
|
|
88
|
+
}
|
|
89
|
+
scheduleIterationStep() {
|
|
90
|
+
if (!this.playing) return;
|
|
91
|
+
this.currentTick = this.calculatedTick, this.currentTickTimestamp = this.audioContextTime;
|
|
92
|
+
let e = this.stepQueue.steps[this.stepQueueIndex]?.tick;
|
|
93
|
+
for (; this.nextTickAvailableAndWithinSchedulePeriod(e);) {
|
|
94
|
+
let t = this.stepQueue.steps[this.stepQueueIndex], n = (t.tick - this.currentTick) * this.tickDuration;
|
|
95
|
+
n < 0 && (n = 0), this.scheduledTicks.add(t.tick), this.noteSchedulingCallback(n / 1e3, t.notes), this.stepQueueIndex++, e = this.stepQueue.steps[this.stepQueueIndex]?.tick;
|
|
96
|
+
}
|
|
97
|
+
for (let e of this.scheduledTicks) e <= this.currentTick && this.scheduledTicks.delete(e);
|
|
98
|
+
}
|
|
99
|
+
nextTickAvailableAndWithinSchedulePeriod(e) {
|
|
100
|
+
return e && this.currentTickTimestamp + (e - this.currentTick) * this.tickDuration <= this.currentTickTimestamp + this.schedulePeriod;
|
|
101
|
+
}
|
|
102
|
+
}, ne;
|
|
103
|
+
(function(e) {
|
|
104
|
+
e[e.None = 0] = "None", e[e.Staccato = 1] = "Staccato", e[e.Legato = 2] = "Legato";
|
|
105
|
+
})(ne ||= {});
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region node_modules/@modernized/osmd-audio-player/dist/midi/midiInstruments.js
|
|
108
|
+
var re = [
|
|
109
|
+
[0, "Acoustic Grand Piano"],
|
|
110
|
+
[1, "Bright Acoustic Piano"],
|
|
111
|
+
[2, "Electric Grand Piano"],
|
|
112
|
+
[3, "Honky-tonk Piano"],
|
|
113
|
+
[4, "Electric Piano 1"],
|
|
114
|
+
[5, "Electric Piano 2"],
|
|
115
|
+
[6, "Harpsichord"],
|
|
116
|
+
[7, "Clavi"],
|
|
117
|
+
[8, "Celesta"],
|
|
118
|
+
[9, "Glockenspiel"],
|
|
119
|
+
[10, "Music Box"],
|
|
120
|
+
[11, "Vibraphone"],
|
|
121
|
+
[12, "Marimba"],
|
|
122
|
+
[13, "Xylophone"],
|
|
123
|
+
[14, "Tubular Bells"],
|
|
124
|
+
[15, "Dulcimer"],
|
|
125
|
+
[16, "Drawbar Organ"],
|
|
126
|
+
[17, "Percussive Organ"],
|
|
127
|
+
[18, "Rock Organ"],
|
|
128
|
+
[19, "Church Organ"],
|
|
129
|
+
[20, "Reed Organ"],
|
|
130
|
+
[21, "Accordion"],
|
|
131
|
+
[22, "Harmonica"],
|
|
132
|
+
[23, "Tango Accordion"],
|
|
133
|
+
[24, "Acoustic Guitar (nylon)"],
|
|
134
|
+
[25, "Acoustic Guitar (steel)"],
|
|
135
|
+
[26, "Electric Guitar (jazz)"],
|
|
136
|
+
[27, "Electric Guitar (clean)"],
|
|
137
|
+
[28, "Electric Guitar (muted)"],
|
|
138
|
+
[29, "Overdriven Guitar"],
|
|
139
|
+
[30, "Distortion Guitar"],
|
|
140
|
+
[31, "Guitar harmonics"],
|
|
141
|
+
[32, "Acoustic Bass"],
|
|
142
|
+
[33, "Electric Bass (finger)"],
|
|
143
|
+
[34, "Electric Bass (pick)"],
|
|
144
|
+
[35, "Fretless Bass"],
|
|
145
|
+
[36, "Slap Bass 1"],
|
|
146
|
+
[37, "Slap Bass 2"],
|
|
147
|
+
[38, "Synth Bass 1"],
|
|
148
|
+
[39, "Synth Bass 2"],
|
|
149
|
+
[40, "Violin"],
|
|
150
|
+
[41, "Viola"],
|
|
151
|
+
[42, "Cello"],
|
|
152
|
+
[43, "Contrabass"],
|
|
153
|
+
[44, "Tremolo Strings"],
|
|
154
|
+
[45, "Pizzicato Strings"],
|
|
155
|
+
[46, "Orchestral Harp"],
|
|
156
|
+
[47, "Timpani"],
|
|
157
|
+
[48, "String Ensemble 1"],
|
|
158
|
+
[49, "String Ensemble 2"],
|
|
159
|
+
[50, "SynthStrings 1"],
|
|
160
|
+
[51, "SynthStrings 2"],
|
|
161
|
+
[52, "Choir Aahs"],
|
|
162
|
+
[53, "Voice Oohs"],
|
|
163
|
+
[54, "Synth Choir"],
|
|
164
|
+
[55, "Orchestra Hit"],
|
|
165
|
+
[56, "Trumpet"],
|
|
166
|
+
[57, "Trombone"],
|
|
167
|
+
[58, "Tuba"],
|
|
168
|
+
[59, "Muted Trumpet"],
|
|
169
|
+
[60, "French Horn"],
|
|
170
|
+
[61, "Brass Section"],
|
|
171
|
+
[62, "SynthBrass 1"],
|
|
172
|
+
[63, "SynthBrass 2"],
|
|
173
|
+
[64, "Soprano Sax"],
|
|
174
|
+
[65, "Alto Sax"],
|
|
175
|
+
[66, "Tenor Sax"],
|
|
176
|
+
[67, "Baritone Sax"],
|
|
177
|
+
[68, "Oboe"],
|
|
178
|
+
[69, "English Horn"],
|
|
179
|
+
[70, "Bassoon"],
|
|
180
|
+
[71, "Clarinet"],
|
|
181
|
+
[72, "Piccolo"],
|
|
182
|
+
[73, "Flute"],
|
|
183
|
+
[74, "Recorder"],
|
|
184
|
+
[75, "Pan Flute"],
|
|
185
|
+
[76, "Blown Bottle"],
|
|
186
|
+
[77, "Shakuhachi"],
|
|
187
|
+
[78, "Whistle"],
|
|
188
|
+
[79, "Ocarina"],
|
|
189
|
+
[80, "Lead 1 (square)"],
|
|
190
|
+
[81, "Lead 2 (sawtooth)"],
|
|
191
|
+
[82, "Lead 3 (calliope)"],
|
|
192
|
+
[83, "Lead 4 (chiff)"],
|
|
193
|
+
[84, "Lead 5 (charang)"],
|
|
194
|
+
[85, "Lead 6 (voice)"],
|
|
195
|
+
[86, "Lead 7 (fifths)"],
|
|
196
|
+
[87, "Lead 8 (bass + lead)"],
|
|
197
|
+
[88, "Pad 1 (new age)"],
|
|
198
|
+
[89, "Pad 2 (warm)"],
|
|
199
|
+
[90, "Pad 3 (polysynth)"],
|
|
200
|
+
[91, "Pad 4 (choir)"],
|
|
201
|
+
[92, "Pad 5 (bowed)"],
|
|
202
|
+
[93, "Pad 6 (metallic)"],
|
|
203
|
+
[94, "Pad 7 (halo)"],
|
|
204
|
+
[95, "Pad 8 (sweep)"],
|
|
205
|
+
[96, "FX 1 (rain)"],
|
|
206
|
+
[97, "FX 2 (soundtrack)"],
|
|
207
|
+
[98, "FX 3 (crystal)"],
|
|
208
|
+
[99, "FX 4 (atmosphere)"],
|
|
209
|
+
[100, "FX 5 (brightness)"],
|
|
210
|
+
[101, "FX 6 (goblins)"],
|
|
211
|
+
[102, "FX 7 (echoes)"],
|
|
212
|
+
[103, "FX 8 (sci-fi)"],
|
|
213
|
+
[104, "Sitar"],
|
|
214
|
+
[105, "Banjo"],
|
|
215
|
+
[106, "Shamisen"],
|
|
216
|
+
[107, "Koto"],
|
|
217
|
+
[108, "Kalimba"],
|
|
218
|
+
[109, "Bag pipe"],
|
|
219
|
+
[110, "Fiddle"],
|
|
220
|
+
[111, "Shanai"],
|
|
221
|
+
[112, "Tinkle Bell"],
|
|
222
|
+
[113, "Agogo"],
|
|
223
|
+
[114, "Steel Drums"],
|
|
224
|
+
[115, "Woodblock"],
|
|
225
|
+
[116, "Taiko Drum"],
|
|
226
|
+
[117, "Melodic Tom"],
|
|
227
|
+
[118, "Synth Drum"],
|
|
228
|
+
[119, "Reverse Cymbal"],
|
|
229
|
+
[120, "Guitar Fret Noise"],
|
|
230
|
+
[121, "Breath Noise"],
|
|
231
|
+
[122, "Seashore"],
|
|
232
|
+
[123, "Bird Tweet"],
|
|
233
|
+
[124, "Telephone Ring"],
|
|
234
|
+
[125, "Helicopter"],
|
|
235
|
+
[126, "Applause"],
|
|
236
|
+
[127, "Gunshot"]
|
|
237
|
+
], N = /* @__PURE__ */ "accordion.acoustic_bass.acoustic_grand_piano.acoustic_guitar_nylon.acoustic_guitar_steel.agogo.alto_sax.applause.bagpipe.banjo.baritone_sax.bassoon.bird_tweet.blown_bottle.brass_section.breath_noise.bright_acoustic_piano.celesta.cello.choir_aahs.church_organ.clarinet.clavinet.contrabass.distortion_guitar.drawbar_organ.dulcimer.electric_bass_finger.electric_bass_pick.electric_grand_piano.electric_guitar_clean.electric_guitar_jazz.electric_guitar_muted.electric_piano_1.electric_piano_2.english_horn.fiddle.flute.french_horn.fretless_bass.fx_1_rain.fx_2_soundtrack.fx_3_crystal.fx_4_atmosphere.fx_5_brightness.fx_6_goblins.fx_7_echoes.fx_8_scifi.glockenspiel.guitar_fret_noise.guitar_harmonics.gunshot.harmonica.harpsichord.helicopter.honkytonk_piano.kalimba.koto.lead_1_square.lead_2_sawtooth.lead_3_calliope.lead_4_chiff.lead_5_charang.lead_6_voice.lead_7_fifths.lead_8_bass__lead.marimba.melodic_tom.music_box.muted_trumpet.oboe.ocarina.orchestra_hit.orchestral_harp.overdriven_guitar.pad_1_new_age.pad_2_warm.pad_3_polysynth.pad_4_choir.pad_5_bowed.pad_6_metallic.pad_7_halo.pad_8_sweep.pan_flute.percussive_organ.piccolo.pizzicato_strings.recorder.reed_organ.reverse_cymbal.rock_organ.seashore.shakuhachi.shamisen.shanai.sitar.slap_bass_1.slap_bass_2.soprano_sax.steel_drums.string_ensemble_1.string_ensemble_2.synth_bass_1.synth_bass_2.synth_brass_1.synth_brass_2.synth_choir.synth_drum.synth_strings_1.synth_strings_2.taiko_drum.tango_accordion.telephone_ring.tenor_sax.timpani.tinkle_bell.tremolo_strings.trombone.trumpet.tuba.tubular_bells.vibraphone.viola.violin.voice_oohs.whistle.woodblock.xylophone".split("."), ie = /* @__PURE__ */ D(((e, t) => {
|
|
238
|
+
function n(e) {
|
|
239
|
+
return e > 64 && e < 91 ? e - 65 : e > 96 && e < 123 ? e - 71 : e > 47 && e < 58 ? e + 4 : e === 43 ? 62 : e === 47 ? 63 : 0;
|
|
240
|
+
}
|
|
241
|
+
function r(e, t) {
|
|
242
|
+
for (var r = e.replace(/[^A-Za-z0-9\+\/]/g, ""), i = r.length, a = t ? Math.ceil((i * 3 + 1 >> 2) / t) * t : i * 3 + 1 >> 2, o = new Uint8Array(a), s, c, l = 0, u = 0, d = 0; d < i; d++) if (c = d & 3, l |= n(r.charCodeAt(d)) << 18 - 6 * c, c === 3 || i - d === 1) {
|
|
243
|
+
for (s = 0; s < 3 && u < a; s++, u++) o[u] = l >>> (16 >>> s & 24) & 255;
|
|
244
|
+
l = 0;
|
|
245
|
+
}
|
|
246
|
+
return o;
|
|
247
|
+
}
|
|
248
|
+
t.exports = { decode: r };
|
|
249
|
+
})), ae = /* @__PURE__ */ D(((e, t) => {
|
|
250
|
+
t.exports = function(e, t) {
|
|
251
|
+
return new Promise(function(n, r) {
|
|
252
|
+
var i = new XMLHttpRequest();
|
|
253
|
+
t && (i.responseType = t), i.open("GET", e), i.onload = function() {
|
|
254
|
+
i.status === 200 ? n(i.response) : r(Error(i.statusText));
|
|
255
|
+
}, i.onerror = function() {
|
|
256
|
+
r(Error("Network Error"));
|
|
257
|
+
}, i.send();
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
})), oe = /* @__PURE__ */ D(((e, t) => {
|
|
261
|
+
var n = ie(), r = ae();
|
|
262
|
+
function i(e) {
|
|
263
|
+
return function(t) {
|
|
264
|
+
return typeof t == "string" && e.test(t);
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function a(e, t) {
|
|
268
|
+
return typeof e == "string" ? e + t : typeof e == "function" ? e(t) : t;
|
|
269
|
+
}
|
|
270
|
+
function o(e, t, n, r) {
|
|
271
|
+
var i = s(t) ? c : l(t) ? u : d(t) ? f : p(t) ? m : h(t) ? g : _(t) ? v : y(t) ? b : x(t) ? S : null;
|
|
272
|
+
return i ? i(e, t, n || {}) : r ? Promise.resolve(r) : Promise.reject("Source not valid (" + t + ")");
|
|
273
|
+
}
|
|
274
|
+
o.fetch = r;
|
|
275
|
+
function s(e) {
|
|
276
|
+
return e instanceof ArrayBuffer;
|
|
277
|
+
}
|
|
278
|
+
function c(e, t, n) {
|
|
279
|
+
return new Promise(function(n, r) {
|
|
280
|
+
e.decodeAudioData(t, function(e) {
|
|
281
|
+
n(e);
|
|
282
|
+
}, function() {
|
|
283
|
+
r("Can't decode audio data (" + t.slice(0, 30) + "...)");
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
var l = i(/\.(mp3|wav|ogg)(\?.*)?$/i);
|
|
288
|
+
function u(e, t, n) {
|
|
289
|
+
var r = a(n.from, t);
|
|
290
|
+
return o(e, o.fetch(r, "arraybuffer"), n);
|
|
291
|
+
}
|
|
292
|
+
function d(e) {
|
|
293
|
+
return e && typeof e.then == "function";
|
|
294
|
+
}
|
|
295
|
+
function f(e, t, n) {
|
|
296
|
+
return t.then(function(t) {
|
|
297
|
+
return o(e, t, n);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
var p = Array.isArray;
|
|
301
|
+
function m(e, t, n) {
|
|
302
|
+
return Promise.all(t.map(function(t) {
|
|
303
|
+
return o(e, t, n, t);
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
function h(e) {
|
|
307
|
+
return e && typeof e == "object";
|
|
308
|
+
}
|
|
309
|
+
function g(e, t, n) {
|
|
310
|
+
var r = {}, i = Object.keys(t).map(function(i) {
|
|
311
|
+
if (n.only && n.only.indexOf(i) === -1) return null;
|
|
312
|
+
var a = t[i];
|
|
313
|
+
return o(e, a, n, a).then(function(e) {
|
|
314
|
+
r[i] = e;
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
return Promise.all(i).then(function() {
|
|
318
|
+
return r;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
var _ = i(/\.json(\?.*)?$/i);
|
|
322
|
+
function v(e, t, n) {
|
|
323
|
+
var r = a(n.from, t);
|
|
324
|
+
return o(e, o.fetch(r, "text").then(JSON.parse), n);
|
|
325
|
+
}
|
|
326
|
+
var y = i(/^data:audio/);
|
|
327
|
+
function b(e, t, r) {
|
|
328
|
+
var i = t.indexOf(",");
|
|
329
|
+
return o(e, n.decode(t.slice(i + 1)).buffer, r);
|
|
330
|
+
}
|
|
331
|
+
var x = i(/\.js(\?.*)?$/i);
|
|
332
|
+
function S(e, t, n) {
|
|
333
|
+
var r = a(n.from, t);
|
|
334
|
+
return o(e, o.fetch(r, "text").then(C), n);
|
|
335
|
+
}
|
|
336
|
+
function C(e) {
|
|
337
|
+
var t = e.indexOf("MIDI.Soundfont.");
|
|
338
|
+
if (t < 0) throw Error("Invalid MIDI.js Soundfont format");
|
|
339
|
+
t = e.indexOf("=", t) + 2;
|
|
340
|
+
var n = e.lastIndexOf(",");
|
|
341
|
+
return JSON.parse(e.slice(t, n) + "}");
|
|
342
|
+
}
|
|
343
|
+
typeof t == "object" && t.exports && (t.exports = o), typeof window < "u" && (window.loadAudio = o);
|
|
344
|
+
})), P = /* @__PURE__ */ D(((e, t) => {
|
|
345
|
+
t.exports = n;
|
|
346
|
+
function n(e) {
|
|
347
|
+
var t = e.createGain(), n = t._voltage = a(e), i = o(n), s = o(n), c = o(n);
|
|
348
|
+
return t._startAmount = o(s), t._endAmount = o(c), t._multiplier = o(i), t._multiplier.connect(t), t._startAmount.connect(t), t._endAmount.connect(t), t.value = i.gain, t.startValue = s.gain, t.endValue = c.gain, t.startValue.value = 0, t.endValue.value = 0, Object.defineProperties(t, r), t;
|
|
349
|
+
}
|
|
350
|
+
var r = {
|
|
351
|
+
attack: {
|
|
352
|
+
value: 0,
|
|
353
|
+
writable: !0
|
|
354
|
+
},
|
|
355
|
+
decay: {
|
|
356
|
+
value: 0,
|
|
357
|
+
writable: !0
|
|
358
|
+
},
|
|
359
|
+
sustain: {
|
|
360
|
+
value: 1,
|
|
361
|
+
writable: !0
|
|
362
|
+
},
|
|
363
|
+
release: {
|
|
364
|
+
value: 0,
|
|
365
|
+
writable: !0
|
|
366
|
+
},
|
|
367
|
+
getReleaseDuration: { value: function() {
|
|
368
|
+
return this.release;
|
|
369
|
+
} },
|
|
370
|
+
start: { value: function(e) {
|
|
371
|
+
var t = this._multiplier.gain, n = this._startAmount.gain, r = this._endAmount.gain;
|
|
372
|
+
this._voltage.start(e), this._decayFrom = this._decayFrom = e + this.attack, this._startedAt = e;
|
|
373
|
+
var i = this.sustain;
|
|
374
|
+
t.cancelScheduledValues(e), n.cancelScheduledValues(e), r.cancelScheduledValues(e), r.setValueAtTime(0, e), this.attack ? (t.setValueAtTime(0, e), t.linearRampToValueAtTime(1, e + this.attack), n.setValueAtTime(1, e), n.linearRampToValueAtTime(0, e + this.attack)) : (t.setValueAtTime(1, e), n.setValueAtTime(0, e)), this.decay && t.setTargetAtTime(i, this._decayFrom, s(this.decay));
|
|
375
|
+
} },
|
|
376
|
+
stop: { value: function(e, t) {
|
|
377
|
+
t && (e -= this.release);
|
|
378
|
+
var n = e + this.release;
|
|
379
|
+
if (this.release) {
|
|
380
|
+
var r = this._multiplier.gain, i = this._startAmount.gain, a = this._endAmount.gain;
|
|
381
|
+
r.cancelScheduledValues(e), i.cancelScheduledValues(e), a.cancelScheduledValues(e);
|
|
382
|
+
var o = s(this.release);
|
|
383
|
+
if (this.attack && e < this._decayFrom) {
|
|
384
|
+
var l = c(0, 1, this._startedAt, this._decayFrom, e);
|
|
385
|
+
r.linearRampToValueAtTime(l, e), i.linearRampToValueAtTime(1 - l, e), i.setTargetAtTime(0, e, o);
|
|
386
|
+
}
|
|
387
|
+
a.setTargetAtTime(1, e, o), r.setTargetAtTime(0, e, o);
|
|
388
|
+
}
|
|
389
|
+
return this._voltage.stop(n), n;
|
|
390
|
+
} },
|
|
391
|
+
onended: {
|
|
392
|
+
get: function() {
|
|
393
|
+
return this._voltage.onended;
|
|
394
|
+
},
|
|
395
|
+
set: function(e) {
|
|
396
|
+
this._voltage.onended = e;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, i = new Float32Array([1, 1]);
|
|
400
|
+
function a(e) {
|
|
401
|
+
var t = e.createBufferSource(), n = e.createBuffer(1, 2, e.sampleRate);
|
|
402
|
+
return n.getChannelData(0).set(i), t.buffer = n, t.loop = !0, t;
|
|
403
|
+
}
|
|
404
|
+
function o(e) {
|
|
405
|
+
var t = e.context.createGain();
|
|
406
|
+
return e.connect(t), t;
|
|
407
|
+
}
|
|
408
|
+
function s(e) {
|
|
409
|
+
return Math.log(e + 1) / Math.log(100);
|
|
410
|
+
}
|
|
411
|
+
function c(e, t, n, r, i) {
|
|
412
|
+
var a = t - e, o = r - n, s = e + (i - n) / o * a;
|
|
413
|
+
return s <= e && (s = e), s >= t && (s = t), s;
|
|
414
|
+
}
|
|
415
|
+
})), se = /* @__PURE__ */ D(((e, t) => {
|
|
416
|
+
var n = P(), r = {}, i = {
|
|
417
|
+
gain: 1,
|
|
418
|
+
attack: .01,
|
|
419
|
+
decay: .1,
|
|
420
|
+
sustain: .9,
|
|
421
|
+
release: .3,
|
|
422
|
+
loop: !1,
|
|
423
|
+
cents: 0,
|
|
424
|
+
loopStart: 0,
|
|
425
|
+
loopEnd: 0
|
|
426
|
+
};
|
|
427
|
+
function a(e, t, n) {
|
|
428
|
+
var a = !1, o = 0, s = {}, u = e.createGain();
|
|
429
|
+
u.gain.value = 1;
|
|
430
|
+
var d = Object.assign({}, i, n), f = {
|
|
431
|
+
context: e,
|
|
432
|
+
out: u,
|
|
433
|
+
opts: d
|
|
434
|
+
};
|
|
435
|
+
return t instanceof AudioBuffer ? f.buffer = t : f.buffers = t, f.start = function(t, n, i) {
|
|
436
|
+
if (f.buffer && t !== null) return f.start(null, t, n);
|
|
437
|
+
var o = t ? f.buffers[t] : f.buffer;
|
|
438
|
+
if (!o) {
|
|
439
|
+
console.warn("Buffer " + t + " not found.");
|
|
440
|
+
return;
|
|
441
|
+
} else if (!a) {
|
|
442
|
+
console.warn("SamplePlayer not connected to any node.");
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
var s = i || r;
|
|
446
|
+
n = Math.max(e.currentTime, n || 0), f.emit("start", n, t, s);
|
|
447
|
+
var c = m(t, o, s);
|
|
448
|
+
return c.id = p(t, c), c.env.start(n), c.source.start(n), f.emit("started", n, c.id, c), s.duration && c.stop(n + s.duration), c;
|
|
449
|
+
}, f.play = function(e, t, n) {
|
|
450
|
+
return f.start(e, t, n);
|
|
451
|
+
}, f.stop = function(e, t) {
|
|
452
|
+
var n;
|
|
453
|
+
return t ||= Object.keys(s), t.map(function(t) {
|
|
454
|
+
return n = s[t], n ? (n.stop(e), n.id) : null;
|
|
455
|
+
});
|
|
456
|
+
}, f.connect = function(e) {
|
|
457
|
+
return a = !0, u.connect(e), f;
|
|
458
|
+
}, f.emit = function(e, t, n, r) {
|
|
459
|
+
f.onevent && f.onevent(e, t, n, r);
|
|
460
|
+
var i = f["on" + e];
|
|
461
|
+
i && i(t, n, r);
|
|
462
|
+
}, f;
|
|
463
|
+
function p(t, n) {
|
|
464
|
+
return n.id = o++, s[n.id] = n, n.source.onended = function() {
|
|
465
|
+
var t = e.currentTime;
|
|
466
|
+
n.source.disconnect(), n.env.disconnect(), n.disconnect(), f.emit("ended", t, n.id, n);
|
|
467
|
+
}, n.id;
|
|
468
|
+
}
|
|
469
|
+
function m(t, n, r) {
|
|
470
|
+
var i = e.createGain();
|
|
471
|
+
return i.gain.value = 0, i.connect(u), i.env = c(e, r, d), i.env.connect(i.gain), i.source = e.createBufferSource(), i.source.buffer = n, i.source.connect(i), i.source.loop = r.loop || d.loop, i.source.playbackRate.value = l(r.cents || d.cents), i.source.loopStart = r.loopStart || d.loopStart, i.source.loopEnd = r.loopEnd || d.loopEnd, i.stop = function(n) {
|
|
472
|
+
var r = n || e.currentTime;
|
|
473
|
+
f.emit("stop", r, t);
|
|
474
|
+
var a = i.env.stop(r);
|
|
475
|
+
i.source.stop(a);
|
|
476
|
+
}, i;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function o(e) {
|
|
480
|
+
return typeof e == "number";
|
|
481
|
+
}
|
|
482
|
+
var s = [
|
|
483
|
+
"attack",
|
|
484
|
+
"decay",
|
|
485
|
+
"sustain",
|
|
486
|
+
"release"
|
|
487
|
+
];
|
|
488
|
+
function c(e, t, r) {
|
|
489
|
+
var i = n(e), a = t.adsr || r.adsr;
|
|
490
|
+
return s.forEach(function(e, n) {
|
|
491
|
+
a ? i[e] = a[n] : i[e] = t[e] || r[e];
|
|
492
|
+
}), i.value.value = o(t.gain) ? t.gain : o(r.gain) ? r.gain : 1, i;
|
|
493
|
+
}
|
|
494
|
+
function l(e) {
|
|
495
|
+
return e ? 2 ** (e / 1200) : 1;
|
|
496
|
+
}
|
|
497
|
+
t.exports = a;
|
|
498
|
+
})), ce = /* @__PURE__ */ D(((e, t) => {
|
|
499
|
+
t.exports = function(e) {
|
|
500
|
+
return e.on = function(t, r) {
|
|
501
|
+
if (arguments.length === 1 && typeof t == "function") return e.on("event", t);
|
|
502
|
+
var i = "on" + t, a = e[i];
|
|
503
|
+
return e[i] = a ? n(a, r) : r, e;
|
|
504
|
+
}, e;
|
|
505
|
+
};
|
|
506
|
+
function n(e, t) {
|
|
507
|
+
return function(n, r, i, a) {
|
|
508
|
+
e(n, r, i, a), t(n, r, i, a);
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
})), le = /* @__PURE__ */ D(((e, t) => {
|
|
512
|
+
var n = /^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;
|
|
513
|
+
function r() {
|
|
514
|
+
return n;
|
|
515
|
+
}
|
|
516
|
+
var i = [
|
|
517
|
+
0,
|
|
518
|
+
2,
|
|
519
|
+
4,
|
|
520
|
+
5,
|
|
521
|
+
7,
|
|
522
|
+
9,
|
|
523
|
+
11
|
|
524
|
+
];
|
|
525
|
+
function a(e, t, r) {
|
|
526
|
+
if (typeof e != "string") return null;
|
|
527
|
+
var a = n.exec(e);
|
|
528
|
+
if (!a || !t && a[4]) return null;
|
|
529
|
+
var s = {
|
|
530
|
+
letter: a[1].toUpperCase(),
|
|
531
|
+
acc: a[2].replace(/x/g, "##")
|
|
532
|
+
};
|
|
533
|
+
return s.pc = s.letter + s.acc, s.step = (s.letter.charCodeAt(0) + 3) % 7, s.alt = s.acc[0] === "b" ? -s.acc.length : s.acc.length, s.chroma = i[s.step] + s.alt, a[3] && (s.oct = +a[3], s.midi = s.chroma + 12 * (s.oct + 1), s.freq = o(s.midi, r)), t && (s.tonicOf = a[4]), s;
|
|
534
|
+
}
|
|
535
|
+
function o(e, t) {
|
|
536
|
+
return 2 ** ((e - 69) / 12) * (t || 440);
|
|
537
|
+
}
|
|
538
|
+
var s = {
|
|
539
|
+
parse: a,
|
|
540
|
+
regex: r,
|
|
541
|
+
midiToFreq: o
|
|
542
|
+
};
|
|
543
|
+
[
|
|
544
|
+
"letter",
|
|
545
|
+
"acc",
|
|
546
|
+
"pc",
|
|
547
|
+
"step",
|
|
548
|
+
"alt",
|
|
549
|
+
"chroma",
|
|
550
|
+
"oct",
|
|
551
|
+
"midi",
|
|
552
|
+
"freq"
|
|
553
|
+
].forEach(function(e) {
|
|
554
|
+
s[e] = function(t) {
|
|
555
|
+
var n = a(t);
|
|
556
|
+
return n && n[e] !== void 0 ? n[e] : null;
|
|
557
|
+
};
|
|
558
|
+
}), t.exports = s;
|
|
559
|
+
})), ue = /* @__PURE__ */ D(((e, t) => {
|
|
560
|
+
var n = le(), r = function(e) {
|
|
561
|
+
return e !== null && e !== [] && e >= 0 && e < 129;
|
|
562
|
+
}, i = function(e) {
|
|
563
|
+
return r(e) ? +e : n.midi(e);
|
|
564
|
+
};
|
|
565
|
+
t.exports = function(e) {
|
|
566
|
+
if (e.buffers) {
|
|
567
|
+
var t = e.opts.map, n = typeof t == "function" ? t : i, r = function(e) {
|
|
568
|
+
return e ? n(e) || e : null;
|
|
569
|
+
};
|
|
570
|
+
e.buffers = a(e.buffers, r);
|
|
571
|
+
var o = e.start;
|
|
572
|
+
e.start = function(e, t, n) {
|
|
573
|
+
var i = r(e), a = i % 1;
|
|
574
|
+
return a && (i = Math.floor(i), n = Object.assign(n || {}, { cents: Math.floor(a * 100) })), o(i, t, n);
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
return e;
|
|
578
|
+
};
|
|
579
|
+
function a(e, t) {
|
|
580
|
+
return Object.keys(e).reduce(function(n, r) {
|
|
581
|
+
return n[t(r)] = e[r], n;
|
|
582
|
+
}, {});
|
|
583
|
+
}
|
|
584
|
+
})), de = /* @__PURE__ */ D(((e, t) => {
|
|
585
|
+
var n = Array.isArray, r = function(e) {
|
|
586
|
+
return e && typeof e == "object";
|
|
587
|
+
}, i = {};
|
|
588
|
+
t.exports = function(e) {
|
|
589
|
+
return e.schedule = function(t, a) {
|
|
590
|
+
var o = e.context.currentTime, s = t < o ? o : t;
|
|
591
|
+
e.emit("schedule", s, a);
|
|
592
|
+
var c, l, u, d;
|
|
593
|
+
return a.map(function(t) {
|
|
594
|
+
if (t) n(t) ? (c = t[0], l = t[1]) : (c = t.time, l = t);
|
|
595
|
+
else return null;
|
|
596
|
+
return r(l) ? (u = l.name || l.key || l.note || l.midi || null, d = l) : (u = l, d = i), e.start(u, s + (c || 0), d);
|
|
597
|
+
});
|
|
598
|
+
}, e;
|
|
599
|
+
};
|
|
600
|
+
})), fe = /* @__PURE__ */ D(((e, t) => {
|
|
601
|
+
(function(n) {
|
|
602
|
+
if (typeof e == "object" && t !== void 0) t.exports = n();
|
|
603
|
+
else if (typeof define == "function" && define.amd) define([], n);
|
|
604
|
+
else {
|
|
605
|
+
var r = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this;
|
|
606
|
+
r.midimessage = n();
|
|
607
|
+
}
|
|
608
|
+
})(function() {
|
|
609
|
+
return function e(t, n, r) {
|
|
610
|
+
function i(o, s) {
|
|
611
|
+
if (!n[o]) {
|
|
612
|
+
if (!t[o]) {
|
|
613
|
+
var c = typeof M == "function" && M;
|
|
614
|
+
if (!s && c) return c(o, !0);
|
|
615
|
+
if (a) return a(o, !0);
|
|
616
|
+
var l = /* @__PURE__ */ Error("Cannot find module '" + o + "'");
|
|
617
|
+
throw l.code = "MODULE_NOT_FOUND", l;
|
|
618
|
+
}
|
|
619
|
+
var u = n[o] = { exports: {} };
|
|
620
|
+
t[o][0].call(u.exports, function(e) {
|
|
621
|
+
var n = t[o][1][e];
|
|
622
|
+
return i(n || e);
|
|
623
|
+
}, u, u.exports, e, t, n, r);
|
|
624
|
+
}
|
|
625
|
+
return n[o].exports;
|
|
626
|
+
}
|
|
627
|
+
for (var a = typeof M == "function" && M, o = 0; o < r.length; o++) i(r[o]);
|
|
628
|
+
return i;
|
|
629
|
+
}({ 1: [function(e, t, n) {
|
|
630
|
+
Object.defineProperty(n, "__esModule", { value: !0 }), n.default = function(e) {
|
|
631
|
+
function t(e) {
|
|
632
|
+
if (this._event = e, this._data = e.data, this.receivedTime = e.receivedTime, this._data && this._data.length < 2) {
|
|
633
|
+
console.warn("Illegal MIDI message of length", this._data.length);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
switch (this._messageCode = e.data[0] & 240, this.channel = e.data[0] & 15, this._messageCode) {
|
|
637
|
+
case 128:
|
|
638
|
+
this.messageType = "noteoff", this.key = e.data[1] & 127, this.velocity = e.data[2] & 127;
|
|
639
|
+
break;
|
|
640
|
+
case 144:
|
|
641
|
+
this.messageType = "noteon", this.key = e.data[1] & 127, this.velocity = e.data[2] & 127;
|
|
642
|
+
break;
|
|
643
|
+
case 160:
|
|
644
|
+
this.messageType = "keypressure", this.key = e.data[1] & 127, this.pressure = e.data[2] & 127;
|
|
645
|
+
break;
|
|
646
|
+
case 176:
|
|
647
|
+
this.messageType = "controlchange", this.controllerNumber = e.data[1] & 127, this.controllerValue = e.data[2] & 127, this.controllerNumber === 120 && this.controllerValue === 0 ? this.channelModeMessage = "allsoundoff" : this.controllerNumber === 121 ? this.channelModeMessage = "resetallcontrollers" : this.controllerNumber === 122 ? this.controllerValue === 0 ? this.channelModeMessage = "localcontroloff" : this.channelModeMessage = "localcontrolon" : this.controllerNumber === 123 && this.controllerValue === 0 ? this.channelModeMessage = "allnotesoff" : this.controllerNumber === 124 && this.controllerValue === 0 ? this.channelModeMessage = "omnimodeoff" : this.controllerNumber === 125 && this.controllerValue === 0 ? this.channelModeMessage = "omnimodeon" : this.controllerNumber === 126 ? this.channelModeMessage = "monomodeon" : this.controllerNumber === 127 && (this.channelModeMessage = "polymodeon");
|
|
648
|
+
break;
|
|
649
|
+
case 192:
|
|
650
|
+
this.messageType = "programchange", this.program = e.data[1];
|
|
651
|
+
break;
|
|
652
|
+
case 208:
|
|
653
|
+
this.messageType = "channelpressure", this.pressure = e.data[1] & 127;
|
|
654
|
+
break;
|
|
655
|
+
case 224:
|
|
656
|
+
this.messageType = "pitchbendchange";
|
|
657
|
+
var t = e.data[2] & 127, n = e.data[1] & 127;
|
|
658
|
+
this.pitchBend = (t << 8) + n;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return new t(e);
|
|
663
|
+
}, t.exports = n.default;
|
|
664
|
+
}, {}] }, {}, [1])(1);
|
|
665
|
+
});
|
|
666
|
+
})), pe = /* @__PURE__ */ D(((e, t) => {
|
|
667
|
+
var n = fe();
|
|
668
|
+
t.exports = function(e) {
|
|
669
|
+
return e.listenToMidi = function(t, r) {
|
|
670
|
+
var i = {}, a = r || {}, o = a.gain || function(e) {
|
|
671
|
+
return e / 127;
|
|
672
|
+
};
|
|
673
|
+
return t.onmidimessage = function(t) {
|
|
674
|
+
var r = t.messageType ? t : n(t);
|
|
675
|
+
if (r.messageType === "noteon" && r.velocity === 0 && (r.messageType = "noteoff"), !(a.channel && r.channel !== a.channel)) switch (r.messageType) {
|
|
676
|
+
case "noteon":
|
|
677
|
+
i[r.key] = e.play(r.key, 0, { gain: o(r.velocity) });
|
|
678
|
+
break;
|
|
679
|
+
case "noteoff":
|
|
680
|
+
i[r.key] && (i[r.key].stop(), delete i[r.key]);
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
}, e;
|
|
684
|
+
}, e;
|
|
685
|
+
};
|
|
686
|
+
})), me = /* @__PURE__ */ D(((e, t) => {
|
|
687
|
+
var n = se(), r = ce(), i = ue(), a = de(), o = pe();
|
|
688
|
+
function s(e, t, s) {
|
|
689
|
+
return o(a(i(r(n(e, t, s)))));
|
|
690
|
+
}
|
|
691
|
+
typeof t == "object" && t.exports && (t.exports = s), typeof window < "u" && (window.SamplePlayer = s);
|
|
692
|
+
})), he = /* @__PURE__ */ O({
|
|
693
|
+
acc: () => ke,
|
|
694
|
+
alt: () => Me,
|
|
695
|
+
build: () => Te,
|
|
696
|
+
chroma: () => Ne,
|
|
697
|
+
freq: () => De,
|
|
698
|
+
letter: () => Oe,
|
|
699
|
+
midi: () => Ee,
|
|
700
|
+
oct: () => Pe,
|
|
701
|
+
parse: () => Se,
|
|
702
|
+
pc: () => Ae,
|
|
703
|
+
regex: () => xe,
|
|
704
|
+
step: () => je
|
|
705
|
+
});
|
|
706
|
+
function ge(e, t) {
|
|
707
|
+
return Array(t + 1).join(e);
|
|
708
|
+
}
|
|
709
|
+
function _e(e) {
|
|
710
|
+
return typeof e == "number";
|
|
711
|
+
}
|
|
712
|
+
function ve(e) {
|
|
713
|
+
return typeof e == "string";
|
|
714
|
+
}
|
|
715
|
+
function ye(e) {
|
|
716
|
+
return e !== void 0;
|
|
717
|
+
}
|
|
718
|
+
function be(e, t) {
|
|
719
|
+
return 2 ** ((e - 69) / 12) * (t || 440);
|
|
720
|
+
}
|
|
721
|
+
function xe() {
|
|
722
|
+
return Fe;
|
|
723
|
+
}
|
|
724
|
+
function Se(e, t, n) {
|
|
725
|
+
if (typeof e != "string") return null;
|
|
726
|
+
var r = Fe.exec(e);
|
|
727
|
+
if (!r || !t && r[4]) return null;
|
|
728
|
+
var i = {
|
|
729
|
+
letter: r[1].toUpperCase(),
|
|
730
|
+
acc: r[2].replace(/x/g, "##")
|
|
731
|
+
};
|
|
732
|
+
i.pc = i.letter + i.acc, i.step = (i.letter.charCodeAt(0) + 3) % 7, i.alt = i.acc[0] === "b" ? -i.acc.length : i.acc.length;
|
|
733
|
+
var a = Ie[i.step] + i.alt;
|
|
734
|
+
return i.chroma = a < 0 ? 12 + a : a % 12, r[3] && (i.oct = +r[3], i.midi = a + 12 * (i.oct + 1), i.freq = be(i.midi, n)), t && (i.tonicOf = r[4]), i;
|
|
735
|
+
}
|
|
736
|
+
function Ce(e) {
|
|
737
|
+
return _e(e) ? e < 0 ? ge("b", -e) : ge("#", e) : "";
|
|
738
|
+
}
|
|
739
|
+
function we(e) {
|
|
740
|
+
return _e(e) ? "" + e : "";
|
|
741
|
+
}
|
|
742
|
+
function Te(e, t, n) {
|
|
743
|
+
return e == null ? null : e.step ? Te(e.step, e.alt, e.oct) : e < 0 || e > 6 ? null : Le.charAt(e) + Ce(t) + we(n);
|
|
744
|
+
}
|
|
745
|
+
function Ee(e) {
|
|
746
|
+
if ((_e(e) || ve(e)) && e >= 0 && e < 128) return +e;
|
|
747
|
+
var t = Se(e);
|
|
748
|
+
return t && ye(t.midi) ? t.midi : null;
|
|
749
|
+
}
|
|
750
|
+
function De(e, t) {
|
|
751
|
+
var n = Ee(e);
|
|
752
|
+
return n === null ? null : be(n, t);
|
|
753
|
+
}
|
|
754
|
+
function Oe(e) {
|
|
755
|
+
return (Se(e) || {}).letter;
|
|
756
|
+
}
|
|
757
|
+
function ke(e) {
|
|
758
|
+
return (Se(e) || {}).acc;
|
|
759
|
+
}
|
|
760
|
+
function Ae(e) {
|
|
761
|
+
return (Se(e) || {}).pc;
|
|
762
|
+
}
|
|
763
|
+
function je(e) {
|
|
764
|
+
return (Se(e) || {}).step;
|
|
765
|
+
}
|
|
766
|
+
function Me(e) {
|
|
767
|
+
return (Se(e) || {}).alt;
|
|
768
|
+
}
|
|
769
|
+
function Ne(e) {
|
|
770
|
+
return (Se(e) || {}).chroma;
|
|
771
|
+
}
|
|
772
|
+
function Pe(e) {
|
|
773
|
+
return (Se(e) || {}).oct;
|
|
774
|
+
}
|
|
775
|
+
var Fe, Ie, Le, Re = E((() => {
|
|
776
|
+
Fe = /^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/, Ie = [
|
|
777
|
+
0,
|
|
778
|
+
2,
|
|
779
|
+
4,
|
|
780
|
+
5,
|
|
781
|
+
7,
|
|
782
|
+
9,
|
|
783
|
+
11
|
|
784
|
+
], Le = "CDEFGAB";
|
|
785
|
+
})), ze = /* @__PURE__ */ D(((e, t) => {
|
|
786
|
+
var n = (Re(), j(he));
|
|
787
|
+
function r(e, t) {
|
|
788
|
+
if (console.warn("new Soundfont() is deprected"), console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"), !(this instanceof r)) return new r(e);
|
|
789
|
+
this.nameToUrl = t || r.nameToUrl, this.ctx = e, this.instruments = {}, this.promises = [];
|
|
790
|
+
}
|
|
791
|
+
r.prototype.onready = function(e) {
|
|
792
|
+
console.warn("deprecated API"), console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"), Promise.all(this.promises).then(e);
|
|
793
|
+
}, r.prototype.instrument = function(e, t) {
|
|
794
|
+
console.warn("new Soundfont().instrument() is deprecated."), console.log("Please use Soundfont.instrument() instead.");
|
|
795
|
+
var n = this.ctx;
|
|
796
|
+
if (e ||= "default", e in this.instruments) return this.instruments[e];
|
|
797
|
+
var i = {
|
|
798
|
+
name: e,
|
|
799
|
+
play: a(n, t)
|
|
800
|
+
};
|
|
801
|
+
if (this.instruments[e] = i, e !== "default") {
|
|
802
|
+
var o = r.instrument(n, e, t).then(function(e) {
|
|
803
|
+
return i.play = e.play, i;
|
|
804
|
+
});
|
|
805
|
+
this.promises.push(o), i.onready = function(e) {
|
|
806
|
+
console.warn("onready is deprecated. Use Soundfont.instrument().then()"), o.then(e);
|
|
807
|
+
};
|
|
808
|
+
} else i.onready = function(e) {
|
|
809
|
+
console.warn("onready is deprecated. Use Soundfont.instrument().then()"), e();
|
|
810
|
+
};
|
|
811
|
+
return i;
|
|
812
|
+
};
|
|
813
|
+
function i(e, t, n) {
|
|
814
|
+
return console.warn("Soundfont.loadBuffers is deprecate."), console.log("Use Soundfont.instrument(..) and get buffers properties from the result."), r.instrument(e, t, n).then(function(e) {
|
|
815
|
+
return e.buffers;
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
r.loadBuffers = i;
|
|
819
|
+
function a(e, t) {
|
|
820
|
+
return t ||= {}, function(r, i, a, o) {
|
|
821
|
+
console.warn("The oscillator player is deprecated."), console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");
|
|
822
|
+
var s = r > 0 && r < 129 ? +r : n.midi(r), c = s ? n.midiToFreq(s, 440) : null;
|
|
823
|
+
if (c) {
|
|
824
|
+
a ||= .2, o ||= {};
|
|
825
|
+
var l = o.destination || t.destination || e.destination, u = o.vcoType || t.vcoType || "sine", d = o.gain || t.gain || .4, f = e.createOscillator();
|
|
826
|
+
f.type = u, f.frequency.value = c;
|
|
827
|
+
var p = e.createGain();
|
|
828
|
+
return p.gain.value = d, f.connect(p), p.connect(l), f.start(i), a > 0 && f.stop(i + a), f;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
r.noteToMidi = n.midi, t.exports = r;
|
|
833
|
+
})), Be = /* @__PURE__ */ A((/* @__PURE__ */ D(((e, t) => {
|
|
834
|
+
var n = oe(), r = me();
|
|
835
|
+
function i(e, t, s) {
|
|
836
|
+
if (arguments.length === 1) return function(t, n) {
|
|
837
|
+
return i(e, t, n);
|
|
838
|
+
};
|
|
839
|
+
var c = s || {}, l = c.isSoundfontURL || a, u = c.nameToUrl || o, d = l(t) ? t : u(t, c.soundfont, c.format);
|
|
840
|
+
return n(e, d, { only: c.only || c.notes }).then(function(n) {
|
|
841
|
+
var i = r(e, n, c).connect(c.destination ? c.destination : e.destination);
|
|
842
|
+
return i.url = d, i.name = t, i;
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
function a(e) {
|
|
846
|
+
return /\.js(\?.*)?$/i.test(e);
|
|
847
|
+
}
|
|
848
|
+
function o(e, t, n) {
|
|
849
|
+
return n = n === "ogg" ? n : "mp3", t = t === "FluidR3_GM" ? t : "MusyngKite", "https://gleitz.github.io/midi-js-soundfonts/" + t + "/" + e + "-" + n + ".js";
|
|
850
|
+
}
|
|
851
|
+
var s = ze();
|
|
852
|
+
s.instrument = i, s.nameToUrl = o, typeof t == "object" && t.exports && (t.exports = s), typeof window < "u" && (window.Soundfont = s);
|
|
853
|
+
})))(), 1), Ve = class {
|
|
854
|
+
constructor() {
|
|
855
|
+
this.players = /* @__PURE__ */ new Map(), this.instruments = re.filter((e) => N.includes(this.getSoundfontInstrumentName(e[1]))).map((e) => ({
|
|
856
|
+
midiId: e[0],
|
|
857
|
+
name: e[1],
|
|
858
|
+
loaded: !1
|
|
859
|
+
}));
|
|
860
|
+
}
|
|
861
|
+
init(e) {
|
|
862
|
+
this.audioContext = e;
|
|
863
|
+
}
|
|
864
|
+
async load(e) {
|
|
865
|
+
let t = this.instruments.find((t) => t.midiId === e);
|
|
866
|
+
if (!t) throw Error("SoundfontPlayer does not support midi instrument ID " + e);
|
|
867
|
+
if (this.players.has(e)) return;
|
|
868
|
+
let n = await Be.instrument(this.audioContext, this.getSoundfontInstrumentName(t.name));
|
|
869
|
+
this.players.set(e, n);
|
|
870
|
+
}
|
|
871
|
+
stop(e) {
|
|
872
|
+
this.players.has(e) && this.players.get(e).stop();
|
|
873
|
+
}
|
|
874
|
+
schedule(e, t, n) {
|
|
875
|
+
this.verifyPlayerLoaded(e), this.applyDynamics(n), this.players.get(e).schedule(t, n);
|
|
876
|
+
}
|
|
877
|
+
applyDynamics(e) {
|
|
878
|
+
for (let t of e) t.articulation === ne.Staccato && (t.gain = Math.max(t.gain + .3, t.gain * 1.3), t.duration = Math.min(t.duration * .4, .4));
|
|
879
|
+
}
|
|
880
|
+
verifyPlayerLoaded(e) {
|
|
881
|
+
if (!this.players.has(e)) throw Error("No soundfont player loaded for midi instrument " + e);
|
|
882
|
+
}
|
|
883
|
+
getSoundfontInstrumentName(e) {
|
|
884
|
+
return e.toLowerCase().replace(/\s+/g, "_");
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region node_modules/@modernized/osmd-audio-player/dist/internals/noteHelpers.js
|
|
889
|
+
function He(e) {
|
|
890
|
+
return e.ParentVoiceEntry.isStaccato() ? ne.Staccato : ne.None;
|
|
891
|
+
}
|
|
892
|
+
function Ue(e, t) {
|
|
893
|
+
let n = e.Length.RealValue * t;
|
|
894
|
+
return e.NoteTie && (Object.is(e.NoteTie.StartNote, e) && e.NoteTie.Notes[1] ? n += e.NoteTie.Notes[1].Length.RealValue * t : n = 0), n;
|
|
895
|
+
}
|
|
896
|
+
function We(e) {
|
|
897
|
+
return e.ParentVoiceEntry.ParentVoice.Volume;
|
|
898
|
+
}
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region node_modules/@modernized/osmd-audio-player/dist/internals/EventEmitter.js
|
|
901
|
+
var Ge = class {
|
|
902
|
+
constructor() {
|
|
903
|
+
this.subscribers = /* @__PURE__ */ new Map();
|
|
904
|
+
}
|
|
905
|
+
on(e, t) {
|
|
906
|
+
this.subscribers.get(e) || this.subscribers.set(e, []), this.subscribers.get(e).push(t);
|
|
907
|
+
}
|
|
908
|
+
emit(e, ...t) {
|
|
909
|
+
let n = this.subscribers.get(e) || [];
|
|
910
|
+
for (let e of n) e(...t);
|
|
911
|
+
}
|
|
912
|
+
}, Ke = /* @__PURE__ */ D(((e, t) => {
|
|
913
|
+
function n(e) {
|
|
914
|
+
if (Array.isArray(e)) return e;
|
|
915
|
+
}
|
|
916
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
917
|
+
})), qe = /* @__PURE__ */ D(((e, t) => {
|
|
918
|
+
function n(e, t) {
|
|
919
|
+
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
920
|
+
if (n != null) {
|
|
921
|
+
var r, i, a, o, s = [], c = !0, l = !1;
|
|
922
|
+
try {
|
|
923
|
+
if (a = (n = n.call(e)).next, t === 0) {
|
|
924
|
+
if (Object(n) !== n) return;
|
|
925
|
+
c = !1;
|
|
926
|
+
} else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
927
|
+
} catch (e) {
|
|
928
|
+
l = !0, i = e;
|
|
929
|
+
} finally {
|
|
930
|
+
try {
|
|
931
|
+
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
932
|
+
} finally {
|
|
933
|
+
if (l) throw i;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
return s;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
940
|
+
})), Je = /* @__PURE__ */ D(((e, t) => {
|
|
941
|
+
function n(e, t) {
|
|
942
|
+
(t == null || t > e.length) && (t = e.length);
|
|
943
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
944
|
+
return r;
|
|
945
|
+
}
|
|
946
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
947
|
+
})), Ye = /* @__PURE__ */ D(((e, t) => {
|
|
948
|
+
var n = Je();
|
|
949
|
+
function r(e, t) {
|
|
950
|
+
if (e) {
|
|
951
|
+
if (typeof e == "string") return n(e, t);
|
|
952
|
+
var r = {}.toString.call(e).slice(8, -1);
|
|
953
|
+
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(e, t) : void 0;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
t.exports = r, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
957
|
+
})), Xe = /* @__PURE__ */ D(((e, t) => {
|
|
958
|
+
function n() {
|
|
959
|
+
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
960
|
+
}
|
|
961
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
962
|
+
})), Ze = /* @__PURE__ */ D(((e, t) => {
|
|
963
|
+
var n = Ke(), r = qe(), i = Ye(), a = Xe();
|
|
964
|
+
function o(e, t) {
|
|
965
|
+
return n(e) || r(e, t) || i(e, t) || a();
|
|
966
|
+
}
|
|
967
|
+
t.exports = o, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
968
|
+
})), Qe = /* @__PURE__ */ D(((e, t) => {
|
|
969
|
+
function n(e, t) {
|
|
970
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
971
|
+
}
|
|
972
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
973
|
+
})), $e = /* @__PURE__ */ D(((e, t) => {
|
|
974
|
+
function n(e) {
|
|
975
|
+
"@babel/helpers - typeof";
|
|
976
|
+
return t.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
977
|
+
return typeof e;
|
|
978
|
+
} : function(e) {
|
|
979
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
980
|
+
}, t.exports.__esModule = !0, t.exports.default = t.exports, n(e);
|
|
981
|
+
}
|
|
982
|
+
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
983
|
+
})), et = /* @__PURE__ */ D(((e, t) => {
|
|
984
|
+
var n = $e().default;
|
|
985
|
+
function r(e, t) {
|
|
986
|
+
if (n(e) != "object" || !e) return e;
|
|
987
|
+
var r = e[Symbol.toPrimitive];
|
|
988
|
+
if (r !== void 0) {
|
|
989
|
+
var i = r.call(e, t || "default");
|
|
990
|
+
if (n(i) != "object") return i;
|
|
991
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
992
|
+
}
|
|
993
|
+
return (t === "string" ? String : Number)(e);
|
|
994
|
+
}
|
|
995
|
+
t.exports = r, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
996
|
+
})), tt = /* @__PURE__ */ D(((e, t) => {
|
|
997
|
+
var n = $e().default, r = et();
|
|
998
|
+
function i(e) {
|
|
999
|
+
var t = r(e, "string");
|
|
1000
|
+
return n(t) == "symbol" ? t : t + "";
|
|
1001
|
+
}
|
|
1002
|
+
t.exports = i, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
1003
|
+
})), nt = /* @__PURE__ */ D(((e, t) => {
|
|
1004
|
+
var n = tt();
|
|
1005
|
+
function r(e, t) {
|
|
1006
|
+
for (var r = 0; r < t.length; r++) {
|
|
1007
|
+
var i = t[r];
|
|
1008
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, n(i.key), i);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function i(e, t, n) {
|
|
1012
|
+
return t && r(e.prototype, t), n && r(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1013
|
+
}
|
|
1014
|
+
t.exports = i, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
1015
|
+
})), rt = (/* @__PURE__ */ D(((e, t) => {
|
|
1016
|
+
(function(n, r) {
|
|
1017
|
+
typeof e == "object" && t !== void 0 ? r(e, Ze(), Qe(), nt()) : typeof define == "function" && define.amd ? define([
|
|
1018
|
+
"exports",
|
|
1019
|
+
"@babel/runtime/helpers/slicedToArray",
|
|
1020
|
+
"@babel/runtime/helpers/classCallCheck",
|
|
1021
|
+
"@babel/runtime/helpers/createClass"
|
|
1022
|
+
], r) : (n = typeof globalThis < "u" ? globalThis : n || self, r(n.automationEvents = {}, n._slicedToArray, n._classCallCheck, n._createClass));
|
|
1023
|
+
})(e, (function(e, t, n, r) {
|
|
1024
|
+
var i = function(e, t, n) {
|
|
1025
|
+
return {
|
|
1026
|
+
endTime: t,
|
|
1027
|
+
insertTime: n,
|
|
1028
|
+
type: "exponentialRampToValue",
|
|
1029
|
+
value: e
|
|
1030
|
+
};
|
|
1031
|
+
}, a = function(e, t, n) {
|
|
1032
|
+
return {
|
|
1033
|
+
endTime: t,
|
|
1034
|
+
insertTime: n,
|
|
1035
|
+
type: "linearRampToValue",
|
|
1036
|
+
value: e
|
|
1037
|
+
};
|
|
1038
|
+
}, o = function(e, t) {
|
|
1039
|
+
return {
|
|
1040
|
+
startTime: t,
|
|
1041
|
+
type: "setValue",
|
|
1042
|
+
value: e
|
|
1043
|
+
};
|
|
1044
|
+
}, s = function(e, t, n) {
|
|
1045
|
+
return {
|
|
1046
|
+
duration: n,
|
|
1047
|
+
startTime: t,
|
|
1048
|
+
type: "setValueCurve",
|
|
1049
|
+
values: e
|
|
1050
|
+
};
|
|
1051
|
+
}, c = function(e, t, n) {
|
|
1052
|
+
var r = n.startTime, i = n.target, a = n.timeConstant;
|
|
1053
|
+
return i + (t - i) * Math.exp((r - e) / a);
|
|
1054
|
+
}, l = function(e) {
|
|
1055
|
+
return e.type === "exponentialRampToValue";
|
|
1056
|
+
}, u = function(e) {
|
|
1057
|
+
return e.type === "linearRampToValue";
|
|
1058
|
+
}, d = function(e) {
|
|
1059
|
+
return l(e) || u(e);
|
|
1060
|
+
}, f = function(e) {
|
|
1061
|
+
return e.type === "setValue";
|
|
1062
|
+
}, p = function(e) {
|
|
1063
|
+
return e.type === "setValueCurve";
|
|
1064
|
+
}, m = function(e, t, n, r) {
|
|
1065
|
+
var i = e[t];
|
|
1066
|
+
return i === void 0 ? r : d(i) || f(i) ? i.value : p(i) ? i.values[i.values.length - 1] : c(n, m(e, t - 1, i.startTime, r), i);
|
|
1067
|
+
}, h = function(e, t, n, r, i) {
|
|
1068
|
+
return n === void 0 ? [r.insertTime, i] : d(n) ? [n.endTime, n.value] : f(n) ? [n.startTime, n.value] : p(n) ? [n.startTime + n.duration, n.values[n.values.length - 1]] : [n.startTime, m(e, t - 1, n.startTime, i)];
|
|
1069
|
+
}, g = function(e) {
|
|
1070
|
+
return e.type === "cancelAndHold";
|
|
1071
|
+
}, _ = function(e) {
|
|
1072
|
+
return e.type === "cancelScheduledValues";
|
|
1073
|
+
}, v = function(e) {
|
|
1074
|
+
return g(e) || _(e) ? e.cancelTime : l(e) || u(e) ? e.endTime : e.startTime;
|
|
1075
|
+
}, y = function(e, t, n, r) {
|
|
1076
|
+
var i = r.endTime, a = r.value;
|
|
1077
|
+
return n === a ? a : 0 < n && 0 < a || n < 0 && a < 0 ? n * (a / n) ** +((e - t) / (i - t)) : e < i ? n : a;
|
|
1078
|
+
}, b = function(e, t, n, r) {
|
|
1079
|
+
var i = r.endTime, a = r.value;
|
|
1080
|
+
return n + (e - t) / (i - t) * (a - n);
|
|
1081
|
+
}, x = function(e, t) {
|
|
1082
|
+
var n = Math.floor(t), r = Math.ceil(t);
|
|
1083
|
+
return n === r ? e[n] : (1 - (t - n)) * e[n] + (1 - (r - t)) * e[r];
|
|
1084
|
+
}, S = function(e, t) {
|
|
1085
|
+
var n = t.duration, r = t.startTime, i = t.values;
|
|
1086
|
+
return x(i, (e - r) / n * (i.length - 1));
|
|
1087
|
+
}, C = function(e) {
|
|
1088
|
+
return e.type === "setTarget";
|
|
1089
|
+
};
|
|
1090
|
+
e.AutomationEventList = /* @__PURE__ */ function() {
|
|
1091
|
+
function e(t) {
|
|
1092
|
+
n(this, e), this._automationEvents = [], this._currenTime = 0, this._defaultValue = t;
|
|
1093
|
+
}
|
|
1094
|
+
return r(e, [
|
|
1095
|
+
{
|
|
1096
|
+
key: Symbol.iterator,
|
|
1097
|
+
value: function() {
|
|
1098
|
+
return this._automationEvents[Symbol.iterator]();
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
key: "add",
|
|
1103
|
+
value: function(e) {
|
|
1104
|
+
var t = v(e);
|
|
1105
|
+
if (g(e) || _(e)) {
|
|
1106
|
+
var n = this._automationEvents.findIndex(function(n) {
|
|
1107
|
+
return _(e) && p(n) ? n.startTime + n.duration >= t : v(n) >= t;
|
|
1108
|
+
}), r = this._automationEvents[n];
|
|
1109
|
+
if (n !== -1 && (this._automationEvents = this._automationEvents.slice(0, n)), g(e)) {
|
|
1110
|
+
var c = this._automationEvents[this._automationEvents.length - 1];
|
|
1111
|
+
if (r !== void 0 && d(r)) {
|
|
1112
|
+
if (c !== void 0 && C(c)) throw Error("The internal list is malformed.");
|
|
1113
|
+
var f = c === void 0 ? r.insertTime : p(c) ? c.startTime + c.duration : v(c), m = c === void 0 ? this._defaultValue : p(c) ? c.values[c.values.length - 1] : c.value, h = l(r) ? y(t, f, m, r) : b(t, f, m, r), x = l(r) ? i(h, t, this._currenTime) : a(h, t, this._currenTime);
|
|
1114
|
+
this._automationEvents.push(x);
|
|
1115
|
+
}
|
|
1116
|
+
if (c !== void 0 && C(c) && this._automationEvents.push(o(this.getValue(t), t)), c !== void 0 && p(c) && c.startTime + c.duration > t) {
|
|
1117
|
+
var S = t - c.startTime, w = (c.values.length - 1) / c.duration, T = Math.max(2, 1 + Math.ceil(S * w)), E = S / (T - 1) * w, D = c.values.slice(0, T);
|
|
1118
|
+
if (E < 1) for (var O = 1; O < T; O += 1) {
|
|
1119
|
+
var k = E * O % 1;
|
|
1120
|
+
D[O] = c.values[O - 1] * (1 - k) + c.values[O] * k;
|
|
1121
|
+
}
|
|
1122
|
+
this._automationEvents[this._automationEvents.length - 1] = s(D, c.startTime, S);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
} else {
|
|
1126
|
+
var A = this._automationEvents.findIndex(function(e) {
|
|
1127
|
+
return v(e) > t;
|
|
1128
|
+
}), j = A === -1 ? this._automationEvents[this._automationEvents.length - 1] : this._automationEvents[A - 1];
|
|
1129
|
+
if (j !== void 0 && p(j) && v(j) + j.duration > t) return !1;
|
|
1130
|
+
var M = l(e) ? i(e.value, e.endTime, this._currenTime) : u(e) ? a(e.value, t, this._currenTime) : e;
|
|
1131
|
+
if (A === -1) this._automationEvents.push(M);
|
|
1132
|
+
else {
|
|
1133
|
+
if (p(e) && t + e.duration > v(this._automationEvents[A])) return !1;
|
|
1134
|
+
this._automationEvents.splice(A, 0, M);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
return !0;
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
key: "flush",
|
|
1142
|
+
value: function(e) {
|
|
1143
|
+
var t = this._automationEvents.findIndex(function(t) {
|
|
1144
|
+
return v(t) > e;
|
|
1145
|
+
});
|
|
1146
|
+
if (t > 1) {
|
|
1147
|
+
var n = this._automationEvents.slice(t - 1), r = n[0];
|
|
1148
|
+
C(r) && n.unshift(o(m(this._automationEvents, t - 2, r.startTime, this._defaultValue), r.startTime)), this._automationEvents = n;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
key: "getValue",
|
|
1154
|
+
value: function(e) {
|
|
1155
|
+
if (this._automationEvents.length === 0) return this._defaultValue;
|
|
1156
|
+
var n = this._automationEvents.findIndex(function(t) {
|
|
1157
|
+
return v(t) > e;
|
|
1158
|
+
}), r = this._automationEvents[n], i = (n === -1 ? this._automationEvents.length : n) - 1, a = this._automationEvents[i];
|
|
1159
|
+
if (a !== void 0 && C(a) && (r === void 0 || !d(r) || r.insertTime > e)) return c(e, m(this._automationEvents, i - 1, a.startTime, this._defaultValue), a);
|
|
1160
|
+
if (a !== void 0 && f(a) && (r === void 0 || !d(r))) return a.value;
|
|
1161
|
+
if (a !== void 0 && p(a) && (r === void 0 || !d(r) || a.startTime + a.duration > e)) return e < a.startTime + a.duration ? S(e, a) : a.values[a.values.length - 1];
|
|
1162
|
+
if (a !== void 0 && d(a) && (r === void 0 || !d(r))) return a.value;
|
|
1163
|
+
if (r !== void 0 && l(r)) {
|
|
1164
|
+
var o = t(h(this._automationEvents, i, a, r, this._defaultValue), 2), s = o[0], g = o[1];
|
|
1165
|
+
return y(e, s, g, r);
|
|
1166
|
+
}
|
|
1167
|
+
if (r !== void 0 && u(r)) {
|
|
1168
|
+
var _ = t(h(this._automationEvents, i, a, r, this._defaultValue), 2), x = _[0], w = _[1];
|
|
1169
|
+
return b(e, x, w, r);
|
|
1170
|
+
}
|
|
1171
|
+
return this._defaultValue;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
]);
|
|
1175
|
+
}(), e.createCancelAndHoldAutomationEvent = function(e) {
|
|
1176
|
+
return {
|
|
1177
|
+
cancelTime: e,
|
|
1178
|
+
type: "cancelAndHold"
|
|
1179
|
+
};
|
|
1180
|
+
}, e.createCancelScheduledValuesAutomationEvent = function(e) {
|
|
1181
|
+
return {
|
|
1182
|
+
cancelTime: e,
|
|
1183
|
+
type: "cancelScheduledValues"
|
|
1184
|
+
};
|
|
1185
|
+
}, e.createExponentialRampToValueAutomationEvent = function(e, t) {
|
|
1186
|
+
return {
|
|
1187
|
+
endTime: t,
|
|
1188
|
+
type: "exponentialRampToValue",
|
|
1189
|
+
value: e
|
|
1190
|
+
};
|
|
1191
|
+
}, e.createLinearRampToValueAutomationEvent = function(e, t) {
|
|
1192
|
+
return {
|
|
1193
|
+
endTime: t,
|
|
1194
|
+
type: "linearRampToValue",
|
|
1195
|
+
value: e
|
|
1196
|
+
};
|
|
1197
|
+
}, e.createSetTargetAutomationEvent = function(e, t, n) {
|
|
1198
|
+
return {
|
|
1199
|
+
startTime: t,
|
|
1200
|
+
target: e,
|
|
1201
|
+
timeConstant: n,
|
|
1202
|
+
type: "setTarget"
|
|
1203
|
+
};
|
|
1204
|
+
}, e.createSetValueAutomationEvent = o, e.createSetValueCurveAutomationEvent = s;
|
|
1205
|
+
}));
|
|
1206
|
+
})))(), it = () => new DOMException("", "AbortError"), at = (e) => (t, n, [r, i, a], o) => {
|
|
1207
|
+
e(t[i], [
|
|
1208
|
+
n,
|
|
1209
|
+
r,
|
|
1210
|
+
a
|
|
1211
|
+
], (e) => e[0] === n && e[1] === r, o);
|
|
1212
|
+
}, ot = (e) => (t, n, r) => {
|
|
1213
|
+
let i = [];
|
|
1214
|
+
for (let e = 0; e < r.numberOfInputs; e += 1) i.push(/* @__PURE__ */ new Set());
|
|
1215
|
+
e.set(t, {
|
|
1216
|
+
activeInputs: i,
|
|
1217
|
+
outputs: /* @__PURE__ */ new Set(),
|
|
1218
|
+
passiveInputs: /* @__PURE__ */ new WeakMap(),
|
|
1219
|
+
renderer: n
|
|
1220
|
+
});
|
|
1221
|
+
}, st = (e) => (t, n) => {
|
|
1222
|
+
e.set(t, {
|
|
1223
|
+
activeInputs: /* @__PURE__ */ new Set(),
|
|
1224
|
+
passiveInputs: /* @__PURE__ */ new WeakMap(),
|
|
1225
|
+
renderer: n
|
|
1226
|
+
});
|
|
1227
|
+
}, ct = /* @__PURE__ */ new WeakSet(), lt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), _t = { construct() {
|
|
1228
|
+
return _t;
|
|
1229
|
+
} }, vt = (e) => {
|
|
1230
|
+
try {
|
|
1231
|
+
new new Proxy(e, _t)();
|
|
1232
|
+
} catch {
|
|
1233
|
+
return !1;
|
|
1234
|
+
}
|
|
1235
|
+
return !0;
|
|
1236
|
+
}, yt = /^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/, bt = (e, t) => {
|
|
1237
|
+
let n = [], r = e.replace(/^[\s]+/, ""), i = r.match(yt);
|
|
1238
|
+
for (; i !== null;) {
|
|
1239
|
+
let e = i[1].slice(1, -1), a = i[0].replace(/([\s]+)?;?$/, "").replace(e, new URL(e, t).toString());
|
|
1240
|
+
n.push(a), r = r.slice(i[0].length).replace(/^[\s]+/, ""), i = r.match(yt);
|
|
1241
|
+
}
|
|
1242
|
+
return [n.join(";"), r];
|
|
1243
|
+
}, xt = (e) => {
|
|
1244
|
+
if (e !== void 0 && !Array.isArray(e)) throw TypeError("The parameterDescriptors property of given value for processorCtor is not an array.");
|
|
1245
|
+
}, St = (e) => {
|
|
1246
|
+
if (!vt(e)) throw TypeError("The given value for processorCtor should be a constructor.");
|
|
1247
|
+
if (e.prototype === null || typeof e.prototype != "object") throw TypeError("The given value for processorCtor should have a prototype.");
|
|
1248
|
+
}, Ct = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
|
|
1249
|
+
let p = 0;
|
|
1250
|
+
return (m, h, g = { credentials: "omit" }) => {
|
|
1251
|
+
let _ = u.get(m);
|
|
1252
|
+
if (_ !== void 0 && _.has(h)) return Promise.resolve();
|
|
1253
|
+
let v = l.get(m);
|
|
1254
|
+
if (v !== void 0) {
|
|
1255
|
+
let e = v.get(h);
|
|
1256
|
+
if (e !== void 0) return e;
|
|
1257
|
+
}
|
|
1258
|
+
let y = a(m), b = y.audioWorklet === void 0 ? i(h).then(([e, t]) => {
|
|
1259
|
+
let [r, i] = bt(e, t);
|
|
1260
|
+
return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}
|
|
1261
|
+
})})(window,'_AWGS')`);
|
|
1262
|
+
}).then(() => {
|
|
1263
|
+
let e = f._AWGS.pop();
|
|
1264
|
+
if (e === void 0) throw SyntaxError();
|
|
1265
|
+
r(y.currentTime, y.sampleRate, () => e(class {}, void 0, (e, n) => {
|
|
1266
|
+
if (e.trim() === "") throw t();
|
|
1267
|
+
let r = gt.get(y);
|
|
1268
|
+
if (r !== void 0) {
|
|
1269
|
+
if (r.has(e)) throw t();
|
|
1270
|
+
St(n), xt(n.parameterDescriptors), r.set(e, n);
|
|
1271
|
+
} else St(n), xt(n.parameterDescriptors), gt.set(y, new Map([[e, n]]));
|
|
1272
|
+
}, y.sampleRate, void 0, void 0));
|
|
1273
|
+
}) : Promise.all([i(h), Promise.resolve(e(d, d))]).then(([[e, t], n]) => {
|
|
1274
|
+
let r = p + 1;
|
|
1275
|
+
p = r;
|
|
1276
|
+
let [i, a] = bt(e, t), l = `${i};((AudioWorkletProcessor,registerProcessor)=>{${a}
|
|
1277
|
+
})(${n ? "AudioWorkletProcessor" : "class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n ? "" : "__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n ? "" : "i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`, u = new Blob([l], { type: "application/javascript; charset=utf-8" }), d = URL.createObjectURL(u);
|
|
1278
|
+
return y.audioWorklet.addModule(d, g).then(() => {
|
|
1279
|
+
if (s(y)) return y;
|
|
1280
|
+
let e = o(y);
|
|
1281
|
+
return e.audioWorklet.addModule(d, g).then(() => e);
|
|
1282
|
+
}).then((e) => {
|
|
1283
|
+
if (c === null) throw SyntaxError();
|
|
1284
|
+
try {
|
|
1285
|
+
new c(e, `__sac${r}`);
|
|
1286
|
+
} catch {
|
|
1287
|
+
throw SyntaxError();
|
|
1288
|
+
}
|
|
1289
|
+
}).finally(() => URL.revokeObjectURL(d));
|
|
1290
|
+
});
|
|
1291
|
+
return v === void 0 ? l.set(m, new Map([[h, b]])) : v.set(h, b), b.then(() => {
|
|
1292
|
+
let e = u.get(m);
|
|
1293
|
+
e === void 0 ? u.set(m, new Set([h])) : e.add(h);
|
|
1294
|
+
}).finally(() => {
|
|
1295
|
+
let e = l.get(m);
|
|
1296
|
+
e !== void 0 && e.delete(h);
|
|
1297
|
+
}), b;
|
|
1298
|
+
};
|
|
1299
|
+
}, wt = (e, t) => {
|
|
1300
|
+
let n = e.get(t);
|
|
1301
|
+
if (n === void 0) throw Error("A value with the given key could not be found.");
|
|
1302
|
+
return n;
|
|
1303
|
+
}, Tt = (e, t) => {
|
|
1304
|
+
let n = Array.from(e).filter(t);
|
|
1305
|
+
if (n.length > 1) throw Error("More than one element was found.");
|
|
1306
|
+
if (n.length === 0) throw Error("No element was found.");
|
|
1307
|
+
let [r] = n;
|
|
1308
|
+
return e.delete(r), r;
|
|
1309
|
+
}, Et = (e, t, n, r) => {
|
|
1310
|
+
let i = wt(e, t), a = Tt(i, (e) => e[0] === n && e[1] === r);
|
|
1311
|
+
return i.size === 0 && e.delete(t), a;
|
|
1312
|
+
}, Dt = (e) => wt(mt, e), Ot = (e) => {
|
|
1313
|
+
if (ct.has(e)) throw Error("The AudioNode is already stored.");
|
|
1314
|
+
ct.add(e), Dt(e).forEach((e) => e(!0));
|
|
1315
|
+
}, kt = (e) => "port" in e, At = (e) => {
|
|
1316
|
+
if (!ct.has(e)) throw Error("The AudioNode is not stored.");
|
|
1317
|
+
ct.delete(e), Dt(e).forEach((e) => e(!1));
|
|
1318
|
+
}, jt = (e, t) => {
|
|
1319
|
+
!kt(e) && t.every((e) => e.size === 0) && At(e);
|
|
1320
|
+
}, Mt = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
|
|
1321
|
+
let p = /* @__PURE__ */ new WeakMap();
|
|
1322
|
+
return (m, h, g, _, v) => {
|
|
1323
|
+
let { activeInputs: y, passiveInputs: b } = a(h), { outputs: x } = a(m), S = s(m), C = (a) => {
|
|
1324
|
+
let s = c(h), l = c(m);
|
|
1325
|
+
if (a) e(y, m, Et(b, m, g, _), !1), !v && !d(m) && n(l, s, g, _), f(h) && Ot(h);
|
|
1326
|
+
else {
|
|
1327
|
+
t(b, _, r(y, m, g, _), !1), !v && !d(m) && i(l, s, g, _);
|
|
1328
|
+
let e = o(h);
|
|
1329
|
+
if (e === 0) u(h) && jt(h, y);
|
|
1330
|
+
else {
|
|
1331
|
+
let t = p.get(h);
|
|
1332
|
+
t !== void 0 && clearTimeout(t), p.set(h, setTimeout(() => {
|
|
1333
|
+
u(h) && jt(h, y);
|
|
1334
|
+
}, e * 1e3));
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
return l(x, [
|
|
1339
|
+
h,
|
|
1340
|
+
g,
|
|
1341
|
+
_
|
|
1342
|
+
], (e) => e[0] === h && e[1] === g && e[2] === _, !0) ? (S.add(C), u(m) ? e(y, m, [
|
|
1343
|
+
g,
|
|
1344
|
+
_,
|
|
1345
|
+
C
|
|
1346
|
+
], !0) : t(b, _, [
|
|
1347
|
+
m,
|
|
1348
|
+
g,
|
|
1349
|
+
C
|
|
1350
|
+
], !0), !0) : !1;
|
|
1351
|
+
};
|
|
1352
|
+
}, Nt = (e) => (t, n, [r, i, a], o) => {
|
|
1353
|
+
let s = t.get(r);
|
|
1354
|
+
s === void 0 ? t.set(r, new Set([[
|
|
1355
|
+
i,
|
|
1356
|
+
n,
|
|
1357
|
+
a
|
|
1358
|
+
]])) : e(s, [
|
|
1359
|
+
i,
|
|
1360
|
+
n,
|
|
1361
|
+
a
|
|
1362
|
+
], (e) => e[0] === i && e[1] === n, o);
|
|
1363
|
+
}, Pt = (e) => (t, n) => {
|
|
1364
|
+
let r = e(t, {
|
|
1365
|
+
channelCount: 1,
|
|
1366
|
+
channelCountMode: "explicit",
|
|
1367
|
+
channelInterpretation: "discrete",
|
|
1368
|
+
gain: 0
|
|
1369
|
+
});
|
|
1370
|
+
n.connect(r).connect(t.destination);
|
|
1371
|
+
let i = () => {
|
|
1372
|
+
n.removeEventListener("ended", i), n.disconnect(r), r.disconnect();
|
|
1373
|
+
};
|
|
1374
|
+
n.addEventListener("ended", i);
|
|
1375
|
+
}, Ft = {
|
|
1376
|
+
channelCount: 2,
|
|
1377
|
+
channelCountMode: "max",
|
|
1378
|
+
channelInterpretation: "speakers",
|
|
1379
|
+
fftSize: 2048,
|
|
1380
|
+
maxDecibels: -30,
|
|
1381
|
+
minDecibels: -100,
|
|
1382
|
+
smoothingTimeConstant: .8
|
|
1383
|
+
}, It = (e, t, n, r, i, a) => class extends e {
|
|
1384
|
+
constructor(e, n) {
|
|
1385
|
+
let o = i(e), s = r(o, {
|
|
1386
|
+
...Ft,
|
|
1387
|
+
...n
|
|
1388
|
+
}), c = a(o) ? t() : null;
|
|
1389
|
+
super(e, !1, s, c), this._nativeAnalyserNode = s;
|
|
1390
|
+
}
|
|
1391
|
+
get fftSize() {
|
|
1392
|
+
return this._nativeAnalyserNode.fftSize;
|
|
1393
|
+
}
|
|
1394
|
+
set fftSize(e) {
|
|
1395
|
+
this._nativeAnalyserNode.fftSize = e;
|
|
1396
|
+
}
|
|
1397
|
+
get frequencyBinCount() {
|
|
1398
|
+
return this._nativeAnalyserNode.frequencyBinCount;
|
|
1399
|
+
}
|
|
1400
|
+
get maxDecibels() {
|
|
1401
|
+
return this._nativeAnalyserNode.maxDecibels;
|
|
1402
|
+
}
|
|
1403
|
+
set maxDecibels(e) {
|
|
1404
|
+
let t = this._nativeAnalyserNode.maxDecibels;
|
|
1405
|
+
if (this._nativeAnalyserNode.maxDecibels = e, !(e > this._nativeAnalyserNode.minDecibels)) throw this._nativeAnalyserNode.maxDecibels = t, n();
|
|
1406
|
+
}
|
|
1407
|
+
get minDecibels() {
|
|
1408
|
+
return this._nativeAnalyserNode.minDecibels;
|
|
1409
|
+
}
|
|
1410
|
+
set minDecibels(e) {
|
|
1411
|
+
let t = this._nativeAnalyserNode.minDecibels;
|
|
1412
|
+
if (this._nativeAnalyserNode.minDecibels = e, !(this._nativeAnalyserNode.maxDecibels > e)) throw this._nativeAnalyserNode.minDecibels = t, n();
|
|
1413
|
+
}
|
|
1414
|
+
get smoothingTimeConstant() {
|
|
1415
|
+
return this._nativeAnalyserNode.smoothingTimeConstant;
|
|
1416
|
+
}
|
|
1417
|
+
set smoothingTimeConstant(e) {
|
|
1418
|
+
this._nativeAnalyserNode.smoothingTimeConstant = e;
|
|
1419
|
+
}
|
|
1420
|
+
getByteFrequencyData(e) {
|
|
1421
|
+
this._nativeAnalyserNode.getByteFrequencyData(e);
|
|
1422
|
+
}
|
|
1423
|
+
getByteTimeDomainData(e) {
|
|
1424
|
+
this._nativeAnalyserNode.getByteTimeDomainData(e);
|
|
1425
|
+
}
|
|
1426
|
+
getFloatFrequencyData(e) {
|
|
1427
|
+
this._nativeAnalyserNode.getFloatFrequencyData(e);
|
|
1428
|
+
}
|
|
1429
|
+
getFloatTimeDomainData(e) {
|
|
1430
|
+
this._nativeAnalyserNode.getFloatTimeDomainData(e);
|
|
1431
|
+
}
|
|
1432
|
+
}, F = (e, t) => e.context === t, Lt = (e, t, n) => () => {
|
|
1433
|
+
let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
|
|
1434
|
+
let o = t(i);
|
|
1435
|
+
return F(o, a) || (o = e(a, {
|
|
1436
|
+
channelCount: o.channelCount,
|
|
1437
|
+
channelCountMode: o.channelCountMode,
|
|
1438
|
+
channelInterpretation: o.channelInterpretation,
|
|
1439
|
+
fftSize: o.fftSize,
|
|
1440
|
+
maxDecibels: o.maxDecibels,
|
|
1441
|
+
minDecibels: o.minDecibels,
|
|
1442
|
+
smoothingTimeConstant: o.smoothingTimeConstant
|
|
1443
|
+
})), r.set(a, o), await n(i, a, o), o;
|
|
1444
|
+
};
|
|
1445
|
+
return { render(e, t) {
|
|
1446
|
+
let n = r.get(t);
|
|
1447
|
+
return n === void 0 ? i(e, t) : Promise.resolve(n);
|
|
1448
|
+
} };
|
|
1449
|
+
}, Rt = (e) => {
|
|
1450
|
+
try {
|
|
1451
|
+
e.copyToChannel(new Float32Array(1), 0, -1);
|
|
1452
|
+
} catch {
|
|
1453
|
+
return !1;
|
|
1454
|
+
}
|
|
1455
|
+
return !0;
|
|
1456
|
+
}, zt = () => new DOMException("", "IndexSizeError"), Bt = (e) => {
|
|
1457
|
+
e.getChannelData = ((t) => (n) => {
|
|
1458
|
+
try {
|
|
1459
|
+
return t.call(e, n);
|
|
1460
|
+
} catch (e) {
|
|
1461
|
+
throw e.code === 12 ? zt() : e;
|
|
1462
|
+
}
|
|
1463
|
+
})(e.getChannelData);
|
|
1464
|
+
}, Vt = { numberOfChannels: 1 }, Ht = (e, t, n, r, i, a, o, s) => {
|
|
1465
|
+
let c = null;
|
|
1466
|
+
return class l {
|
|
1467
|
+
constructor(l) {
|
|
1468
|
+
if (i === null) throw Error("Missing the native OfflineAudioContext constructor.");
|
|
1469
|
+
let { length: u, numberOfChannels: d, sampleRate: f } = {
|
|
1470
|
+
...Vt,
|
|
1471
|
+
...l
|
|
1472
|
+
};
|
|
1473
|
+
c === null && (c = new i(1, 1, 44100));
|
|
1474
|
+
let p = r !== null && t(a, a) ? new r({
|
|
1475
|
+
length: u,
|
|
1476
|
+
numberOfChannels: d,
|
|
1477
|
+
sampleRate: f
|
|
1478
|
+
}) : c.createBuffer(d, u, f);
|
|
1479
|
+
if (p.numberOfChannels === 0) throw n();
|
|
1480
|
+
return typeof p.copyFromChannel == "function" ? t(Rt, () => Rt(p)) || s(p) : (o(p), Bt(p)), e.add(p), p;
|
|
1481
|
+
}
|
|
1482
|
+
static [Symbol.hasInstance](t) {
|
|
1483
|
+
return typeof t == "object" && !!t && Object.getPrototypeOf(t) === l.prototype || e.has(t);
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
}, I = -34028234663852886e22, L = -I, Ut = (e) => ct.has(e), Wt = {
|
|
1487
|
+
buffer: null,
|
|
1488
|
+
channelCount: 2,
|
|
1489
|
+
channelCountMode: "max",
|
|
1490
|
+
channelInterpretation: "speakers",
|
|
1491
|
+
loop: !1,
|
|
1492
|
+
loopEnd: 0,
|
|
1493
|
+
loopStart: 0,
|
|
1494
|
+
playbackRate: 1
|
|
1495
|
+
}, Gt = (e, t, n, r, i, a, o, s) => class extends e {
|
|
1496
|
+
constructor(e, r) {
|
|
1497
|
+
let s = a(e), c = {
|
|
1498
|
+
...Wt,
|
|
1499
|
+
...r
|
|
1500
|
+
}, l = i(s, c), u = o(s), d = u ? t() : null;
|
|
1501
|
+
super(e, !1, l, d), this._audioBufferSourceNodeRenderer = d, this._isBufferNullified = !1, this._isBufferSet = c.buffer !== null, this._nativeAudioBufferSourceNode = l, this._onended = null, this._playbackRate = n(this, u, l.playbackRate, L, I);
|
|
1502
|
+
}
|
|
1503
|
+
get buffer() {
|
|
1504
|
+
return this._isBufferNullified ? null : this._nativeAudioBufferSourceNode.buffer;
|
|
1505
|
+
}
|
|
1506
|
+
set buffer(e) {
|
|
1507
|
+
if (this._nativeAudioBufferSourceNode.buffer = e, e !== null) {
|
|
1508
|
+
if (this._isBufferSet) throw r();
|
|
1509
|
+
this._isBufferSet = !0;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
get loop() {
|
|
1513
|
+
return this._nativeAudioBufferSourceNode.loop;
|
|
1514
|
+
}
|
|
1515
|
+
set loop(e) {
|
|
1516
|
+
this._nativeAudioBufferSourceNode.loop = e;
|
|
1517
|
+
}
|
|
1518
|
+
get loopEnd() {
|
|
1519
|
+
return this._nativeAudioBufferSourceNode.loopEnd;
|
|
1520
|
+
}
|
|
1521
|
+
set loopEnd(e) {
|
|
1522
|
+
this._nativeAudioBufferSourceNode.loopEnd = e;
|
|
1523
|
+
}
|
|
1524
|
+
get loopStart() {
|
|
1525
|
+
return this._nativeAudioBufferSourceNode.loopStart;
|
|
1526
|
+
}
|
|
1527
|
+
set loopStart(e) {
|
|
1528
|
+
this._nativeAudioBufferSourceNode.loopStart = e;
|
|
1529
|
+
}
|
|
1530
|
+
get onended() {
|
|
1531
|
+
return this._onended;
|
|
1532
|
+
}
|
|
1533
|
+
set onended(e) {
|
|
1534
|
+
let t = typeof e == "function" ? s(this, e) : null;
|
|
1535
|
+
this._nativeAudioBufferSourceNode.onended = t;
|
|
1536
|
+
let n = this._nativeAudioBufferSourceNode.onended;
|
|
1537
|
+
this._onended = n !== null && n === t ? e : n;
|
|
1538
|
+
}
|
|
1539
|
+
get playbackRate() {
|
|
1540
|
+
return this._playbackRate;
|
|
1541
|
+
}
|
|
1542
|
+
start(e = 0, t = 0, n) {
|
|
1543
|
+
if (this._nativeAudioBufferSourceNode.start(e, t, n), this._audioBufferSourceNodeRenderer !== null && (this._audioBufferSourceNodeRenderer.start = n === void 0 ? [e, t] : [
|
|
1544
|
+
e,
|
|
1545
|
+
t,
|
|
1546
|
+
n
|
|
1547
|
+
]), this.context.state !== "closed") {
|
|
1548
|
+
Ot(this);
|
|
1549
|
+
let e = () => {
|
|
1550
|
+
this._nativeAudioBufferSourceNode.removeEventListener("ended", e), Ut(this) && At(this);
|
|
1551
|
+
};
|
|
1552
|
+
this._nativeAudioBufferSourceNode.addEventListener("ended", e);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
stop(e = 0) {
|
|
1556
|
+
this._nativeAudioBufferSourceNode.stop(e), this._audioBufferSourceNodeRenderer !== null && (this._audioBufferSourceNodeRenderer.stop = e);
|
|
1557
|
+
}
|
|
1558
|
+
}, Kt = (e, t, n, r, i) => () => {
|
|
1559
|
+
let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = async (c, l) => {
|
|
1560
|
+
let u = n(c), d = F(u, l);
|
|
1561
|
+
return d || (u = t(l, {
|
|
1562
|
+
buffer: u.buffer,
|
|
1563
|
+
channelCount: u.channelCount,
|
|
1564
|
+
channelCountMode: u.channelCountMode,
|
|
1565
|
+
channelInterpretation: u.channelInterpretation,
|
|
1566
|
+
loop: u.loop,
|
|
1567
|
+
loopEnd: u.loopEnd,
|
|
1568
|
+
loopStart: u.loopStart,
|
|
1569
|
+
playbackRate: u.playbackRate.value
|
|
1570
|
+
}), o !== null && u.start(...o), s !== null && u.stop(s)), a.set(l, u), d ? await e(l, c.playbackRate, u.playbackRate) : await r(l, c.playbackRate, u.playbackRate), await i(c, l, u), u;
|
|
1571
|
+
};
|
|
1572
|
+
return {
|
|
1573
|
+
set start(e) {
|
|
1574
|
+
o = e;
|
|
1575
|
+
},
|
|
1576
|
+
set stop(e) {
|
|
1577
|
+
s = e;
|
|
1578
|
+
},
|
|
1579
|
+
render(e, t) {
|
|
1580
|
+
let n = a.get(t);
|
|
1581
|
+
return n === void 0 ? c(e, t) : Promise.resolve(n);
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
}, qt = (e) => "playbackRate" in e, Jt = (e) => "frequency" in e && "gain" in e, Yt = (e) => "offset" in e, Xt = (e) => !("frequency" in e) && "gain" in e, Zt = (e) => "detune" in e && "frequency" in e && !("gain" in e), Qt = (e) => "pan" in e, R = (e) => wt(lt, e), $t = (e) => wt(dt, e), en = (e, t) => {
|
|
1585
|
+
let { activeInputs: n } = R(e);
|
|
1586
|
+
n.forEach((n) => n.forEach(([n]) => {
|
|
1587
|
+
t.includes(e) || en(n, [...t, e]);
|
|
1588
|
+
}));
|
|
1589
|
+
let r = qt(e) ? [e.playbackRate] : kt(e) ? Array.from(e.parameters.values()) : Jt(e) ? [
|
|
1590
|
+
e.Q,
|
|
1591
|
+
e.detune,
|
|
1592
|
+
e.frequency,
|
|
1593
|
+
e.gain
|
|
1594
|
+
] : Yt(e) ? [e.offset] : Xt(e) ? [e.gain] : Zt(e) ? [e.detune, e.frequency] : Qt(e) ? [e.pan] : [];
|
|
1595
|
+
for (let e of r) {
|
|
1596
|
+
let n = $t(e);
|
|
1597
|
+
n !== void 0 && n.activeInputs.forEach(([e]) => en(e, t));
|
|
1598
|
+
}
|
|
1599
|
+
Ut(e) && At(e);
|
|
1600
|
+
}, tn = (e) => {
|
|
1601
|
+
en(e.destination, []);
|
|
1602
|
+
}, nn = (e) => e === void 0 || typeof e == "number" || typeof e == "string" && (e === "balanced" || e === "interactive" || e === "playback"), rn = (e, t, n, r, i, a, o, s, c) => class extends e {
|
|
1603
|
+
constructor(e = {}) {
|
|
1604
|
+
if (c === null) throw Error("Missing the native AudioContext constructor.");
|
|
1605
|
+
let t;
|
|
1606
|
+
try {
|
|
1607
|
+
t = new c(e);
|
|
1608
|
+
} catch (e) {
|
|
1609
|
+
throw e.code === 12 && e.message === "sampleRate is not in range" ? n() : e;
|
|
1610
|
+
}
|
|
1611
|
+
if (t === null) throw r();
|
|
1612
|
+
if (!nn(e.latencyHint)) throw TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);
|
|
1613
|
+
if (e.sampleRate !== void 0 && t.sampleRate !== e.sampleRate) throw n();
|
|
1614
|
+
super(t, 2);
|
|
1615
|
+
let { latencyHint: i } = e, { sampleRate: a } = t;
|
|
1616
|
+
if (this._baseLatency = typeof t.baseLatency == "number" ? t.baseLatency : i === "balanced" ? 512 / a : i === "interactive" || i === void 0 ? 256 / a : i === "playback" ? 1024 / a : Math.max(2, Math.min(128, Math.round(i * a / 128))) * 128 / a, this._nativeAudioContext = t, c.name === "webkitAudioContext" ? (this._nativeGainNode = t.createGain(), this._nativeOscillatorNode = t.createOscillator(), this._nativeGainNode.gain.value = 1e-37, this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination), this._nativeOscillatorNode.start()) : (this._nativeGainNode = null, this._nativeOscillatorNode = null), this._state = null, t.state === "running") {
|
|
1617
|
+
this._state = "suspended";
|
|
1618
|
+
let e = () => {
|
|
1619
|
+
this._state === "suspended" && (this._state = null), t.removeEventListener("statechange", e);
|
|
1620
|
+
};
|
|
1621
|
+
t.addEventListener("statechange", e);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
get baseLatency() {
|
|
1625
|
+
return this._baseLatency;
|
|
1626
|
+
}
|
|
1627
|
+
get state() {
|
|
1628
|
+
return this._state === null ? this._nativeAudioContext.state : this._state;
|
|
1629
|
+
}
|
|
1630
|
+
close() {
|
|
1631
|
+
return this.state === "closed" ? this._nativeAudioContext.close().then(() => {
|
|
1632
|
+
throw t();
|
|
1633
|
+
}) : (this._state === "suspended" && (this._state = null), this._nativeAudioContext.close().then(() => {
|
|
1634
|
+
this._nativeGainNode !== null && this._nativeOscillatorNode !== null && (this._nativeOscillatorNode.stop(), this._nativeGainNode.disconnect(), this._nativeOscillatorNode.disconnect()), tn(this);
|
|
1635
|
+
}));
|
|
1636
|
+
}
|
|
1637
|
+
createMediaElementSource(e) {
|
|
1638
|
+
return new i(this, { mediaElement: e });
|
|
1639
|
+
}
|
|
1640
|
+
createMediaStreamDestination() {
|
|
1641
|
+
return new a(this);
|
|
1642
|
+
}
|
|
1643
|
+
createMediaStreamSource(e) {
|
|
1644
|
+
return new o(this, { mediaStream: e });
|
|
1645
|
+
}
|
|
1646
|
+
createMediaStreamTrackSource(e) {
|
|
1647
|
+
return new s(this, { mediaStreamTrack: e });
|
|
1648
|
+
}
|
|
1649
|
+
resume() {
|
|
1650
|
+
return this._state === "suspended" ? new Promise((e, t) => {
|
|
1651
|
+
let n = () => {
|
|
1652
|
+
this._nativeAudioContext.removeEventListener("statechange", n), this._nativeAudioContext.state === "running" ? e() : this.resume().then(e, t);
|
|
1653
|
+
};
|
|
1654
|
+
this._nativeAudioContext.addEventListener("statechange", n);
|
|
1655
|
+
}) : this._nativeAudioContext.resume().catch((e) => {
|
|
1656
|
+
throw e === void 0 || e.code === 15 ? t() : e;
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
suspend() {
|
|
1660
|
+
return this._nativeAudioContext.suspend().catch((e) => {
|
|
1661
|
+
throw e === void 0 ? t() : e;
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
}, an = (e, t, n, r, i, a, o, s) => class extends e {
|
|
1665
|
+
constructor(e, n) {
|
|
1666
|
+
let r = a(e), c = o(r), l = i(r, n, c), u = c ? t(s) : null;
|
|
1667
|
+
super(e, !1, l, u), this._isNodeOfNativeOfflineAudioContext = c, this._nativeAudioDestinationNode = l;
|
|
1668
|
+
}
|
|
1669
|
+
get channelCount() {
|
|
1670
|
+
return this._nativeAudioDestinationNode.channelCount;
|
|
1671
|
+
}
|
|
1672
|
+
set channelCount(e) {
|
|
1673
|
+
if (this._isNodeOfNativeOfflineAudioContext) throw r();
|
|
1674
|
+
if (e > this._nativeAudioDestinationNode.maxChannelCount) throw n();
|
|
1675
|
+
this._nativeAudioDestinationNode.channelCount = e;
|
|
1676
|
+
}
|
|
1677
|
+
get channelCountMode() {
|
|
1678
|
+
return this._nativeAudioDestinationNode.channelCountMode;
|
|
1679
|
+
}
|
|
1680
|
+
set channelCountMode(e) {
|
|
1681
|
+
if (this._isNodeOfNativeOfflineAudioContext) throw r();
|
|
1682
|
+
this._nativeAudioDestinationNode.channelCountMode = e;
|
|
1683
|
+
}
|
|
1684
|
+
get maxChannelCount() {
|
|
1685
|
+
return this._nativeAudioDestinationNode.maxChannelCount;
|
|
1686
|
+
}
|
|
1687
|
+
}, on = (e) => {
|
|
1688
|
+
let t = /* @__PURE__ */ new WeakMap(), n = async (n, r) => {
|
|
1689
|
+
let i = r.destination;
|
|
1690
|
+
return t.set(r, i), await e(n, r, i), i;
|
|
1691
|
+
};
|
|
1692
|
+
return { render(e, r) {
|
|
1693
|
+
let i = t.get(r);
|
|
1694
|
+
return i === void 0 ? n(e, r) : Promise.resolve(i);
|
|
1695
|
+
} };
|
|
1696
|
+
}, sn = (e, t, n, r, i, a, o, s) => (c, l) => {
|
|
1697
|
+
let u = l.listener, { forwardX: d, forwardY: f, forwardZ: p, positionX: m, positionY: h, positionZ: g, upX: _, upY: v, upZ: y } = u.forwardX === void 0 ? (() => {
|
|
1698
|
+
let d = new Float32Array(1), f = t(l, {
|
|
1699
|
+
channelCount: 1,
|
|
1700
|
+
channelCountMode: "explicit",
|
|
1701
|
+
channelInterpretation: "speakers",
|
|
1702
|
+
numberOfInputs: 9
|
|
1703
|
+
}), p = o(l), m = !1, h = [
|
|
1704
|
+
0,
|
|
1705
|
+
0,
|
|
1706
|
+
-1,
|
|
1707
|
+
0,
|
|
1708
|
+
1,
|
|
1709
|
+
0
|
|
1710
|
+
], g = [
|
|
1711
|
+
0,
|
|
1712
|
+
0,
|
|
1713
|
+
0
|
|
1714
|
+
], _ = () => {
|
|
1715
|
+
if (m) return;
|
|
1716
|
+
m = !0;
|
|
1717
|
+
let e = r(l, 256, 9, 0);
|
|
1718
|
+
e.onaudioprocess = ({ inputBuffer: e }) => {
|
|
1719
|
+
let t = [
|
|
1720
|
+
a(e, d, 0),
|
|
1721
|
+
a(e, d, 1),
|
|
1722
|
+
a(e, d, 2),
|
|
1723
|
+
a(e, d, 3),
|
|
1724
|
+
a(e, d, 4),
|
|
1725
|
+
a(e, d, 5)
|
|
1726
|
+
];
|
|
1727
|
+
t.some((e, t) => e !== h[t]) && (u.setOrientation(...t), h = t);
|
|
1728
|
+
let n = [
|
|
1729
|
+
a(e, d, 6),
|
|
1730
|
+
a(e, d, 7),
|
|
1731
|
+
a(e, d, 8)
|
|
1732
|
+
];
|
|
1733
|
+
n.some((e, t) => e !== g[t]) && (u.setPosition(...n), g = n);
|
|
1734
|
+
}, f.connect(e);
|
|
1735
|
+
}, v = (e) => (t) => {
|
|
1736
|
+
t !== h[e] && (h[e] = t, u.setOrientation(...h));
|
|
1737
|
+
}, y = (e) => (t) => {
|
|
1738
|
+
t !== g[e] && (g[e] = t, u.setPosition(...g));
|
|
1739
|
+
}, b = (t, r, a) => {
|
|
1740
|
+
let o = n(l, {
|
|
1741
|
+
channelCount: 1,
|
|
1742
|
+
channelCountMode: "explicit",
|
|
1743
|
+
channelInterpretation: "discrete",
|
|
1744
|
+
offset: r
|
|
1745
|
+
});
|
|
1746
|
+
o.connect(f, 0, t), o.start(), Object.defineProperty(o.offset, "defaultValue", { get() {
|
|
1747
|
+
return r;
|
|
1748
|
+
} });
|
|
1749
|
+
let u = e({ context: c }, p, o.offset, L, I);
|
|
1750
|
+
return s(u, "value", (e) => () => e.call(u), (e) => (t) => {
|
|
1751
|
+
try {
|
|
1752
|
+
e.call(u, t);
|
|
1753
|
+
} catch (e) {
|
|
1754
|
+
if (e.code !== 9) throw e;
|
|
1755
|
+
}
|
|
1756
|
+
_(), p && a(t);
|
|
1757
|
+
}), u.cancelAndHoldAtTime = ((e) => p ? () => {
|
|
1758
|
+
throw i();
|
|
1759
|
+
} : (...t) => {
|
|
1760
|
+
let n = e.apply(u, t);
|
|
1761
|
+
return _(), n;
|
|
1762
|
+
})(u.cancelAndHoldAtTime), u.cancelScheduledValues = ((e) => p ? () => {
|
|
1763
|
+
throw i();
|
|
1764
|
+
} : (...t) => {
|
|
1765
|
+
let n = e.apply(u, t);
|
|
1766
|
+
return _(), n;
|
|
1767
|
+
})(u.cancelScheduledValues), u.exponentialRampToValueAtTime = ((e) => p ? () => {
|
|
1768
|
+
throw i();
|
|
1769
|
+
} : (...t) => {
|
|
1770
|
+
let n = e.apply(u, t);
|
|
1771
|
+
return _(), n;
|
|
1772
|
+
})(u.exponentialRampToValueAtTime), u.linearRampToValueAtTime = ((e) => p ? () => {
|
|
1773
|
+
throw i();
|
|
1774
|
+
} : (...t) => {
|
|
1775
|
+
let n = e.apply(u, t);
|
|
1776
|
+
return _(), n;
|
|
1777
|
+
})(u.linearRampToValueAtTime), u.setTargetAtTime = ((e) => p ? () => {
|
|
1778
|
+
throw i();
|
|
1779
|
+
} : (...t) => {
|
|
1780
|
+
let n = e.apply(u, t);
|
|
1781
|
+
return _(), n;
|
|
1782
|
+
})(u.setTargetAtTime), u.setValueAtTime = ((e) => p ? () => {
|
|
1783
|
+
throw i();
|
|
1784
|
+
} : (...t) => {
|
|
1785
|
+
let n = e.apply(u, t);
|
|
1786
|
+
return _(), n;
|
|
1787
|
+
})(u.setValueAtTime), u.setValueCurveAtTime = ((e) => p ? () => {
|
|
1788
|
+
throw i();
|
|
1789
|
+
} : (...t) => {
|
|
1790
|
+
let n = e.apply(u, t);
|
|
1791
|
+
return _(), n;
|
|
1792
|
+
})(u.setValueCurveAtTime), u;
|
|
1793
|
+
};
|
|
1794
|
+
return {
|
|
1795
|
+
forwardX: b(0, 0, v(0)),
|
|
1796
|
+
forwardY: b(1, 0, v(1)),
|
|
1797
|
+
forwardZ: b(2, -1, v(2)),
|
|
1798
|
+
positionX: b(6, 0, y(0)),
|
|
1799
|
+
positionY: b(7, 0, y(1)),
|
|
1800
|
+
positionZ: b(8, 0, y(2)),
|
|
1801
|
+
upX: b(3, 0, v(3)),
|
|
1802
|
+
upY: b(4, 1, v(4)),
|
|
1803
|
+
upZ: b(5, 0, v(5))
|
|
1804
|
+
};
|
|
1805
|
+
})() : u;
|
|
1806
|
+
return {
|
|
1807
|
+
get forwardX() {
|
|
1808
|
+
return d;
|
|
1809
|
+
},
|
|
1810
|
+
get forwardY() {
|
|
1811
|
+
return f;
|
|
1812
|
+
},
|
|
1813
|
+
get forwardZ() {
|
|
1814
|
+
return p;
|
|
1815
|
+
},
|
|
1816
|
+
get positionX() {
|
|
1817
|
+
return m;
|
|
1818
|
+
},
|
|
1819
|
+
get positionY() {
|
|
1820
|
+
return h;
|
|
1821
|
+
},
|
|
1822
|
+
get positionZ() {
|
|
1823
|
+
return g;
|
|
1824
|
+
},
|
|
1825
|
+
get upX() {
|
|
1826
|
+
return _;
|
|
1827
|
+
},
|
|
1828
|
+
get upY() {
|
|
1829
|
+
return v;
|
|
1830
|
+
},
|
|
1831
|
+
get upZ() {
|
|
1832
|
+
return y;
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
}, cn = (e) => "context" in e, ln = (e) => cn(e[0]), un = (e, t, n, r) => {
|
|
1836
|
+
for (let t of e) if (n(t)) {
|
|
1837
|
+
if (r) return !1;
|
|
1838
|
+
throw Error("The set contains at least one similar element.");
|
|
1839
|
+
}
|
|
1840
|
+
return e.add(t), !0;
|
|
1841
|
+
}, dn = (e, t, [n, r], i) => {
|
|
1842
|
+
un(e, [
|
|
1843
|
+
t,
|
|
1844
|
+
n,
|
|
1845
|
+
r
|
|
1846
|
+
], (e) => e[0] === t && e[1] === n, i);
|
|
1847
|
+
}, fn = (e, [t, n, r], i) => {
|
|
1848
|
+
let a = e.get(t);
|
|
1849
|
+
a === void 0 ? e.set(t, new Set([[n, r]])) : un(a, [n, r], (e) => e[0] === n, i);
|
|
1850
|
+
}, pn = (e) => "inputs" in e, mn = (e, t, n, r) => {
|
|
1851
|
+
if (pn(t)) {
|
|
1852
|
+
let i = t.inputs[r];
|
|
1853
|
+
return e.connect(i, n, 0), [
|
|
1854
|
+
i,
|
|
1855
|
+
n,
|
|
1856
|
+
0
|
|
1857
|
+
];
|
|
1858
|
+
}
|
|
1859
|
+
return e.connect(t, n, r), [
|
|
1860
|
+
t,
|
|
1861
|
+
n,
|
|
1862
|
+
r
|
|
1863
|
+
];
|
|
1864
|
+
}, hn = (e, t, n) => {
|
|
1865
|
+
for (let r of e) if (r[0] === t && r[1] === n) return e.delete(r), r;
|
|
1866
|
+
return null;
|
|
1867
|
+
}, gn = (e, t, n) => Tt(e, (e) => e[0] === t && e[1] === n), _n = (e, t) => {
|
|
1868
|
+
if (!Dt(e).delete(t)) throw Error("Missing the expected event listener.");
|
|
1869
|
+
}, vn = (e, t, n) => {
|
|
1870
|
+
let r = wt(e, t), i = Tt(r, (e) => e[0] === n);
|
|
1871
|
+
return r.size === 0 && e.delete(t), i;
|
|
1872
|
+
}, yn = (e, t, n, r) => {
|
|
1873
|
+
pn(t) ? e.disconnect(t.inputs[r], n, 0) : e.disconnect(t, n, r);
|
|
1874
|
+
}, z = (e) => wt(ut, e), bn = (e) => wt(ft, e), xn = (e) => ht.has(e), Sn = (e) => !ct.has(e), Cn = (e, t) => new Promise((n) => {
|
|
1875
|
+
if (t !== null) n(!0);
|
|
1876
|
+
else {
|
|
1877
|
+
let t = e.createScriptProcessor(256, 1, 1), r = e.createGain(), i = e.createBuffer(1, 2, 44100), a = i.getChannelData(0);
|
|
1878
|
+
a[0] = 1, a[1] = 1;
|
|
1879
|
+
let o = e.createBufferSource();
|
|
1880
|
+
o.buffer = i, o.loop = !0, o.connect(t).connect(e.destination), o.connect(r), o.disconnect(r), t.onaudioprocess = (r) => {
|
|
1881
|
+
let i = r.inputBuffer.getChannelData(0);
|
|
1882
|
+
Array.prototype.some.call(i, (e) => e === 1) ? n(!0) : n(!1), o.stop(), t.onaudioprocess = null, o.disconnect(t), t.disconnect(e.destination);
|
|
1883
|
+
}, o.start();
|
|
1884
|
+
}
|
|
1885
|
+
}), wn = (e, t) => {
|
|
1886
|
+
let n = /* @__PURE__ */ new Map();
|
|
1887
|
+
for (let t of e) for (let e of t) {
|
|
1888
|
+
let t = n.get(e);
|
|
1889
|
+
n.set(e, t === void 0 ? 1 : t + 1);
|
|
1890
|
+
}
|
|
1891
|
+
n.forEach((e, n) => t(n, e));
|
|
1892
|
+
}, Tn = (e) => "context" in e, En = (e) => {
|
|
1893
|
+
let t = /* @__PURE__ */ new Map();
|
|
1894
|
+
e.connect = ((e) => (n, r = 0, i = 0) => {
|
|
1895
|
+
let a = Tn(n) ? e(n, r, i) : e(n, r), o = t.get(n);
|
|
1896
|
+
return o === void 0 ? t.set(n, [{
|
|
1897
|
+
input: i,
|
|
1898
|
+
output: r
|
|
1899
|
+
}]) : o.every((e) => e.input !== i || e.output !== r) && o.push({
|
|
1900
|
+
input: i,
|
|
1901
|
+
output: r
|
|
1902
|
+
}), a;
|
|
1903
|
+
})(e.connect.bind(e)), e.disconnect = ((n) => (r, i, a) => {
|
|
1904
|
+
if (n.apply(e), r === void 0) t.clear();
|
|
1905
|
+
else if (typeof r == "number") for (let [e, n] of t) {
|
|
1906
|
+
let i = n.filter((e) => e.output !== r);
|
|
1907
|
+
i.length === 0 ? t.delete(e) : t.set(e, i);
|
|
1908
|
+
}
|
|
1909
|
+
else if (t.has(r)) if (i === void 0) t.delete(r);
|
|
1910
|
+
else {
|
|
1911
|
+
let e = t.get(r);
|
|
1912
|
+
if (e !== void 0) {
|
|
1913
|
+
let n = e.filter((e) => e.output !== i && (e.input !== a || a === void 0));
|
|
1914
|
+
n.length === 0 ? t.delete(r) : t.set(r, n);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
for (let [n, r] of t) r.forEach((t) => {
|
|
1918
|
+
Tn(n) ? e.connect(n, t.output, t.input) : e.connect(n, t.output);
|
|
1919
|
+
});
|
|
1920
|
+
})(e.disconnect);
|
|
1921
|
+
}, Dn = (e, t, n, r) => {
|
|
1922
|
+
let { activeInputs: i, passiveInputs: a } = $t(t), { outputs: o } = R(e), s = Dt(e), c = (o) => {
|
|
1923
|
+
let s = z(e), c = bn(t);
|
|
1924
|
+
o ? (dn(i, e, vn(a, e, n), !1), !r && !xn(e) && s.connect(c, n)) : (fn(a, gn(i, e, n), !1), !r && !xn(e) && s.disconnect(c, n));
|
|
1925
|
+
};
|
|
1926
|
+
return un(o, [t, n], (e) => e[0] === t && e[1] === n, !0) ? (s.add(c), Ut(e) ? dn(i, e, [n, c], !0) : fn(a, [
|
|
1927
|
+
e,
|
|
1928
|
+
n,
|
|
1929
|
+
c
|
|
1930
|
+
], !0), !0) : !1;
|
|
1931
|
+
}, On = (e, t, n, r) => {
|
|
1932
|
+
let { activeInputs: i, passiveInputs: a } = R(t), o = hn(i[r], e, n);
|
|
1933
|
+
return o === null ? [Et(a, e, n, r)[2], !1] : [o[2], !0];
|
|
1934
|
+
}, kn = (e, t, n) => {
|
|
1935
|
+
let { activeInputs: r, passiveInputs: i } = $t(t), a = hn(r, e, n);
|
|
1936
|
+
return a === null ? [vn(i, e, n)[1], !1] : [a[2], !0];
|
|
1937
|
+
}, An = (e, t, n, r, i) => {
|
|
1938
|
+
let [a, o] = On(e, n, r, i);
|
|
1939
|
+
if (a !== null && (_n(e, a), o && !t && !xn(e) && yn(z(e), z(n), r, i)), Ut(n)) {
|
|
1940
|
+
let { activeInputs: e } = R(n);
|
|
1941
|
+
jt(n, e);
|
|
1942
|
+
}
|
|
1943
|
+
}, jn = (e, t, n, r) => {
|
|
1944
|
+
let [i, a] = kn(e, n, r);
|
|
1945
|
+
i !== null && (_n(e, i), a && !t && !xn(e) && z(e).disconnect(bn(n), r));
|
|
1946
|
+
}, Mn = (e, t) => {
|
|
1947
|
+
let n = R(e), r = [];
|
|
1948
|
+
for (let i of n.outputs) ln(i) ? An(e, t, ...i) : jn(e, t, ...i), r.push(i[0]);
|
|
1949
|
+
return n.outputs.clear(), r;
|
|
1950
|
+
}, Nn = (e, t, n) => {
|
|
1951
|
+
let r = R(e), i = [];
|
|
1952
|
+
for (let a of r.outputs) a[1] === n && (ln(a) ? An(e, t, ...a) : jn(e, t, ...a), i.push(a[0]), r.outputs.delete(a));
|
|
1953
|
+
return i;
|
|
1954
|
+
}, Pn = (e, t, n, r, i) => {
|
|
1955
|
+
let a = R(e);
|
|
1956
|
+
return Array.from(a.outputs).filter((e) => e[0] === n && (r === void 0 || e[1] === r) && (i === void 0 || e[2] === i)).map((n) => (ln(n) ? An(e, t, ...n) : jn(e, t, ...n), a.outputs.delete(n), n[0]));
|
|
1957
|
+
}, Fn = (e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) => class extends l {
|
|
1958
|
+
constructor(t, r, i, a) {
|
|
1959
|
+
super(i), this._context = t, this._nativeAudioNode = i;
|
|
1960
|
+
let o = u(t);
|
|
1961
|
+
d(o) && !0 !== n(Cn, () => Cn(o, h)) && En(i), ut.set(this, i), mt.set(this, /* @__PURE__ */ new Set()), t.state !== "closed" && r && Ot(this), e(this, a, i);
|
|
1962
|
+
}
|
|
1963
|
+
get channelCount() {
|
|
1964
|
+
return this._nativeAudioNode.channelCount;
|
|
1965
|
+
}
|
|
1966
|
+
set channelCount(e) {
|
|
1967
|
+
this._nativeAudioNode.channelCount = e;
|
|
1968
|
+
}
|
|
1969
|
+
get channelCountMode() {
|
|
1970
|
+
return this._nativeAudioNode.channelCountMode;
|
|
1971
|
+
}
|
|
1972
|
+
set channelCountMode(e) {
|
|
1973
|
+
this._nativeAudioNode.channelCountMode = e;
|
|
1974
|
+
}
|
|
1975
|
+
get channelInterpretation() {
|
|
1976
|
+
return this._nativeAudioNode.channelInterpretation;
|
|
1977
|
+
}
|
|
1978
|
+
set channelInterpretation(e) {
|
|
1979
|
+
this._nativeAudioNode.channelInterpretation = e;
|
|
1980
|
+
}
|
|
1981
|
+
get context() {
|
|
1982
|
+
return this._context;
|
|
1983
|
+
}
|
|
1984
|
+
get numberOfInputs() {
|
|
1985
|
+
return this._nativeAudioNode.numberOfInputs;
|
|
1986
|
+
}
|
|
1987
|
+
get numberOfOutputs() {
|
|
1988
|
+
return this._nativeAudioNode.numberOfOutputs;
|
|
1989
|
+
}
|
|
1990
|
+
connect(e, n = 0, s = 0) {
|
|
1991
|
+
if (n < 0 || n >= this._nativeAudioNode.numberOfOutputs) throw i();
|
|
1992
|
+
let l = m(u(this._context));
|
|
1993
|
+
if (f(e) || p(e)) throw a();
|
|
1994
|
+
if (cn(e)) {
|
|
1995
|
+
let i = z(e);
|
|
1996
|
+
try {
|
|
1997
|
+
let t = mn(this._nativeAudioNode, i, n, s), r = Sn(this);
|
|
1998
|
+
(l || r) && this._nativeAudioNode.disconnect(...t), this.context.state !== "closed" && !r && Sn(e) && Ot(e);
|
|
1999
|
+
} catch (e) {
|
|
2000
|
+
throw e.code === 12 ? a() : e;
|
|
2001
|
+
}
|
|
2002
|
+
return t(this, e, n, s, l) && wn(c([this], e), r(l)), e;
|
|
2003
|
+
}
|
|
2004
|
+
let d = bn(e);
|
|
2005
|
+
if (d.name === "playbackRate" && d.maxValue === 1024) throw o();
|
|
2006
|
+
try {
|
|
2007
|
+
this._nativeAudioNode.connect(d, n), (l || Sn(this)) && this._nativeAudioNode.disconnect(d, n);
|
|
2008
|
+
} catch (e) {
|
|
2009
|
+
throw e.code === 12 ? a() : e;
|
|
2010
|
+
}
|
|
2011
|
+
Dn(this, e, n, l) && wn(c([this], e), r(l));
|
|
2012
|
+
}
|
|
2013
|
+
disconnect(e, t, n) {
|
|
2014
|
+
let r, o = m(u(this._context));
|
|
2015
|
+
if (e === void 0) r = Mn(this, o);
|
|
2016
|
+
else if (typeof e == "number") {
|
|
2017
|
+
if (e < 0 || e >= this.numberOfOutputs) throw i();
|
|
2018
|
+
r = Nn(this, o, e);
|
|
2019
|
+
} else {
|
|
2020
|
+
if (t !== void 0 && (t < 0 || t >= this.numberOfOutputs) || cn(e) && n !== void 0 && (n < 0 || n >= e.numberOfInputs)) throw i();
|
|
2021
|
+
if (r = Pn(this, o, e, t, n), r.length === 0) throw a();
|
|
2022
|
+
}
|
|
2023
|
+
for (let e of r) wn(c([this], e), s);
|
|
2024
|
+
}
|
|
2025
|
+
}, In = (e, t, n, r, i, a, o, s, c, l, u, d, f) => (p, m, h, g = null, _ = null) => {
|
|
2026
|
+
let v = h.value, y = new rt.AutomationEventList(v), b = m ? r(y) : null, x = {
|
|
2027
|
+
get defaultValue() {
|
|
2028
|
+
return v;
|
|
2029
|
+
},
|
|
2030
|
+
get maxValue() {
|
|
2031
|
+
return g === null ? h.maxValue : g;
|
|
2032
|
+
},
|
|
2033
|
+
get minValue() {
|
|
2034
|
+
return _ === null ? h.minValue : _;
|
|
2035
|
+
},
|
|
2036
|
+
get value() {
|
|
2037
|
+
return h.value;
|
|
2038
|
+
},
|
|
2039
|
+
set value(e) {
|
|
2040
|
+
h.value = e, x.setValueAtTime(e, p.context.currentTime);
|
|
2041
|
+
},
|
|
2042
|
+
cancelAndHoldAtTime(e) {
|
|
2043
|
+
if (typeof h.cancelAndHoldAtTime == "function") b === null && y.flush(p.context.currentTime), y.add(i(e)), h.cancelAndHoldAtTime(e);
|
|
2044
|
+
else {
|
|
2045
|
+
let t = Array.from(y).pop();
|
|
2046
|
+
b === null && y.flush(p.context.currentTime), y.add(i(e));
|
|
2047
|
+
let n = Array.from(y).pop();
|
|
2048
|
+
h.cancelScheduledValues(e), t !== n && n !== void 0 && (n.type === "exponentialRampToValue" ? h.exponentialRampToValueAtTime(n.value, n.endTime) : n.type === "linearRampToValue" ? h.linearRampToValueAtTime(n.value, n.endTime) : n.type === "setValue" ? h.setValueAtTime(n.value, n.startTime) : n.type === "setValueCurve" && h.setValueCurveAtTime(n.values, n.startTime, n.duration));
|
|
2049
|
+
}
|
|
2050
|
+
return x;
|
|
2051
|
+
},
|
|
2052
|
+
cancelScheduledValues(e) {
|
|
2053
|
+
return b === null && y.flush(p.context.currentTime), y.add(a(e)), h.cancelScheduledValues(e), x;
|
|
2054
|
+
},
|
|
2055
|
+
exponentialRampToValueAtTime(e, t) {
|
|
2056
|
+
if (e === 0 || !Number.isFinite(t) || t < 0) throw RangeError();
|
|
2057
|
+
let n = p.context.currentTime;
|
|
2058
|
+
return b === null && y.flush(n), Array.from(y).length === 0 && (y.add(l(v, n)), h.setValueAtTime(v, n)), y.add(o(e, t)), h.exponentialRampToValueAtTime(e, t), x;
|
|
2059
|
+
},
|
|
2060
|
+
linearRampToValueAtTime(e, t) {
|
|
2061
|
+
let n = p.context.currentTime;
|
|
2062
|
+
return b === null && y.flush(n), Array.from(y).length === 0 && (y.add(l(v, n)), h.setValueAtTime(v, n)), y.add(s(e, t)), h.linearRampToValueAtTime(e, t), x;
|
|
2063
|
+
},
|
|
2064
|
+
setTargetAtTime(e, t, n) {
|
|
2065
|
+
return b === null && y.flush(p.context.currentTime), y.add(c(e, t, n)), h.setTargetAtTime(e, t, n), x;
|
|
2066
|
+
},
|
|
2067
|
+
setValueAtTime(e, t) {
|
|
2068
|
+
return b === null && y.flush(p.context.currentTime), y.add(l(e, t)), h.setValueAtTime(e, t), x;
|
|
2069
|
+
},
|
|
2070
|
+
setValueCurveAtTime(e, t, n) {
|
|
2071
|
+
let r = e instanceof Float32Array ? e : new Float32Array(e);
|
|
2072
|
+
if (d !== null && d.name === "webkitAudioContext") {
|
|
2073
|
+
let e = t + n, i = p.context.sampleRate, a = Math.ceil(t * i), o = Math.floor(e * i), s = o - a, c = new Float32Array(s);
|
|
2074
|
+
for (let e = 0; e < s; e += 1) {
|
|
2075
|
+
let o = (r.length - 1) / n * ((a + e) / i - t), s = Math.floor(o), l = Math.ceil(o);
|
|
2076
|
+
c[e] = s === l ? r[s] : (1 - (o - s)) * r[s] + (1 - (l - o)) * r[l];
|
|
2077
|
+
}
|
|
2078
|
+
b === null && y.flush(p.context.currentTime), y.add(u(c, t, n)), h.setValueCurveAtTime(c, t, n);
|
|
2079
|
+
let l = o / i;
|
|
2080
|
+
l < e && f(x, c[c.length - 1], l), f(x, r[r.length - 1], e);
|
|
2081
|
+
} else b === null && y.flush(p.context.currentTime), y.add(u(r, t, n)), h.setValueCurveAtTime(r, t, n);
|
|
2082
|
+
return x;
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
return n.set(x, h), t.set(x, p), e(x, b), x;
|
|
2086
|
+
}, Ln = (e) => ({ replay(t) {
|
|
2087
|
+
for (let n of e) if (n.type === "exponentialRampToValue") {
|
|
2088
|
+
let { endTime: e, value: r } = n;
|
|
2089
|
+
t.exponentialRampToValueAtTime(r, e);
|
|
2090
|
+
} else if (n.type === "linearRampToValue") {
|
|
2091
|
+
let { endTime: e, value: r } = n;
|
|
2092
|
+
t.linearRampToValueAtTime(r, e);
|
|
2093
|
+
} else if (n.type === "setTarget") {
|
|
2094
|
+
let { startTime: e, target: r, timeConstant: i } = n;
|
|
2095
|
+
t.setTargetAtTime(r, e, i);
|
|
2096
|
+
} else if (n.type === "setValue") {
|
|
2097
|
+
let { startTime: e, value: r } = n;
|
|
2098
|
+
t.setValueAtTime(r, e);
|
|
2099
|
+
} else if (n.type === "setValueCurve") {
|
|
2100
|
+
let { duration: e, startTime: r, values: i } = n;
|
|
2101
|
+
t.setValueCurveAtTime(i, r, e);
|
|
2102
|
+
} else throw Error("Can't apply an unknown automation.");
|
|
2103
|
+
} }), Rn = (e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y) => class extends m {
|
|
2104
|
+
constructor(t, n) {
|
|
2105
|
+
super(t, n), this._nativeContext = t, this._audioWorklet = e === void 0 ? void 0 : { addModule: (t, n) => e(this, t, n) };
|
|
2106
|
+
}
|
|
2107
|
+
get audioWorklet() {
|
|
2108
|
+
return this._audioWorklet;
|
|
2109
|
+
}
|
|
2110
|
+
createAnalyser() {
|
|
2111
|
+
return new t(this);
|
|
2112
|
+
}
|
|
2113
|
+
createBiquadFilter() {
|
|
2114
|
+
return new i(this);
|
|
2115
|
+
}
|
|
2116
|
+
createBuffer(e, t, r) {
|
|
2117
|
+
return new n({
|
|
2118
|
+
length: t,
|
|
2119
|
+
numberOfChannels: e,
|
|
2120
|
+
sampleRate: r
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
createBufferSource() {
|
|
2124
|
+
return new r(this);
|
|
2125
|
+
}
|
|
2126
|
+
createChannelMerger(e = 6) {
|
|
2127
|
+
return new a(this, { numberOfInputs: e });
|
|
2128
|
+
}
|
|
2129
|
+
createChannelSplitter(e = 6) {
|
|
2130
|
+
return new o(this, { numberOfOutputs: e });
|
|
2131
|
+
}
|
|
2132
|
+
createConstantSource() {
|
|
2133
|
+
return new s(this);
|
|
2134
|
+
}
|
|
2135
|
+
createConvolver() {
|
|
2136
|
+
return new c(this);
|
|
2137
|
+
}
|
|
2138
|
+
createDelay(e = 1) {
|
|
2139
|
+
return new u(this, { maxDelayTime: e });
|
|
2140
|
+
}
|
|
2141
|
+
createDynamicsCompressor() {
|
|
2142
|
+
return new d(this);
|
|
2143
|
+
}
|
|
2144
|
+
createGain() {
|
|
2145
|
+
return new f(this);
|
|
2146
|
+
}
|
|
2147
|
+
createIIRFilter(e, t) {
|
|
2148
|
+
return new p(this, {
|
|
2149
|
+
feedback: t,
|
|
2150
|
+
feedforward: e
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
createOscillator() {
|
|
2154
|
+
return new h(this);
|
|
2155
|
+
}
|
|
2156
|
+
createPanner() {
|
|
2157
|
+
return new g(this);
|
|
2158
|
+
}
|
|
2159
|
+
createPeriodicWave(e, t, n = { disableNormalization: !1 }) {
|
|
2160
|
+
return new _(this, {
|
|
2161
|
+
...n,
|
|
2162
|
+
imag: t,
|
|
2163
|
+
real: e
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
createStereoPanner() {
|
|
2167
|
+
return new v(this);
|
|
2168
|
+
}
|
|
2169
|
+
createWaveShaper() {
|
|
2170
|
+
return new y(this);
|
|
2171
|
+
}
|
|
2172
|
+
decodeAudioData(e, t, n) {
|
|
2173
|
+
return l(this._nativeContext, e).then((e) => (typeof t == "function" && t(e), e), (e) => {
|
|
2174
|
+
throw typeof n == "function" && n(e), e;
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
}, zn = {
|
|
2178
|
+
Q: 1,
|
|
2179
|
+
channelCount: 2,
|
|
2180
|
+
channelCountMode: "max",
|
|
2181
|
+
channelInterpretation: "speakers",
|
|
2182
|
+
detune: 0,
|
|
2183
|
+
frequency: 350,
|
|
2184
|
+
gain: 0,
|
|
2185
|
+
type: "lowpass"
|
|
2186
|
+
}, Bn = (e, t, n, r, i, a, o, s) => class extends e {
|
|
2187
|
+
constructor(e, r) {
|
|
2188
|
+
let c = a(e), l = i(c, {
|
|
2189
|
+
...zn,
|
|
2190
|
+
...r
|
|
2191
|
+
}), u = o(c), d = u ? n() : null;
|
|
2192
|
+
super(e, !1, l, d), this._Q = t(this, u, l.Q, L, I), this._detune = t(this, u, l.detune, 1200 * Math.log2(L), -1200 * Math.log2(L)), this._frequency = t(this, u, l.frequency, e.sampleRate / 2, 0), this._gain = t(this, u, l.gain, 40 * Math.log10(L), I), this._nativeBiquadFilterNode = l, s(this, 1);
|
|
2193
|
+
}
|
|
2194
|
+
get detune() {
|
|
2195
|
+
return this._detune;
|
|
2196
|
+
}
|
|
2197
|
+
get frequency() {
|
|
2198
|
+
return this._frequency;
|
|
2199
|
+
}
|
|
2200
|
+
get gain() {
|
|
2201
|
+
return this._gain;
|
|
2202
|
+
}
|
|
2203
|
+
get Q() {
|
|
2204
|
+
return this._Q;
|
|
2205
|
+
}
|
|
2206
|
+
get type() {
|
|
2207
|
+
return this._nativeBiquadFilterNode.type;
|
|
2208
|
+
}
|
|
2209
|
+
set type(e) {
|
|
2210
|
+
this._nativeBiquadFilterNode.type = e;
|
|
2211
|
+
}
|
|
2212
|
+
getFrequencyResponse(e, t, n) {
|
|
2213
|
+
try {
|
|
2214
|
+
this._nativeBiquadFilterNode.getFrequencyResponse(e, t, n);
|
|
2215
|
+
} catch (e) {
|
|
2216
|
+
throw e.code === 11 ? r() : e;
|
|
2217
|
+
}
|
|
2218
|
+
if (e.length !== t.length || t.length !== n.length) throw r();
|
|
2219
|
+
}
|
|
2220
|
+
}, Vn = (e, t, n, r, i) => () => {
|
|
2221
|
+
let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
|
|
2222
|
+
let c = n(o), l = F(c, s);
|
|
2223
|
+
return l || (c = t(s, {
|
|
2224
|
+
Q: c.Q.value,
|
|
2225
|
+
channelCount: c.channelCount,
|
|
2226
|
+
channelCountMode: c.channelCountMode,
|
|
2227
|
+
channelInterpretation: c.channelInterpretation,
|
|
2228
|
+
detune: c.detune.value,
|
|
2229
|
+
frequency: c.frequency.value,
|
|
2230
|
+
gain: c.gain.value,
|
|
2231
|
+
type: c.type
|
|
2232
|
+
})), a.set(s, c), l ? (await e(s, o.Q, c.Q), await e(s, o.detune, c.detune), await e(s, o.frequency, c.frequency), await e(s, o.gain, c.gain)) : (await r(s, o.Q, c.Q), await r(s, o.detune, c.detune), await r(s, o.frequency, c.frequency), await r(s, o.gain, c.gain)), await i(o, s, c), c;
|
|
2233
|
+
};
|
|
2234
|
+
return { render(e, t) {
|
|
2235
|
+
let n = a.get(t);
|
|
2236
|
+
return n === void 0 ? o(e, t) : Promise.resolve(n);
|
|
2237
|
+
} };
|
|
2238
|
+
}, Hn = (e, t) => (n, r) => {
|
|
2239
|
+
let i = t.get(n);
|
|
2240
|
+
if (i !== void 0) return i;
|
|
2241
|
+
let a = e.get(n);
|
|
2242
|
+
if (a !== void 0) return a;
|
|
2243
|
+
try {
|
|
2244
|
+
let i = r();
|
|
2245
|
+
return i instanceof Promise ? (e.set(n, i), i.catch(() => !1).then((r) => (e.delete(n), t.set(n, r), r))) : (t.set(n, i), i);
|
|
2246
|
+
} catch {
|
|
2247
|
+
return t.set(n, !1), !1;
|
|
2248
|
+
}
|
|
2249
|
+
}, Un = {
|
|
2250
|
+
channelCount: 1,
|
|
2251
|
+
channelCountMode: "explicit",
|
|
2252
|
+
channelInterpretation: "speakers",
|
|
2253
|
+
numberOfInputs: 6
|
|
2254
|
+
}, Wn = (e, t, n, r, i) => class extends e {
|
|
2255
|
+
constructor(e, a) {
|
|
2256
|
+
let o = r(e), s = n(o, {
|
|
2257
|
+
...Un,
|
|
2258
|
+
...a
|
|
2259
|
+
}), c = i(o) ? t() : null;
|
|
2260
|
+
super(e, !1, s, c);
|
|
2261
|
+
}
|
|
2262
|
+
}, Gn = (e, t, n) => () => {
|
|
2263
|
+
let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
|
|
2264
|
+
let o = t(i);
|
|
2265
|
+
return F(o, a) || (o = e(a, {
|
|
2266
|
+
channelCount: o.channelCount,
|
|
2267
|
+
channelCountMode: o.channelCountMode,
|
|
2268
|
+
channelInterpretation: o.channelInterpretation,
|
|
2269
|
+
numberOfInputs: o.numberOfInputs
|
|
2270
|
+
})), r.set(a, o), await n(i, a, o), o;
|
|
2271
|
+
};
|
|
2272
|
+
return { render(e, t) {
|
|
2273
|
+
let n = r.get(t);
|
|
2274
|
+
return n === void 0 ? i(e, t) : Promise.resolve(n);
|
|
2275
|
+
} };
|
|
2276
|
+
}, Kn = {
|
|
2277
|
+
channelCount: 6,
|
|
2278
|
+
channelCountMode: "explicit",
|
|
2279
|
+
channelInterpretation: "discrete",
|
|
2280
|
+
numberOfOutputs: 6
|
|
2281
|
+
}, qn = (e, t, n, r, i, a) => class extends e {
|
|
2282
|
+
constructor(e, o) {
|
|
2283
|
+
let s = r(e), c = n(s, a({
|
|
2284
|
+
...Kn,
|
|
2285
|
+
...o
|
|
2286
|
+
})), l = i(s) ? t() : null;
|
|
2287
|
+
super(e, !1, c, l);
|
|
2288
|
+
}
|
|
2289
|
+
}, Jn = (e, t, n) => () => {
|
|
2290
|
+
let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
|
|
2291
|
+
let o = t(i);
|
|
2292
|
+
return F(o, a) || (o = e(a, {
|
|
2293
|
+
channelCount: o.channelCount,
|
|
2294
|
+
channelCountMode: o.channelCountMode,
|
|
2295
|
+
channelInterpretation: o.channelInterpretation,
|
|
2296
|
+
numberOfOutputs: o.numberOfOutputs
|
|
2297
|
+
})), r.set(a, o), await n(i, a, o), o;
|
|
2298
|
+
};
|
|
2299
|
+
return { render(e, t) {
|
|
2300
|
+
let n = r.get(t);
|
|
2301
|
+
return n === void 0 ? i(e, t) : Promise.resolve(n);
|
|
2302
|
+
} };
|
|
2303
|
+
}, Yn = (e) => (t, n, r) => e(n, t, r), Xn = (e) => (t, n) => {
|
|
2304
|
+
let r = e(t, {
|
|
2305
|
+
buffer: null,
|
|
2306
|
+
channelCount: 2,
|
|
2307
|
+
channelCountMode: "max",
|
|
2308
|
+
channelInterpretation: "speakers",
|
|
2309
|
+
loop: !1,
|
|
2310
|
+
loopEnd: 0,
|
|
2311
|
+
loopStart: 0,
|
|
2312
|
+
playbackRate: 1
|
|
2313
|
+
});
|
|
2314
|
+
return r.buffer = t.createBuffer(1, 2, 44100), r.loop = !0, r.connect(n), r.start(), () => {
|
|
2315
|
+
r.stop(), r.disconnect(n);
|
|
2316
|
+
};
|
|
2317
|
+
}, Zn = {
|
|
2318
|
+
channelCount: 2,
|
|
2319
|
+
channelCountMode: "max",
|
|
2320
|
+
channelInterpretation: "speakers",
|
|
2321
|
+
offset: 1
|
|
2322
|
+
}, Qn = (e, t, n, r, i, a, o) => class extends e {
|
|
2323
|
+
constructor(e, o) {
|
|
2324
|
+
let s = i(e), c = r(s, {
|
|
2325
|
+
...Zn,
|
|
2326
|
+
...o
|
|
2327
|
+
}), l = a(s), u = l ? n() : null;
|
|
2328
|
+
super(e, !1, c, u), this._constantSourceNodeRenderer = u, this._nativeConstantSourceNode = c, this._offset = t(this, l, c.offset, L, I), this._onended = null;
|
|
2329
|
+
}
|
|
2330
|
+
get offset() {
|
|
2331
|
+
return this._offset;
|
|
2332
|
+
}
|
|
2333
|
+
get onended() {
|
|
2334
|
+
return this._onended;
|
|
2335
|
+
}
|
|
2336
|
+
set onended(e) {
|
|
2337
|
+
let t = typeof e == "function" ? o(this, e) : null;
|
|
2338
|
+
this._nativeConstantSourceNode.onended = t;
|
|
2339
|
+
let n = this._nativeConstantSourceNode.onended;
|
|
2340
|
+
this._onended = n !== null && n === t ? e : n;
|
|
2341
|
+
}
|
|
2342
|
+
start(e = 0) {
|
|
2343
|
+
if (this._nativeConstantSourceNode.start(e), this._constantSourceNodeRenderer !== null && (this._constantSourceNodeRenderer.start = e), this.context.state !== "closed") {
|
|
2344
|
+
Ot(this);
|
|
2345
|
+
let e = () => {
|
|
2346
|
+
this._nativeConstantSourceNode.removeEventListener("ended", e), Ut(this) && At(this);
|
|
2347
|
+
};
|
|
2348
|
+
this._nativeConstantSourceNode.addEventListener("ended", e);
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
stop(e = 0) {
|
|
2352
|
+
this._nativeConstantSourceNode.stop(e), this._constantSourceNodeRenderer !== null && (this._constantSourceNodeRenderer.stop = e);
|
|
2353
|
+
}
|
|
2354
|
+
}, $n = (e, t, n, r, i) => () => {
|
|
2355
|
+
let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = async (c, l) => {
|
|
2356
|
+
let u = n(c), d = F(u, l);
|
|
2357
|
+
return d || (u = t(l, {
|
|
2358
|
+
channelCount: u.channelCount,
|
|
2359
|
+
channelCountMode: u.channelCountMode,
|
|
2360
|
+
channelInterpretation: u.channelInterpretation,
|
|
2361
|
+
offset: u.offset.value
|
|
2362
|
+
}), o !== null && u.start(o), s !== null && u.stop(s)), a.set(l, u), d ? await e(l, c.offset, u.offset) : await r(l, c.offset, u.offset), await i(c, l, u), u;
|
|
2363
|
+
};
|
|
2364
|
+
return {
|
|
2365
|
+
set start(e) {
|
|
2366
|
+
o = e;
|
|
2367
|
+
},
|
|
2368
|
+
set stop(e) {
|
|
2369
|
+
s = e;
|
|
2370
|
+
},
|
|
2371
|
+
render(e, t) {
|
|
2372
|
+
let n = a.get(t);
|
|
2373
|
+
return n === void 0 ? c(e, t) : Promise.resolve(n);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
}, er = (e) => (t) => (e[0] = t, e[0]), tr = {
|
|
2377
|
+
buffer: null,
|
|
2378
|
+
channelCount: 2,
|
|
2379
|
+
channelCountMode: "clamped-max",
|
|
2380
|
+
channelInterpretation: "speakers",
|
|
2381
|
+
disableNormalization: !1
|
|
2382
|
+
}, nr = (e, t, n, r, i, a) => class extends e {
|
|
2383
|
+
constructor(e, o) {
|
|
2384
|
+
let s = r(e), c = {
|
|
2385
|
+
...tr,
|
|
2386
|
+
...o
|
|
2387
|
+
}, l = n(s, c), u = i(s) ? t() : null;
|
|
2388
|
+
super(e, !1, l, u), this._isBufferNullified = !1, this._nativeConvolverNode = l, c.buffer !== null && a(this, c.buffer.duration);
|
|
2389
|
+
}
|
|
2390
|
+
get buffer() {
|
|
2391
|
+
return this._isBufferNullified ? null : this._nativeConvolverNode.buffer;
|
|
2392
|
+
}
|
|
2393
|
+
set buffer(e) {
|
|
2394
|
+
if (this._nativeConvolverNode.buffer = e, e === null && this._nativeConvolverNode.buffer !== null) {
|
|
2395
|
+
let e = this._nativeConvolverNode.context;
|
|
2396
|
+
this._nativeConvolverNode.buffer = e.createBuffer(1, 1, e.sampleRate), this._isBufferNullified = !0, a(this, 0);
|
|
2397
|
+
} else this._isBufferNullified = !1, a(this, this._nativeConvolverNode.buffer === null ? 0 : this._nativeConvolverNode.buffer.duration);
|
|
2398
|
+
}
|
|
2399
|
+
get normalize() {
|
|
2400
|
+
return this._nativeConvolverNode.normalize;
|
|
2401
|
+
}
|
|
2402
|
+
set normalize(e) {
|
|
2403
|
+
this._nativeConvolverNode.normalize = e;
|
|
2404
|
+
}
|
|
2405
|
+
}, rr = (e, t, n) => () => {
|
|
2406
|
+
let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
|
|
2407
|
+
let o = t(i);
|
|
2408
|
+
return F(o, a) || (o = e(a, {
|
|
2409
|
+
buffer: o.buffer,
|
|
2410
|
+
channelCount: o.channelCount,
|
|
2411
|
+
channelCountMode: o.channelCountMode,
|
|
2412
|
+
channelInterpretation: o.channelInterpretation,
|
|
2413
|
+
disableNormalization: !o.normalize
|
|
2414
|
+
})), r.set(a, o), pn(o) ? await n(i, a, o.inputs[0]) : await n(i, a, o), o;
|
|
2415
|
+
};
|
|
2416
|
+
return { render(e, t) {
|
|
2417
|
+
let n = r.get(t);
|
|
2418
|
+
return n === void 0 ? i(e, t) : Promise.resolve(n);
|
|
2419
|
+
} };
|
|
2420
|
+
}, ir = () => new DOMException("", "DataCloneError"), ar = (e) => {
|
|
2421
|
+
let { port1: t, port2: n } = new MessageChannel();
|
|
2422
|
+
return new Promise((r) => {
|
|
2423
|
+
let i = () => {
|
|
2424
|
+
n.onmessage = null, t.close(), n.close(), r();
|
|
2425
|
+
};
|
|
2426
|
+
n.onmessage = () => i();
|
|
2427
|
+
try {
|
|
2428
|
+
t.postMessage(e, [e]);
|
|
2429
|
+
} catch {} finally {
|
|
2430
|
+
i();
|
|
2431
|
+
}
|
|
2432
|
+
});
|
|
2433
|
+
}, or = (e, t, n, r, i, a, o, s, c, l, u) => (d, f) => {
|
|
2434
|
+
let p = o(d) ? d : a(d);
|
|
2435
|
+
if (i.has(f)) {
|
|
2436
|
+
let e = n();
|
|
2437
|
+
return Promise.reject(e);
|
|
2438
|
+
}
|
|
2439
|
+
try {
|
|
2440
|
+
i.add(f);
|
|
2441
|
+
} catch {}
|
|
2442
|
+
return t(c, () => c(p)) ? p.decodeAudioData(f).then((n) => (ar(f).catch(() => {}), t(s, () => s(n)) || u(n), e.add(n), n)) : new Promise((t, n) => {
|
|
2443
|
+
let i = async () => {
|
|
2444
|
+
try {
|
|
2445
|
+
await ar(f);
|
|
2446
|
+
} catch {}
|
|
2447
|
+
}, a = (e) => {
|
|
2448
|
+
n(e), i();
|
|
2449
|
+
};
|
|
2450
|
+
try {
|
|
2451
|
+
p.decodeAudioData(f, (n) => {
|
|
2452
|
+
typeof n.copyFromChannel != "function" && (l(n), Bt(n)), e.add(n), i().then(() => t(n));
|
|
2453
|
+
}, (e) => {
|
|
2454
|
+
a(e === null ? r() : e);
|
|
2455
|
+
});
|
|
2456
|
+
} catch (e) {
|
|
2457
|
+
a(e);
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
}, sr = (e, t, n, r, i, a, o, s) => (c, l) => {
|
|
2461
|
+
let u = t.get(c);
|
|
2462
|
+
if (u === void 0) throw Error("Missing the expected cycle count.");
|
|
2463
|
+
let d = s(a(c.context));
|
|
2464
|
+
if (u === l) {
|
|
2465
|
+
if (t.delete(c), !d && o(c)) {
|
|
2466
|
+
let t = r(c), { outputs: a } = n(c);
|
|
2467
|
+
for (let n of a) if (ln(n)) e(t, r(n[0]), n[1], n[2]);
|
|
2468
|
+
else {
|
|
2469
|
+
let e = i(n[0]);
|
|
2470
|
+
t.connect(e, n[1]);
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
} else t.set(c, u - l);
|
|
2474
|
+
}, cr = {
|
|
2475
|
+
channelCount: 2,
|
|
2476
|
+
channelCountMode: "max",
|
|
2477
|
+
channelInterpretation: "speakers",
|
|
2478
|
+
delayTime: 0,
|
|
2479
|
+
maxDelayTime: 1
|
|
2480
|
+
}, lr = (e, t, n, r, i, a, o) => class extends e {
|
|
2481
|
+
constructor(e, s) {
|
|
2482
|
+
let c = i(e), l = {
|
|
2483
|
+
...cr,
|
|
2484
|
+
...s
|
|
2485
|
+
}, u = r(c, l), d = a(c), f = d ? n(l.maxDelayTime) : null;
|
|
2486
|
+
super(e, !1, u, f), this._delayTime = t(this, d, u.delayTime), o(this, l.maxDelayTime);
|
|
2487
|
+
}
|
|
2488
|
+
get delayTime() {
|
|
2489
|
+
return this._delayTime;
|
|
2490
|
+
}
|
|
2491
|
+
}, ur = (e, t, n, r, i) => (a) => {
|
|
2492
|
+
let o = /* @__PURE__ */ new WeakMap(), s = async (s, c) => {
|
|
2493
|
+
let l = n(s), u = F(l, c);
|
|
2494
|
+
return u || (l = t(c, {
|
|
2495
|
+
channelCount: l.channelCount,
|
|
2496
|
+
channelCountMode: l.channelCountMode,
|
|
2497
|
+
channelInterpretation: l.channelInterpretation,
|
|
2498
|
+
delayTime: l.delayTime.value,
|
|
2499
|
+
maxDelayTime: a
|
|
2500
|
+
})), o.set(c, l), u ? await e(c, s.delayTime, l.delayTime) : await r(c, s.delayTime, l.delayTime), await i(s, c, l), l;
|
|
2501
|
+
};
|
|
2502
|
+
return { render(e, t) {
|
|
2503
|
+
let n = o.get(t);
|
|
2504
|
+
return n === void 0 ? s(e, t) : Promise.resolve(n);
|
|
2505
|
+
} };
|
|
2506
|
+
}, dr = (e) => (t, n, r, i) => e(t[i], (e) => e[0] === n && e[1] === r), fr = (e) => "delayTime" in e, pr = (e, t, n) => function r(i, a) {
|
|
2507
|
+
let o = cn(a) ? a : n(e, a);
|
|
2508
|
+
if (fr(o)) return [];
|
|
2509
|
+
if (i[0] === o) return [i];
|
|
2510
|
+
if (i.includes(o)) return [];
|
|
2511
|
+
let { outputs: s } = t(o);
|
|
2512
|
+
return Array.from(s).map((e) => r([...i, o], e[0])).reduce((e, t) => e.concat(t), []);
|
|
2513
|
+
}, mr = {
|
|
2514
|
+
attack: .003,
|
|
2515
|
+
channelCount: 2,
|
|
2516
|
+
channelCountMode: "clamped-max",
|
|
2517
|
+
channelInterpretation: "speakers",
|
|
2518
|
+
knee: 30,
|
|
2519
|
+
ratio: 12,
|
|
2520
|
+
release: .25,
|
|
2521
|
+
threshold: -24
|
|
2522
|
+
}, hr = (e, t, n, r, i, a, o, s) => class extends e {
|
|
2523
|
+
constructor(e, i) {
|
|
2524
|
+
let c = a(e), l = r(c, {
|
|
2525
|
+
...mr,
|
|
2526
|
+
...i
|
|
2527
|
+
}), u = o(c), d = u ? n() : null;
|
|
2528
|
+
super(e, !1, l, d), this._attack = t(this, u, l.attack), this._knee = t(this, u, l.knee), this._nativeDynamicsCompressorNode = l, this._ratio = t(this, u, l.ratio), this._release = t(this, u, l.release), this._threshold = t(this, u, l.threshold), s(this, .006);
|
|
2529
|
+
}
|
|
2530
|
+
get attack() {
|
|
2531
|
+
return this._attack;
|
|
2532
|
+
}
|
|
2533
|
+
get channelCount() {
|
|
2534
|
+
return this._nativeDynamicsCompressorNode.channelCount;
|
|
2535
|
+
}
|
|
2536
|
+
set channelCount(e) {
|
|
2537
|
+
let t = this._nativeDynamicsCompressorNode.channelCount;
|
|
2538
|
+
if (this._nativeDynamicsCompressorNode.channelCount = e, e > 2) throw this._nativeDynamicsCompressorNode.channelCount = t, i();
|
|
2539
|
+
}
|
|
2540
|
+
get channelCountMode() {
|
|
2541
|
+
return this._nativeDynamicsCompressorNode.channelCountMode;
|
|
2542
|
+
}
|
|
2543
|
+
set channelCountMode(e) {
|
|
2544
|
+
let t = this._nativeDynamicsCompressorNode.channelCountMode;
|
|
2545
|
+
if (this._nativeDynamicsCompressorNode.channelCountMode = e, e === "max") throw this._nativeDynamicsCompressorNode.channelCountMode = t, i();
|
|
2546
|
+
}
|
|
2547
|
+
get knee() {
|
|
2548
|
+
return this._knee;
|
|
2549
|
+
}
|
|
2550
|
+
get ratio() {
|
|
2551
|
+
return this._ratio;
|
|
2552
|
+
}
|
|
2553
|
+
get reduction() {
|
|
2554
|
+
return typeof this._nativeDynamicsCompressorNode.reduction.value == "number" ? this._nativeDynamicsCompressorNode.reduction.value : this._nativeDynamicsCompressorNode.reduction;
|
|
2555
|
+
}
|
|
2556
|
+
get release() {
|
|
2557
|
+
return this._release;
|
|
2558
|
+
}
|
|
2559
|
+
get threshold() {
|
|
2560
|
+
return this._threshold;
|
|
2561
|
+
}
|
|
2562
|
+
}, gr = (e, t, n, r, i) => () => {
|
|
2563
|
+
let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
|
|
2564
|
+
let c = n(o), l = F(c, s);
|
|
2565
|
+
return l || (c = t(s, {
|
|
2566
|
+
attack: c.attack.value,
|
|
2567
|
+
channelCount: c.channelCount,
|
|
2568
|
+
channelCountMode: c.channelCountMode,
|
|
2569
|
+
channelInterpretation: c.channelInterpretation,
|
|
2570
|
+
knee: c.knee.value,
|
|
2571
|
+
ratio: c.ratio.value,
|
|
2572
|
+
release: c.release.value,
|
|
2573
|
+
threshold: c.threshold.value
|
|
2574
|
+
})), a.set(s, c), l ? (await e(s, o.attack, c.attack), await e(s, o.knee, c.knee), await e(s, o.ratio, c.ratio), await e(s, o.release, c.release), await e(s, o.threshold, c.threshold)) : (await r(s, o.attack, c.attack), await r(s, o.knee, c.knee), await r(s, o.ratio, c.ratio), await r(s, o.release, c.release), await r(s, o.threshold, c.threshold)), await i(o, s, c), c;
|
|
2575
|
+
};
|
|
2576
|
+
return { render(e, t) {
|
|
2577
|
+
let n = a.get(t);
|
|
2578
|
+
return n === void 0 ? o(e, t) : Promise.resolve(n);
|
|
2579
|
+
} };
|
|
2580
|
+
}, _r = () => new DOMException("", "EncodingError"), vr = (e) => (t) => new Promise((n, r) => {
|
|
2581
|
+
if (e === null) {
|
|
2582
|
+
r(/* @__PURE__ */ SyntaxError());
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
let i = e.document.head;
|
|
2586
|
+
if (i === null) r(/* @__PURE__ */ SyntaxError());
|
|
2587
|
+
else {
|
|
2588
|
+
let a = e.document.createElement("script"), o = new Blob([t], { type: "application/javascript" }), s = URL.createObjectURL(o), c = e.onerror, l = () => {
|
|
2589
|
+
e.onerror = c, URL.revokeObjectURL(s);
|
|
2590
|
+
};
|
|
2591
|
+
e.onerror = (t, n, i, a, o) => {
|
|
2592
|
+
if (n === s || n === e.location.href && i === 1 && a === 1) return l(), r(o), !1;
|
|
2593
|
+
if (c !== null) return c(t, n, i, a, o);
|
|
2594
|
+
}, a.onerror = () => {
|
|
2595
|
+
l(), r(/* @__PURE__ */ SyntaxError());
|
|
2596
|
+
}, a.onload = () => {
|
|
2597
|
+
l(), n();
|
|
2598
|
+
}, a.src = s, a.type = "module", i.appendChild(a);
|
|
2599
|
+
}
|
|
2600
|
+
}), yr = (e) => class {
|
|
2601
|
+
constructor(e) {
|
|
2602
|
+
this._nativeEventTarget = e, this._listeners = /* @__PURE__ */ new WeakMap();
|
|
2603
|
+
}
|
|
2604
|
+
addEventListener(t, n, r) {
|
|
2605
|
+
if (n !== null) {
|
|
2606
|
+
let i = this._listeners.get(n);
|
|
2607
|
+
i === void 0 && (i = e(this, n), typeof n == "function" && this._listeners.set(n, i)), this._nativeEventTarget.addEventListener(t, i, r);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
dispatchEvent(e) {
|
|
2611
|
+
return this._nativeEventTarget.dispatchEvent(e);
|
|
2612
|
+
}
|
|
2613
|
+
removeEventListener(e, t, n) {
|
|
2614
|
+
let r = t === null ? void 0 : this._listeners.get(t);
|
|
2615
|
+
this._nativeEventTarget.removeEventListener(e, r === void 0 ? null : r, n);
|
|
2616
|
+
}
|
|
2617
|
+
}, br = (e) => (t, n, r) => {
|
|
2618
|
+
Object.defineProperties(e, {
|
|
2619
|
+
currentFrame: {
|
|
2620
|
+
configurable: !0,
|
|
2621
|
+
get() {
|
|
2622
|
+
return Math.round(t * n);
|
|
2623
|
+
}
|
|
2624
|
+
},
|
|
2625
|
+
currentTime: {
|
|
2626
|
+
configurable: !0,
|
|
2627
|
+
get() {
|
|
2628
|
+
return t;
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
});
|
|
2632
|
+
try {
|
|
2633
|
+
return r();
|
|
2634
|
+
} finally {
|
|
2635
|
+
e !== null && (delete e.currentFrame, delete e.currentTime);
|
|
2636
|
+
}
|
|
2637
|
+
}, xr = (e) => async (t) => {
|
|
2638
|
+
try {
|
|
2639
|
+
let e = await fetch(t);
|
|
2640
|
+
if (e.ok) return [await e.text(), e.url];
|
|
2641
|
+
} catch {}
|
|
2642
|
+
throw e();
|
|
2643
|
+
}, Sr = {
|
|
2644
|
+
channelCount: 2,
|
|
2645
|
+
channelCountMode: "max",
|
|
2646
|
+
channelInterpretation: "speakers",
|
|
2647
|
+
gain: 1
|
|
2648
|
+
}, Cr = (e, t, n, r, i, a) => class extends e {
|
|
2649
|
+
constructor(e, o) {
|
|
2650
|
+
let s = i(e), c = r(s, {
|
|
2651
|
+
...Sr,
|
|
2652
|
+
...o
|
|
2653
|
+
}), l = a(s), u = l ? n() : null;
|
|
2654
|
+
super(e, !1, c, u), this._gain = t(this, l, c.gain, L, I);
|
|
2655
|
+
}
|
|
2656
|
+
get gain() {
|
|
2657
|
+
return this._gain;
|
|
2658
|
+
}
|
|
2659
|
+
}, wr = (e, t, n, r, i) => () => {
|
|
2660
|
+
let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
|
|
2661
|
+
let c = n(o), l = F(c, s);
|
|
2662
|
+
return l || (c = t(s, {
|
|
2663
|
+
channelCount: c.channelCount,
|
|
2664
|
+
channelCountMode: c.channelCountMode,
|
|
2665
|
+
channelInterpretation: c.channelInterpretation,
|
|
2666
|
+
gain: c.gain.value
|
|
2667
|
+
})), a.set(s, c), l ? await e(s, o.gain, c.gain) : await r(s, o.gain, c.gain), await i(o, s, c), c;
|
|
2668
|
+
};
|
|
2669
|
+
return { render(e, t) {
|
|
2670
|
+
let n = a.get(t);
|
|
2671
|
+
return n === void 0 ? o(e, t) : Promise.resolve(n);
|
|
2672
|
+
} };
|
|
2673
|
+
}, Tr = (e) => (t) => {
|
|
2674
|
+
let n = e(t);
|
|
2675
|
+
if (n.renderer === null) throw Error("Missing the renderer of the given AudioNode in the audio graph.");
|
|
2676
|
+
return n.renderer;
|
|
2677
|
+
}, Er = (e) => (t) => e.get(t) ?? 0, Dr = (e) => (t) => {
|
|
2678
|
+
let n = e(t);
|
|
2679
|
+
if (n.renderer === null) throw Error("Missing the renderer of the given AudioParam in the audio graph.");
|
|
2680
|
+
return n.renderer;
|
|
2681
|
+
}, B = () => new DOMException("", "InvalidStateError"), Or = (e) => (t) => {
|
|
2682
|
+
let n = e.get(t);
|
|
2683
|
+
if (n === void 0) throw B();
|
|
2684
|
+
return n;
|
|
2685
|
+
}, kr = (e, t) => (n) => {
|
|
2686
|
+
let r = e.get(n);
|
|
2687
|
+
if (r !== void 0) return r;
|
|
2688
|
+
if (t === null) throw Error("Missing the native OfflineAudioContext constructor.");
|
|
2689
|
+
return r = new t(1, 1, 44100), e.set(n, r), r;
|
|
2690
|
+
}, Ar = () => new DOMException("", "InvalidAccessError"), jr = (e) => {
|
|
2691
|
+
e.getFrequencyResponse = ((t) => (n, r, i) => {
|
|
2692
|
+
if (n.length !== r.length || r.length !== i.length) throw Ar();
|
|
2693
|
+
return t.call(e, n, r, i);
|
|
2694
|
+
})(e.getFrequencyResponse);
|
|
2695
|
+
}, Mr = {
|
|
2696
|
+
channelCount: 2,
|
|
2697
|
+
channelCountMode: "max",
|
|
2698
|
+
channelInterpretation: "speakers"
|
|
2699
|
+
}, Nr = (e, t, n, r, i, a) => class extends e {
|
|
2700
|
+
constructor(e, o) {
|
|
2701
|
+
let s = r(e), c = i(s), l = {
|
|
2702
|
+
...Mr,
|
|
2703
|
+
...o
|
|
2704
|
+
}, u = t(s, c ? null : e.baseLatency, l), d = c ? n(l.feedback, l.feedforward) : null;
|
|
2705
|
+
super(e, !1, u, d), jr(u), this._nativeIIRFilterNode = u, a(this, 1);
|
|
2706
|
+
}
|
|
2707
|
+
getFrequencyResponse(e, t, n) {
|
|
2708
|
+
return this._nativeIIRFilterNode.getFrequencyResponse(e, t, n);
|
|
2709
|
+
}
|
|
2710
|
+
}, Pr = (e, t, n, r, i, a, o, s, c, l, u) => {
|
|
2711
|
+
let d = l.length, f = s;
|
|
2712
|
+
for (let s = 0; s < d; s += 1) {
|
|
2713
|
+
let d = n[0] * l[s];
|
|
2714
|
+
for (let t = 1; t < i; t += 1) {
|
|
2715
|
+
let r = f - t & c - 1;
|
|
2716
|
+
d += n[t] * a[r], d -= e[t] * o[r];
|
|
2717
|
+
}
|
|
2718
|
+
for (let e = i; e < r; e += 1) d += n[e] * a[f - e & c - 1];
|
|
2719
|
+
for (let n = i; n < t; n += 1) d -= e[n] * o[f - n & c - 1];
|
|
2720
|
+
a[f] = l[s], o[f] = d, f = f + 1 & c - 1, u[s] = d;
|
|
2721
|
+
}
|
|
2722
|
+
return f;
|
|
2723
|
+
}, Fr = (e, t, n, r) => {
|
|
2724
|
+
let i = n instanceof Float64Array ? n : new Float64Array(n), a = r instanceof Float64Array ? r : new Float64Array(r), o = i.length, s = a.length, c = Math.min(o, s);
|
|
2725
|
+
if (i[0] !== 1) {
|
|
2726
|
+
for (let e = 0; e < o; e += 1) a[e] /= i[0];
|
|
2727
|
+
for (let e = 1; e < s; e += 1) i[e] /= i[0];
|
|
2728
|
+
}
|
|
2729
|
+
let l = new Float32Array(32), u = new Float32Array(32), d = t.createBuffer(e.numberOfChannels, e.length, e.sampleRate), f = e.numberOfChannels;
|
|
2730
|
+
for (let t = 0; t < f; t += 1) {
|
|
2731
|
+
let n = e.getChannelData(t), r = d.getChannelData(t);
|
|
2732
|
+
l.fill(0), u.fill(0), Pr(i, o, a, s, c, l, u, 0, 32, n, r);
|
|
2733
|
+
}
|
|
2734
|
+
return d;
|
|
2735
|
+
}, Ir = (e, t, n, r, i) => (a, o) => {
|
|
2736
|
+
let s = /* @__PURE__ */ new WeakMap(), c = null, l = async (l, u) => {
|
|
2737
|
+
let d = null, f = t(l), p = F(f, u);
|
|
2738
|
+
if (u.createIIRFilter === void 0 ? d = e(u, {
|
|
2739
|
+
buffer: null,
|
|
2740
|
+
channelCount: 2,
|
|
2741
|
+
channelCountMode: "max",
|
|
2742
|
+
channelInterpretation: "speakers",
|
|
2743
|
+
loop: !1,
|
|
2744
|
+
loopEnd: 0,
|
|
2745
|
+
loopStart: 0,
|
|
2746
|
+
playbackRate: 1
|
|
2747
|
+
}) : p || (f = u.createIIRFilter(o, a)), s.set(u, d === null ? f : d), d !== null) {
|
|
2748
|
+
if (c === null) {
|
|
2749
|
+
if (n === null) throw Error("Missing the native OfflineAudioContext constructor.");
|
|
2750
|
+
let e = new n(l.context.destination.channelCount, l.context.length, u.sampleRate);
|
|
2751
|
+
c = (async () => (await r(l, e, e.destination), Fr(await i(e), u, a, o)))();
|
|
2752
|
+
}
|
|
2753
|
+
let e = await c;
|
|
2754
|
+
return d.buffer = e, d.start(0), d;
|
|
2755
|
+
}
|
|
2756
|
+
return await r(l, u, f), f;
|
|
2757
|
+
};
|
|
2758
|
+
return { render(e, t) {
|
|
2759
|
+
let n = s.get(t);
|
|
2760
|
+
return n === void 0 ? l(e, t) : Promise.resolve(n);
|
|
2761
|
+
} };
|
|
2762
|
+
}, Lr = (e, t, n, r, i, a) => (o) => (s, c) => {
|
|
2763
|
+
let l = e.get(s);
|
|
2764
|
+
if (l === void 0) {
|
|
2765
|
+
if (!o && a(s)) {
|
|
2766
|
+
let e = r(s), { outputs: a } = n(s);
|
|
2767
|
+
for (let n of a) if (ln(n)) t(e, r(n[0]), n[1], n[2]);
|
|
2768
|
+
else {
|
|
2769
|
+
let t = i(n[0]);
|
|
2770
|
+
e.disconnect(t, n[1]);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
e.set(s, c);
|
|
2774
|
+
} else e.set(s, l + c);
|
|
2775
|
+
}, Rr = (e) => (t) => e !== null && t instanceof e, zr = (e) => (t) => e !== null && typeof e.AudioNode == "function" && t instanceof e.AudioNode, Br = (e) => (t) => e !== null && typeof e.AudioParam == "function" && t instanceof e.AudioParam, Vr = (e, t) => (n) => e(n) || t(n), Hr = (e) => (t) => e !== null && t instanceof e, Ur = (e) => e !== null && e.isSecureContext, Wr = (e, t, n, r) => class extends e {
|
|
2776
|
+
constructor(e, i) {
|
|
2777
|
+
let a = n(e), o = t(a, i);
|
|
2778
|
+
if (r(a)) throw TypeError();
|
|
2779
|
+
super(e, !0, o, null), this._nativeMediaElementAudioSourceNode = o;
|
|
2780
|
+
}
|
|
2781
|
+
get mediaElement() {
|
|
2782
|
+
return this._nativeMediaElementAudioSourceNode.mediaElement;
|
|
2783
|
+
}
|
|
2784
|
+
}, Gr = {
|
|
2785
|
+
channelCount: 2,
|
|
2786
|
+
channelCountMode: "explicit",
|
|
2787
|
+
channelInterpretation: "speakers"
|
|
2788
|
+
}, Kr = (e, t, n, r) => class extends e {
|
|
2789
|
+
constructor(e, i) {
|
|
2790
|
+
let a = n(e);
|
|
2791
|
+
if (r(a)) throw TypeError();
|
|
2792
|
+
let o = t(a, {
|
|
2793
|
+
...Gr,
|
|
2794
|
+
...i
|
|
2795
|
+
});
|
|
2796
|
+
super(e, !1, o, null), this._nativeMediaStreamAudioDestinationNode = o;
|
|
2797
|
+
}
|
|
2798
|
+
get stream() {
|
|
2799
|
+
return this._nativeMediaStreamAudioDestinationNode.stream;
|
|
2800
|
+
}
|
|
2801
|
+
}, qr = (e, t, n, r) => class extends e {
|
|
2802
|
+
constructor(e, i) {
|
|
2803
|
+
let a = n(e), o = t(a, i);
|
|
2804
|
+
if (r(a)) throw TypeError();
|
|
2805
|
+
super(e, !0, o, null), this._nativeMediaStreamAudioSourceNode = o;
|
|
2806
|
+
}
|
|
2807
|
+
get mediaStream() {
|
|
2808
|
+
return this._nativeMediaStreamAudioSourceNode.mediaStream;
|
|
2809
|
+
}
|
|
2810
|
+
}, Jr = (e, t, n) => class extends e {
|
|
2811
|
+
constructor(e, r) {
|
|
2812
|
+
let i = t(n(e), r);
|
|
2813
|
+
super(e, !0, i, null);
|
|
2814
|
+
}
|
|
2815
|
+
}, Yr = (e, t, n, r, i, a) => class extends n {
|
|
2816
|
+
constructor(n, a) {
|
|
2817
|
+
super(n), this._nativeContext = n, pt.set(this, n), r(n) && i.set(n, /* @__PURE__ */ new Set()), this._destination = new e(this, a), this._listener = t(this, n), this._onstatechange = null;
|
|
2818
|
+
}
|
|
2819
|
+
get currentTime() {
|
|
2820
|
+
return this._nativeContext.currentTime;
|
|
2821
|
+
}
|
|
2822
|
+
get destination() {
|
|
2823
|
+
return this._destination;
|
|
2824
|
+
}
|
|
2825
|
+
get listener() {
|
|
2826
|
+
return this._listener;
|
|
2827
|
+
}
|
|
2828
|
+
get onstatechange() {
|
|
2829
|
+
return this._onstatechange;
|
|
2830
|
+
}
|
|
2831
|
+
set onstatechange(e) {
|
|
2832
|
+
let t = typeof e == "function" ? a(this, e) : null;
|
|
2833
|
+
this._nativeContext.onstatechange = t;
|
|
2834
|
+
let n = this._nativeContext.onstatechange;
|
|
2835
|
+
this._onstatechange = n !== null && n === t ? e : n;
|
|
2836
|
+
}
|
|
2837
|
+
get sampleRate() {
|
|
2838
|
+
return this._nativeContext.sampleRate;
|
|
2839
|
+
}
|
|
2840
|
+
get state() {
|
|
2841
|
+
return this._nativeContext.state;
|
|
2842
|
+
}
|
|
2843
|
+
}, Xr = (e) => {
|
|
2844
|
+
let t = new Uint32Array([
|
|
2845
|
+
1179011410,
|
|
2846
|
+
40,
|
|
2847
|
+
1163280727,
|
|
2848
|
+
544501094,
|
|
2849
|
+
16,
|
|
2850
|
+
131073,
|
|
2851
|
+
44100,
|
|
2852
|
+
176400,
|
|
2853
|
+
1048580,
|
|
2854
|
+
1635017060,
|
|
2855
|
+
4,
|
|
2856
|
+
0
|
|
2857
|
+
]);
|
|
2858
|
+
try {
|
|
2859
|
+
let n = e.decodeAudioData(t.buffer, () => {});
|
|
2860
|
+
return n === void 0 ? !1 : (n.catch(() => {}), !0);
|
|
2861
|
+
} catch {}
|
|
2862
|
+
return !1;
|
|
2863
|
+
}, Zr = (e, t) => (n, r, i) => {
|
|
2864
|
+
let a = /* @__PURE__ */ new Set();
|
|
2865
|
+
return n.connect = ((i) => (o, s = 0, c = 0) => {
|
|
2866
|
+
let l = a.size === 0;
|
|
2867
|
+
if (t(o)) return i.call(n, o, s, c), e(a, [
|
|
2868
|
+
o,
|
|
2869
|
+
s,
|
|
2870
|
+
c
|
|
2871
|
+
], (e) => e[0] === o && e[1] === s && e[2] === c, !0), l && r(), o;
|
|
2872
|
+
i.call(n, o, s), e(a, [o, s], (e) => e[0] === o && e[1] === s, !0), l && r();
|
|
2873
|
+
})(n.connect), n.disconnect = ((e) => (r, o, s) => {
|
|
2874
|
+
let c = a.size > 0;
|
|
2875
|
+
if (r === void 0) e.apply(n), a.clear();
|
|
2876
|
+
else if (typeof r == "number") {
|
|
2877
|
+
e.call(n, r);
|
|
2878
|
+
for (let e of a) e[1] === r && a.delete(e);
|
|
2879
|
+
} else {
|
|
2880
|
+
t(r) ? e.call(n, r, o, s) : e.call(n, r, o);
|
|
2881
|
+
for (let e of a) e[0] === r && (o === void 0 || e[1] === o) && (s === void 0 || e[2] === s) && a.delete(e);
|
|
2882
|
+
}
|
|
2883
|
+
let l = a.size === 0;
|
|
2884
|
+
c && l && i();
|
|
2885
|
+
})(n.disconnect), n;
|
|
2886
|
+
}, V = (e, t, n) => {
|
|
2887
|
+
let r = t[n];
|
|
2888
|
+
r !== void 0 && r !== e[n] && (e[n] = r);
|
|
2889
|
+
}, H = (e, t) => {
|
|
2890
|
+
V(e, t, "channelCount"), V(e, t, "channelCountMode"), V(e, t, "channelInterpretation");
|
|
2891
|
+
}, Qr = (e) => typeof e.getFloatTimeDomainData == "function", $r = (e) => {
|
|
2892
|
+
e.getFloatTimeDomainData = (t) => {
|
|
2893
|
+
let n = new Uint8Array(t.length);
|
|
2894
|
+
e.getByteTimeDomainData(n);
|
|
2895
|
+
let r = Math.max(n.length, e.fftSize);
|
|
2896
|
+
for (let e = 0; e < r; e += 1) t[e] = (n[e] - 128) * .0078125;
|
|
2897
|
+
return t;
|
|
2898
|
+
};
|
|
2899
|
+
}, ei = (e, t) => (n, r) => {
|
|
2900
|
+
let i = n.createAnalyser();
|
|
2901
|
+
if (H(i, r), !(r.maxDecibels > r.minDecibels)) throw t();
|
|
2902
|
+
return V(i, r, "fftSize"), V(i, r, "maxDecibels"), V(i, r, "minDecibels"), V(i, r, "smoothingTimeConstant"), e(Qr, () => Qr(i)) || $r(i), i;
|
|
2903
|
+
}, ti = (e) => e === null ? null : e.hasOwnProperty("AudioBuffer") ? e.AudioBuffer : null, U = (e, t, n) => {
|
|
2904
|
+
let r = t[n];
|
|
2905
|
+
r !== void 0 && r !== e[n].value && (e[n].value = r);
|
|
2906
|
+
}, ni = (e) => {
|
|
2907
|
+
e.start = ((t) => {
|
|
2908
|
+
let n = !1;
|
|
2909
|
+
return (r = 0, i = 0, a) => {
|
|
2910
|
+
if (n) throw B();
|
|
2911
|
+
t.call(e, r, i, a), n = !0;
|
|
2912
|
+
};
|
|
2913
|
+
})(e.start);
|
|
2914
|
+
}, ri = (e) => {
|
|
2915
|
+
e.start = ((t) => (n = 0, r = 0, i) => {
|
|
2916
|
+
if (typeof i == "number" && i < 0 || r < 0 || n < 0) throw RangeError("The parameters can't be negative.");
|
|
2917
|
+
t.call(e, n, r, i);
|
|
2918
|
+
})(e.start);
|
|
2919
|
+
}, ii = (e) => {
|
|
2920
|
+
e.stop = ((t) => (n = 0) => {
|
|
2921
|
+
if (n < 0) throw RangeError("The parameter can't be negative.");
|
|
2922
|
+
t.call(e, n);
|
|
2923
|
+
})(e.stop);
|
|
2924
|
+
}, ai = (e, t, n, r, i, a, o, s, c, l, u) => (d, f) => {
|
|
2925
|
+
let p = d.createBufferSource();
|
|
2926
|
+
return H(p, f), U(p, f, "playbackRate"), V(p, f, "buffer"), V(p, f, "loop"), V(p, f, "loopEnd"), V(p, f, "loopStart"), t(n, () => n(d)) || ni(p), t(r, () => r(d)) || c(p), t(i, () => i(d)) || l(p, d), t(a, () => a(d)) || ri(p), t(o, () => o(d)) || u(p, d), t(s, () => s(d)) || ii(p), e(d, p), p;
|
|
2927
|
+
}, oi = (e) => e === null ? null : e.hasOwnProperty("AudioContext") ? e.AudioContext : e.hasOwnProperty("webkitAudioContext") ? e.webkitAudioContext : null, si = (e, t) => (n, r, i) => {
|
|
2928
|
+
let a = n.destination;
|
|
2929
|
+
if (a.channelCount !== r) try {
|
|
2930
|
+
a.channelCount = r;
|
|
2931
|
+
} catch {}
|
|
2932
|
+
i && a.channelCountMode !== "explicit" && (a.channelCountMode = "explicit"), a.maxChannelCount === 0 && Object.defineProperty(a, "maxChannelCount", { value: r });
|
|
2933
|
+
let o = e(n, {
|
|
2934
|
+
channelCount: r,
|
|
2935
|
+
channelCountMode: a.channelCountMode,
|
|
2936
|
+
channelInterpretation: a.channelInterpretation,
|
|
2937
|
+
gain: 1
|
|
2938
|
+
});
|
|
2939
|
+
return t(o, "channelCount", (e) => () => e.call(o), (e) => (t) => {
|
|
2940
|
+
e.call(o, t);
|
|
2941
|
+
try {
|
|
2942
|
+
a.channelCount = t;
|
|
2943
|
+
} catch (e) {
|
|
2944
|
+
if (t > a.maxChannelCount) throw e;
|
|
2945
|
+
}
|
|
2946
|
+
}), t(o, "channelCountMode", (e) => () => e.call(o), (e) => (t) => {
|
|
2947
|
+
e.call(o, t), a.channelCountMode = t;
|
|
2948
|
+
}), t(o, "channelInterpretation", (e) => () => e.call(o), (e) => (t) => {
|
|
2949
|
+
e.call(o, t), a.channelInterpretation = t;
|
|
2950
|
+
}), Object.defineProperty(o, "maxChannelCount", { get: () => a.maxChannelCount }), o.connect(a), o;
|
|
2951
|
+
}, ci = (e) => e === null ? null : e.hasOwnProperty("AudioWorkletNode") ? e.AudioWorkletNode : null, li = (e, t) => e === null ? 512 : Math.max(512, Math.min(16384, 2 ** Math.round(Math.log2(e * t)))), ui = (e, t) => {
|
|
2952
|
+
let n = e.createBiquadFilter();
|
|
2953
|
+
return H(n, t), U(n, t, "Q"), U(n, t, "detune"), U(n, t, "frequency"), U(n, t, "gain"), V(n, t, "type"), n;
|
|
2954
|
+
}, di = (e, t) => (n, r) => {
|
|
2955
|
+
let i = n.createChannelMerger(r.numberOfInputs);
|
|
2956
|
+
return e !== null && e.name === "webkitAudioContext" && t(n, i), H(i, r), i;
|
|
2957
|
+
}, fi = (e) => {
|
|
2958
|
+
let t = e.numberOfOutputs;
|
|
2959
|
+
Object.defineProperty(e, "channelCount", {
|
|
2960
|
+
get: () => t,
|
|
2961
|
+
set: (e) => {
|
|
2962
|
+
if (e !== t) throw B();
|
|
2963
|
+
}
|
|
2964
|
+
}), Object.defineProperty(e, "channelCountMode", {
|
|
2965
|
+
get: () => "explicit",
|
|
2966
|
+
set: (e) => {
|
|
2967
|
+
if (e !== "explicit") throw B();
|
|
2968
|
+
}
|
|
2969
|
+
}), Object.defineProperty(e, "channelInterpretation", {
|
|
2970
|
+
get: () => "discrete",
|
|
2971
|
+
set: (e) => {
|
|
2972
|
+
if (e !== "discrete") throw B();
|
|
2973
|
+
}
|
|
2974
|
+
});
|
|
2975
|
+
}, pi = (e, t) => {
|
|
2976
|
+
let n = e.createChannelSplitter(t.numberOfOutputs);
|
|
2977
|
+
return H(n, t), fi(n), n;
|
|
2978
|
+
}, mi = (e, t, n, r, i) => (a, o) => {
|
|
2979
|
+
if (a.createConstantSource === void 0) return n(a, o);
|
|
2980
|
+
let s = a.createConstantSource();
|
|
2981
|
+
return H(s, o), U(s, o, "offset"), t(r, () => r(a)) || ri(s), t(i, () => i(a)) || ii(s), e(a, s), s;
|
|
2982
|
+
}, hi = (e, t) => (e.connect = t.connect.bind(t), e.disconnect = t.disconnect.bind(t), e), gi = (e, t, n, r) => (i, { offset: a, ...o }) => {
|
|
2983
|
+
let s = i.createBuffer(1, 2, 44100), c = t(i, {
|
|
2984
|
+
buffer: null,
|
|
2985
|
+
channelCount: 2,
|
|
2986
|
+
channelCountMode: "max",
|
|
2987
|
+
channelInterpretation: "speakers",
|
|
2988
|
+
loop: !1,
|
|
2989
|
+
loopEnd: 0,
|
|
2990
|
+
loopStart: 0,
|
|
2991
|
+
playbackRate: 1
|
|
2992
|
+
}), l = n(i, {
|
|
2993
|
+
...o,
|
|
2994
|
+
gain: a
|
|
2995
|
+
}), u = s.getChannelData(0);
|
|
2996
|
+
return u[0] = 1, u[1] = 1, c.buffer = s, c.loop = !0, e(i, c), r(hi({
|
|
2997
|
+
get bufferSize() {},
|
|
2998
|
+
get channelCount() {
|
|
2999
|
+
return l.channelCount;
|
|
3000
|
+
},
|
|
3001
|
+
set channelCount(e) {
|
|
3002
|
+
l.channelCount = e;
|
|
3003
|
+
},
|
|
3004
|
+
get channelCountMode() {
|
|
3005
|
+
return l.channelCountMode;
|
|
3006
|
+
},
|
|
3007
|
+
set channelCountMode(e) {
|
|
3008
|
+
l.channelCountMode = e;
|
|
3009
|
+
},
|
|
3010
|
+
get channelInterpretation() {
|
|
3011
|
+
return l.channelInterpretation;
|
|
3012
|
+
},
|
|
3013
|
+
set channelInterpretation(e) {
|
|
3014
|
+
l.channelInterpretation = e;
|
|
3015
|
+
},
|
|
3016
|
+
get context() {
|
|
3017
|
+
return l.context;
|
|
3018
|
+
},
|
|
3019
|
+
get inputs() {
|
|
3020
|
+
return [];
|
|
3021
|
+
},
|
|
3022
|
+
get numberOfInputs() {
|
|
3023
|
+
return c.numberOfInputs;
|
|
3024
|
+
},
|
|
3025
|
+
get numberOfOutputs() {
|
|
3026
|
+
return l.numberOfOutputs;
|
|
3027
|
+
},
|
|
3028
|
+
get offset() {
|
|
3029
|
+
return l.gain;
|
|
3030
|
+
},
|
|
3031
|
+
get onended() {
|
|
3032
|
+
return c.onended;
|
|
3033
|
+
},
|
|
3034
|
+
set onended(e) {
|
|
3035
|
+
c.onended = e;
|
|
3036
|
+
},
|
|
3037
|
+
addEventListener(...e) {
|
|
3038
|
+
return c.addEventListener(e[0], e[1], e[2]);
|
|
3039
|
+
},
|
|
3040
|
+
dispatchEvent(...e) {
|
|
3041
|
+
return c.dispatchEvent(e[0]);
|
|
3042
|
+
},
|
|
3043
|
+
removeEventListener(...e) {
|
|
3044
|
+
return c.removeEventListener(e[0], e[1], e[2]);
|
|
3045
|
+
},
|
|
3046
|
+
start(e = 0) {
|
|
3047
|
+
c.start.call(c, e);
|
|
3048
|
+
},
|
|
3049
|
+
stop(e = 0) {
|
|
3050
|
+
c.stop.call(c, e);
|
|
3051
|
+
}
|
|
3052
|
+
}, l), () => c.connect(l), () => c.disconnect(l));
|
|
3053
|
+
}, _i = (e, t) => (n, r) => {
|
|
3054
|
+
let i = n.createConvolver();
|
|
3055
|
+
if (H(i, r), r.disableNormalization === i.normalize && (i.normalize = !r.disableNormalization), V(i, r, "buffer"), r.channelCount > 2 || (t(i, "channelCount", (e) => () => e.call(i), (t) => (n) => {
|
|
3056
|
+
if (n > 2) throw e();
|
|
3057
|
+
return t.call(i, n);
|
|
3058
|
+
}), r.channelCountMode === "max")) throw e();
|
|
3059
|
+
return t(i, "channelCountMode", (e) => () => e.call(i), (t) => (n) => {
|
|
3060
|
+
if (n === "max") throw e();
|
|
3061
|
+
return t.call(i, n);
|
|
3062
|
+
}), i;
|
|
3063
|
+
}, vi = (e, t) => {
|
|
3064
|
+
let n = e.createDelay(t.maxDelayTime);
|
|
3065
|
+
return H(n, t), U(n, t, "delayTime"), n;
|
|
3066
|
+
}, yi = (e) => (t, n) => {
|
|
3067
|
+
let r = t.createDynamicsCompressor();
|
|
3068
|
+
if (H(r, n), n.channelCount > 2 || n.channelCountMode === "max") throw e();
|
|
3069
|
+
return U(r, n, "attack"), U(r, n, "knee"), U(r, n, "ratio"), U(r, n, "release"), U(r, n, "threshold"), r;
|
|
3070
|
+
}, W = (e, t) => {
|
|
3071
|
+
let n = e.createGain();
|
|
3072
|
+
return H(n, t), U(n, t, "gain"), n;
|
|
3073
|
+
}, bi = (e) => (t, n, r) => {
|
|
3074
|
+
if (t.createIIRFilter === void 0) return e(t, n, r);
|
|
3075
|
+
let i = t.createIIRFilter(r.feedforward, r.feedback);
|
|
3076
|
+
return H(i, r), i;
|
|
3077
|
+
};
|
|
3078
|
+
//#endregion
|
|
3079
|
+
//#region node_modules/standardized-audio-context/build/es2019/factories/native-iir-filter-node-faker-factory.js
|
|
3080
|
+
function xi(e, t) {
|
|
3081
|
+
let n = t[0] * t[0] + t[1] * t[1];
|
|
3082
|
+
return [(e[0] * t[0] + e[1] * t[1]) / n, (e[1] * t[0] - e[0] * t[1]) / n];
|
|
3083
|
+
}
|
|
3084
|
+
function Si(e, t) {
|
|
3085
|
+
return [e[0] * t[0] - e[1] * t[1], e[0] * t[1] + e[1] * t[0]];
|
|
3086
|
+
}
|
|
3087
|
+
function Ci(e, t) {
|
|
3088
|
+
let n = [0, 0];
|
|
3089
|
+
for (let r = e.length - 1; r >= 0; --r) n = Si(n, t), n[0] += e[r];
|
|
3090
|
+
return n;
|
|
3091
|
+
}
|
|
3092
|
+
var wi = (e, t, n, r) => (i, a, { channelCount: o, channelCountMode: s, channelInterpretation: c, feedback: l, feedforward: u }) => {
|
|
3093
|
+
let d = li(a, i.sampleRate), f = l instanceof Float64Array ? l : new Float64Array(l), p = u instanceof Float64Array ? u : new Float64Array(u), m = f.length, h = p.length, g = Math.min(m, h);
|
|
3094
|
+
if (m === 0 || m > 20) throw r();
|
|
3095
|
+
if (f[0] === 0) throw t();
|
|
3096
|
+
if (h === 0 || h > 20) throw r();
|
|
3097
|
+
if (p[0] === 0) throw t();
|
|
3098
|
+
if (f[0] !== 1) {
|
|
3099
|
+
for (let e = 0; e < h; e += 1) p[e] /= f[0];
|
|
3100
|
+
for (let e = 1; e < m; e += 1) f[e] /= f[0];
|
|
3101
|
+
}
|
|
3102
|
+
let _ = n(i, d, o, o);
|
|
3103
|
+
_.channelCount = o, _.channelCountMode = s, _.channelInterpretation = c;
|
|
3104
|
+
let v = [], y = [], b = [];
|
|
3105
|
+
for (let e = 0; e < o; e += 1) {
|
|
3106
|
+
v.push(0);
|
|
3107
|
+
let e = new Float32Array(32), t = new Float32Array(32);
|
|
3108
|
+
e.fill(0), t.fill(0), y.push(e), b.push(t);
|
|
3109
|
+
}
|
|
3110
|
+
_.onaudioprocess = (e) => {
|
|
3111
|
+
let t = e.inputBuffer, n = e.outputBuffer, r = t.numberOfChannels;
|
|
3112
|
+
for (let e = 0; e < r; e += 1) {
|
|
3113
|
+
let r = t.getChannelData(e), i = n.getChannelData(e);
|
|
3114
|
+
v[e] = Pr(f, m, p, h, g, y[e], b[e], v[e], 32, r, i);
|
|
3115
|
+
}
|
|
3116
|
+
};
|
|
3117
|
+
let x = i.sampleRate / 2;
|
|
3118
|
+
return hi({
|
|
3119
|
+
get bufferSize() {
|
|
3120
|
+
return d;
|
|
3121
|
+
},
|
|
3122
|
+
get channelCount() {
|
|
3123
|
+
return _.channelCount;
|
|
3124
|
+
},
|
|
3125
|
+
set channelCount(e) {
|
|
3126
|
+
_.channelCount = e;
|
|
3127
|
+
},
|
|
3128
|
+
get channelCountMode() {
|
|
3129
|
+
return _.channelCountMode;
|
|
3130
|
+
},
|
|
3131
|
+
set channelCountMode(e) {
|
|
3132
|
+
_.channelCountMode = e;
|
|
3133
|
+
},
|
|
3134
|
+
get channelInterpretation() {
|
|
3135
|
+
return _.channelInterpretation;
|
|
3136
|
+
},
|
|
3137
|
+
set channelInterpretation(e) {
|
|
3138
|
+
_.channelInterpretation = e;
|
|
3139
|
+
},
|
|
3140
|
+
get context() {
|
|
3141
|
+
return _.context;
|
|
3142
|
+
},
|
|
3143
|
+
get inputs() {
|
|
3144
|
+
return [_];
|
|
3145
|
+
},
|
|
3146
|
+
get numberOfInputs() {
|
|
3147
|
+
return _.numberOfInputs;
|
|
3148
|
+
},
|
|
3149
|
+
get numberOfOutputs() {
|
|
3150
|
+
return _.numberOfOutputs;
|
|
3151
|
+
},
|
|
3152
|
+
addEventListener(...e) {
|
|
3153
|
+
return _.addEventListener(e[0], e[1], e[2]);
|
|
3154
|
+
},
|
|
3155
|
+
dispatchEvent(...e) {
|
|
3156
|
+
return _.dispatchEvent(e[0]);
|
|
3157
|
+
},
|
|
3158
|
+
getFrequencyResponse(t, n, r) {
|
|
3159
|
+
if (t.length !== n.length || n.length !== r.length) throw e();
|
|
3160
|
+
let i = t.length;
|
|
3161
|
+
for (let e = 0; e < i; e += 1) {
|
|
3162
|
+
let i = -Math.PI * (t[e] / x), a = [Math.cos(i), Math.sin(i)], o = xi(Ci(p, a), Ci(f, a));
|
|
3163
|
+
n[e] = Math.sqrt(o[0] * o[0] + o[1] * o[1]), r[e] = Math.atan2(o[1], o[0]);
|
|
3164
|
+
}
|
|
3165
|
+
},
|
|
3166
|
+
removeEventListener(...e) {
|
|
3167
|
+
return _.removeEventListener(e[0], e[1], e[2]);
|
|
3168
|
+
}
|
|
3169
|
+
}, _);
|
|
3170
|
+
}, Ti = (e, t) => e.createMediaElementSource(t.mediaElement), Ei = (e, t) => {
|
|
3171
|
+
let n = e.createMediaStreamDestination();
|
|
3172
|
+
return H(n, t), n.numberOfOutputs === 1 && Object.defineProperty(n, "numberOfOutputs", { get: () => 0 }), n;
|
|
3173
|
+
}, Di = (e, { mediaStream: t }) => {
|
|
3174
|
+
let n = t.getAudioTracks();
|
|
3175
|
+
n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id));
|
|
3176
|
+
let r = n.slice(0, 1), i = e.createMediaStreamSource(new MediaStream(r));
|
|
3177
|
+
return Object.defineProperty(i, "mediaStream", { value: t }), i;
|
|
3178
|
+
}, Oi = (e, t) => (n, { mediaStreamTrack: r }) => {
|
|
3179
|
+
if (typeof n.createMediaStreamTrackSource == "function") return n.createMediaStreamTrackSource(r);
|
|
3180
|
+
let i = new MediaStream([r]), a = n.createMediaStreamSource(i);
|
|
3181
|
+
if (r.kind !== "audio") throw e();
|
|
3182
|
+
if (t(n)) throw TypeError();
|
|
3183
|
+
return a;
|
|
3184
|
+
}, ki = (e) => e === null ? null : e.hasOwnProperty("OfflineAudioContext") ? e.OfflineAudioContext : e.hasOwnProperty("webkitOfflineAudioContext") ? e.webkitOfflineAudioContext : null, Ai = (e, t, n, r, i, a) => (o, s) => {
|
|
3185
|
+
let c = o.createOscillator();
|
|
3186
|
+
return H(c, s), U(c, s, "detune"), U(c, s, "frequency"), s.periodicWave === void 0 ? V(c, s, "type") : c.setPeriodicWave(s.periodicWave), t(n, () => n(o)) || ri(c), t(r, () => r(o)) || a(c, o), t(i, () => i(o)) || ii(c), e(o, c), c;
|
|
3187
|
+
}, ji = (e) => (t, n) => {
|
|
3188
|
+
let r = t.createPanner();
|
|
3189
|
+
return r.orientationX === void 0 ? e(t, n) : (H(r, n), U(r, n, "orientationX"), U(r, n, "orientationY"), U(r, n, "orientationZ"), U(r, n, "positionX"), U(r, n, "positionY"), U(r, n, "positionZ"), V(r, n, "coneInnerAngle"), V(r, n, "coneOuterAngle"), V(r, n, "coneOuterGain"), V(r, n, "distanceModel"), V(r, n, "maxDistance"), V(r, n, "panningModel"), V(r, n, "refDistance"), V(r, n, "rolloffFactor"), r);
|
|
3190
|
+
}, Mi = (e, t, n, r, i, a, o, s, c, l) => (u, { coneInnerAngle: d, coneOuterAngle: f, coneOuterGain: p, distanceModel: m, maxDistance: h, orientationX: g, orientationY: _, orientationZ: v, panningModel: y, positionX: b, positionY: x, positionZ: S, refDistance: C, rolloffFactor: w, ...T }) => {
|
|
3191
|
+
let E = u.createPanner();
|
|
3192
|
+
if (T.channelCount > 2 || T.channelCountMode === "max") throw o();
|
|
3193
|
+
H(E, T);
|
|
3194
|
+
let D = {
|
|
3195
|
+
channelCount: 1,
|
|
3196
|
+
channelCountMode: "explicit",
|
|
3197
|
+
channelInterpretation: "discrete"
|
|
3198
|
+
}, O = n(u, {
|
|
3199
|
+
...D,
|
|
3200
|
+
channelInterpretation: "speakers",
|
|
3201
|
+
numberOfInputs: 6
|
|
3202
|
+
}), k = r(u, {
|
|
3203
|
+
...T,
|
|
3204
|
+
gain: 1
|
|
3205
|
+
}), A = r(u, {
|
|
3206
|
+
...D,
|
|
3207
|
+
gain: 1
|
|
3208
|
+
}), j = r(u, {
|
|
3209
|
+
...D,
|
|
3210
|
+
gain: 0
|
|
3211
|
+
}), M = r(u, {
|
|
3212
|
+
...D,
|
|
3213
|
+
gain: 0
|
|
3214
|
+
}), ee = r(u, {
|
|
3215
|
+
...D,
|
|
3216
|
+
gain: 0
|
|
3217
|
+
}), te = r(u, {
|
|
3218
|
+
...D,
|
|
3219
|
+
gain: 0
|
|
3220
|
+
}), ne = r(u, {
|
|
3221
|
+
...D,
|
|
3222
|
+
gain: 0
|
|
3223
|
+
}), re = i(u, 256, 6, 1), N = a(u, {
|
|
3224
|
+
...D,
|
|
3225
|
+
curve: new Float32Array([1, 1]),
|
|
3226
|
+
oversample: "none"
|
|
3227
|
+
}), ie = [
|
|
3228
|
+
g,
|
|
3229
|
+
_,
|
|
3230
|
+
v
|
|
3231
|
+
], ae = [
|
|
3232
|
+
b,
|
|
3233
|
+
x,
|
|
3234
|
+
S
|
|
3235
|
+
], oe = new Float32Array(1);
|
|
3236
|
+
re.onaudioprocess = ({ inputBuffer: e }) => {
|
|
3237
|
+
let t = [
|
|
3238
|
+
c(e, oe, 0),
|
|
3239
|
+
c(e, oe, 1),
|
|
3240
|
+
c(e, oe, 2)
|
|
3241
|
+
];
|
|
3242
|
+
t.some((e, t) => e !== ie[t]) && (E.setOrientation(...t), ie = t);
|
|
3243
|
+
let n = [
|
|
3244
|
+
c(e, oe, 3),
|
|
3245
|
+
c(e, oe, 4),
|
|
3246
|
+
c(e, oe, 5)
|
|
3247
|
+
];
|
|
3248
|
+
n.some((e, t) => e !== ae[t]) && (E.setPosition(...n), ae = n);
|
|
3249
|
+
}, Object.defineProperty(j.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(M.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(ee.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(te.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(ne.gain, "defaultValue", { get: () => 0 });
|
|
3250
|
+
let P = {
|
|
3251
|
+
get bufferSize() {},
|
|
3252
|
+
get channelCount() {
|
|
3253
|
+
return E.channelCount;
|
|
3254
|
+
},
|
|
3255
|
+
set channelCount(e) {
|
|
3256
|
+
if (e > 2) throw o();
|
|
3257
|
+
k.channelCount = e, E.channelCount = e;
|
|
3258
|
+
},
|
|
3259
|
+
get channelCountMode() {
|
|
3260
|
+
return E.channelCountMode;
|
|
3261
|
+
},
|
|
3262
|
+
set channelCountMode(e) {
|
|
3263
|
+
if (e === "max") throw o();
|
|
3264
|
+
k.channelCountMode = e, E.channelCountMode = e;
|
|
3265
|
+
},
|
|
3266
|
+
get channelInterpretation() {
|
|
3267
|
+
return E.channelInterpretation;
|
|
3268
|
+
},
|
|
3269
|
+
set channelInterpretation(e) {
|
|
3270
|
+
k.channelInterpretation = e, E.channelInterpretation = e;
|
|
3271
|
+
},
|
|
3272
|
+
get coneInnerAngle() {
|
|
3273
|
+
return E.coneInnerAngle;
|
|
3274
|
+
},
|
|
3275
|
+
set coneInnerAngle(e) {
|
|
3276
|
+
E.coneInnerAngle = e;
|
|
3277
|
+
},
|
|
3278
|
+
get coneOuterAngle() {
|
|
3279
|
+
return E.coneOuterAngle;
|
|
3280
|
+
},
|
|
3281
|
+
set coneOuterAngle(e) {
|
|
3282
|
+
E.coneOuterAngle = e;
|
|
3283
|
+
},
|
|
3284
|
+
get coneOuterGain() {
|
|
3285
|
+
return E.coneOuterGain;
|
|
3286
|
+
},
|
|
3287
|
+
set coneOuterGain(e) {
|
|
3288
|
+
if (e < 0 || e > 1) throw t();
|
|
3289
|
+
E.coneOuterGain = e;
|
|
3290
|
+
},
|
|
3291
|
+
get context() {
|
|
3292
|
+
return E.context;
|
|
3293
|
+
},
|
|
3294
|
+
get distanceModel() {
|
|
3295
|
+
return E.distanceModel;
|
|
3296
|
+
},
|
|
3297
|
+
set distanceModel(e) {
|
|
3298
|
+
E.distanceModel = e;
|
|
3299
|
+
},
|
|
3300
|
+
get inputs() {
|
|
3301
|
+
return [k];
|
|
3302
|
+
},
|
|
3303
|
+
get maxDistance() {
|
|
3304
|
+
return E.maxDistance;
|
|
3305
|
+
},
|
|
3306
|
+
set maxDistance(e) {
|
|
3307
|
+
if (e < 0) throw RangeError();
|
|
3308
|
+
E.maxDistance = e;
|
|
3309
|
+
},
|
|
3310
|
+
get numberOfInputs() {
|
|
3311
|
+
return E.numberOfInputs;
|
|
3312
|
+
},
|
|
3313
|
+
get numberOfOutputs() {
|
|
3314
|
+
return E.numberOfOutputs;
|
|
3315
|
+
},
|
|
3316
|
+
get orientationX() {
|
|
3317
|
+
return A.gain;
|
|
3318
|
+
},
|
|
3319
|
+
get orientationY() {
|
|
3320
|
+
return j.gain;
|
|
3321
|
+
},
|
|
3322
|
+
get orientationZ() {
|
|
3323
|
+
return M.gain;
|
|
3324
|
+
},
|
|
3325
|
+
get panningModel() {
|
|
3326
|
+
return E.panningModel;
|
|
3327
|
+
},
|
|
3328
|
+
set panningModel(e) {
|
|
3329
|
+
E.panningModel = e;
|
|
3330
|
+
},
|
|
3331
|
+
get positionX() {
|
|
3332
|
+
return ee.gain;
|
|
3333
|
+
},
|
|
3334
|
+
get positionY() {
|
|
3335
|
+
return te.gain;
|
|
3336
|
+
},
|
|
3337
|
+
get positionZ() {
|
|
3338
|
+
return ne.gain;
|
|
3339
|
+
},
|
|
3340
|
+
get refDistance() {
|
|
3341
|
+
return E.refDistance;
|
|
3342
|
+
},
|
|
3343
|
+
set refDistance(e) {
|
|
3344
|
+
if (e < 0) throw RangeError();
|
|
3345
|
+
E.refDistance = e;
|
|
3346
|
+
},
|
|
3347
|
+
get rolloffFactor() {
|
|
3348
|
+
return E.rolloffFactor;
|
|
3349
|
+
},
|
|
3350
|
+
set rolloffFactor(e) {
|
|
3351
|
+
if (e < 0) throw RangeError();
|
|
3352
|
+
E.rolloffFactor = e;
|
|
3353
|
+
},
|
|
3354
|
+
addEventListener(...e) {
|
|
3355
|
+
return k.addEventListener(e[0], e[1], e[2]);
|
|
3356
|
+
},
|
|
3357
|
+
dispatchEvent(...e) {
|
|
3358
|
+
return k.dispatchEvent(e[0]);
|
|
3359
|
+
},
|
|
3360
|
+
removeEventListener(...e) {
|
|
3361
|
+
return k.removeEventListener(e[0], e[1], e[2]);
|
|
3362
|
+
}
|
|
3363
|
+
};
|
|
3364
|
+
return d !== P.coneInnerAngle && (P.coneInnerAngle = d), f !== P.coneOuterAngle && (P.coneOuterAngle = f), p !== P.coneOuterGain && (P.coneOuterGain = p), m !== P.distanceModel && (P.distanceModel = m), h !== P.maxDistance && (P.maxDistance = h), g !== P.orientationX.value && (P.orientationX.value = g), _ !== P.orientationY.value && (P.orientationY.value = _), v !== P.orientationZ.value && (P.orientationZ.value = v), y !== P.panningModel && (P.panningModel = y), b !== P.positionX.value && (P.positionX.value = b), x !== P.positionY.value && (P.positionY.value = x), S !== P.positionZ.value && (P.positionZ.value = S), C !== P.refDistance && (P.refDistance = C), w !== P.rolloffFactor && (P.rolloffFactor = w), (ie[0] !== 1 || ie[1] !== 0 || ie[2] !== 0) && E.setOrientation(...ie), (ae[0] !== 0 || ae[1] !== 0 || ae[2] !== 0) && E.setPosition(...ae), l(hi(P, E), () => {
|
|
3365
|
+
k.connect(E), e(k, N, 0, 0), N.connect(A).connect(O, 0, 0), N.connect(j).connect(O, 0, 1), N.connect(M).connect(O, 0, 2), N.connect(ee).connect(O, 0, 3), N.connect(te).connect(O, 0, 4), N.connect(ne).connect(O, 0, 5), O.connect(re).connect(u.destination);
|
|
3366
|
+
}, () => {
|
|
3367
|
+
k.disconnect(E), s(k, N, 0, 0), N.disconnect(A), A.disconnect(O), N.disconnect(j), j.disconnect(O), N.disconnect(M), M.disconnect(O), N.disconnect(ee), ee.disconnect(O), N.disconnect(te), te.disconnect(O), N.disconnect(ne), ne.disconnect(O), O.disconnect(re), re.disconnect(u.destination);
|
|
3368
|
+
});
|
|
3369
|
+
}, Ni = (e) => (t, { disableNormalization: n, imag: r, real: i }) => {
|
|
3370
|
+
let a = r instanceof Float32Array ? r : new Float32Array(r), o = i instanceof Float32Array ? i : new Float32Array(i), s = t.createPeriodicWave(o, a, { disableNormalization: n });
|
|
3371
|
+
if (Array.from(r).length < 2) throw e();
|
|
3372
|
+
return s;
|
|
3373
|
+
}, Pi = (e, t, n, r) => e.createScriptProcessor(t, n, r), Fi = (e, t) => (n, r) => {
|
|
3374
|
+
let i = r.channelCountMode;
|
|
3375
|
+
if (i === "clamped-max") throw t();
|
|
3376
|
+
if (n.createStereoPanner === void 0) return e(n, r);
|
|
3377
|
+
let a = n.createStereoPanner();
|
|
3378
|
+
return H(a, r), U(a, r, "pan"), Object.defineProperty(a, "channelCountMode", {
|
|
3379
|
+
get: () => i,
|
|
3380
|
+
set: (e) => {
|
|
3381
|
+
if (e !== i) throw t();
|
|
3382
|
+
}
|
|
3383
|
+
}), a;
|
|
3384
|
+
}, Ii = (e, t, n, r, i, a) => {
|
|
3385
|
+
let o = 16385, s = new Float32Array([1, 1]), c = Math.PI / 2, l = {
|
|
3386
|
+
channelCount: 1,
|
|
3387
|
+
channelCountMode: "explicit",
|
|
3388
|
+
channelInterpretation: "discrete"
|
|
3389
|
+
}, u = {
|
|
3390
|
+
...l,
|
|
3391
|
+
oversample: "none"
|
|
3392
|
+
}, d = (e, t, i, a) => {
|
|
3393
|
+
let d = new Float32Array(o), f = new Float32Array(o);
|
|
3394
|
+
for (let e = 0; e < o; e += 1) {
|
|
3395
|
+
let t = e / (o - 1) * c;
|
|
3396
|
+
d[e] = Math.cos(t), f[e] = Math.sin(t);
|
|
3397
|
+
}
|
|
3398
|
+
let p = n(e, {
|
|
3399
|
+
...l,
|
|
3400
|
+
gain: 0
|
|
3401
|
+
}), m = r(e, {
|
|
3402
|
+
...u,
|
|
3403
|
+
curve: d
|
|
3404
|
+
}), h = r(e, {
|
|
3405
|
+
...u,
|
|
3406
|
+
curve: s
|
|
3407
|
+
}), g = n(e, {
|
|
3408
|
+
...l,
|
|
3409
|
+
gain: 0
|
|
3410
|
+
}), _ = r(e, {
|
|
3411
|
+
...u,
|
|
3412
|
+
curve: f
|
|
3413
|
+
});
|
|
3414
|
+
return {
|
|
3415
|
+
connectGraph() {
|
|
3416
|
+
t.connect(p), t.connect(h.inputs === void 0 ? h : h.inputs[0]), t.connect(g), h.connect(i), i.connect(m.inputs === void 0 ? m : m.inputs[0]), i.connect(_.inputs === void 0 ? _ : _.inputs[0]), m.connect(p.gain), _.connect(g.gain), p.connect(a, 0, 0), g.connect(a, 0, 1);
|
|
3417
|
+
},
|
|
3418
|
+
disconnectGraph() {
|
|
3419
|
+
t.disconnect(p), t.disconnect(h.inputs === void 0 ? h : h.inputs[0]), t.disconnect(g), h.disconnect(i), i.disconnect(m.inputs === void 0 ? m : m.inputs[0]), i.disconnect(_.inputs === void 0 ? _ : _.inputs[0]), m.disconnect(p.gain), _.disconnect(g.gain), p.disconnect(a, 0, 0), g.disconnect(a, 0, 1);
|
|
3420
|
+
}
|
|
3421
|
+
};
|
|
3422
|
+
}, f = (e, i, a, d) => {
|
|
3423
|
+
let f = new Float32Array(o), p = new Float32Array(o), m = new Float32Array(o), h = new Float32Array(o), g = Math.floor(o / 2);
|
|
3424
|
+
for (let e = 0; e < o; e += 1) if (e > g) {
|
|
3425
|
+
let t = (e - g) / (o - 1 - g) * c;
|
|
3426
|
+
f[e] = Math.cos(t), p[e] = Math.sin(t), m[e] = 0, h[e] = 1;
|
|
3427
|
+
} else {
|
|
3428
|
+
let t = e / (o - 1 - g) * c;
|
|
3429
|
+
f[e] = 1, p[e] = 0, m[e] = Math.cos(t), h[e] = Math.sin(t);
|
|
3430
|
+
}
|
|
3431
|
+
let _ = t(e, {
|
|
3432
|
+
channelCount: 2,
|
|
3433
|
+
channelCountMode: "explicit",
|
|
3434
|
+
channelInterpretation: "discrete",
|
|
3435
|
+
numberOfOutputs: 2
|
|
3436
|
+
}), v = n(e, {
|
|
3437
|
+
...l,
|
|
3438
|
+
gain: 0
|
|
3439
|
+
}), y = r(e, {
|
|
3440
|
+
...u,
|
|
3441
|
+
curve: f
|
|
3442
|
+
}), b = n(e, {
|
|
3443
|
+
...l,
|
|
3444
|
+
gain: 0
|
|
3445
|
+
}), x = r(e, {
|
|
3446
|
+
...u,
|
|
3447
|
+
curve: p
|
|
3448
|
+
}), S = r(e, {
|
|
3449
|
+
...u,
|
|
3450
|
+
curve: s
|
|
3451
|
+
}), C = n(e, {
|
|
3452
|
+
...l,
|
|
3453
|
+
gain: 0
|
|
3454
|
+
}), w = r(e, {
|
|
3455
|
+
...u,
|
|
3456
|
+
curve: m
|
|
3457
|
+
}), T = n(e, {
|
|
3458
|
+
...l,
|
|
3459
|
+
gain: 0
|
|
3460
|
+
}), E = r(e, {
|
|
3461
|
+
...u,
|
|
3462
|
+
curve: h
|
|
3463
|
+
});
|
|
3464
|
+
return {
|
|
3465
|
+
connectGraph() {
|
|
3466
|
+
i.connect(_), i.connect(S.inputs === void 0 ? S : S.inputs[0]), _.connect(v, 0), _.connect(b, 0), _.connect(C, 1), _.connect(T, 1), S.connect(a), a.connect(y.inputs === void 0 ? y : y.inputs[0]), a.connect(x.inputs === void 0 ? x : x.inputs[0]), a.connect(w.inputs === void 0 ? w : w.inputs[0]), a.connect(E.inputs === void 0 ? E : E.inputs[0]), y.connect(v.gain), x.connect(b.gain), w.connect(C.gain), E.connect(T.gain), v.connect(d, 0, 0), C.connect(d, 0, 0), b.connect(d, 0, 1), T.connect(d, 0, 1);
|
|
3467
|
+
},
|
|
3468
|
+
disconnectGraph() {
|
|
3469
|
+
i.disconnect(_), i.disconnect(S.inputs === void 0 ? S : S.inputs[0]), _.disconnect(v, 0), _.disconnect(b, 0), _.disconnect(C, 1), _.disconnect(T, 1), S.disconnect(a), a.disconnect(y.inputs === void 0 ? y : y.inputs[0]), a.disconnect(x.inputs === void 0 ? x : x.inputs[0]), a.disconnect(w.inputs === void 0 ? w : w.inputs[0]), a.disconnect(E.inputs === void 0 ? E : E.inputs[0]), y.disconnect(v.gain), x.disconnect(b.gain), w.disconnect(C.gain), E.disconnect(T.gain), v.disconnect(d, 0, 0), C.disconnect(d, 0, 0), b.disconnect(d, 0, 1), T.disconnect(d, 0, 1);
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
}, p = (e, t, n, r, a) => {
|
|
3473
|
+
if (t === 1) return d(e, n, r, a);
|
|
3474
|
+
if (t === 2) return f(e, n, r, a);
|
|
3475
|
+
throw i();
|
|
3476
|
+
};
|
|
3477
|
+
return (t, { channelCount: r, channelCountMode: o, pan: s, ...c }) => {
|
|
3478
|
+
if (o === "max") throw i();
|
|
3479
|
+
let l = e(t, {
|
|
3480
|
+
...c,
|
|
3481
|
+
channelCount: 1,
|
|
3482
|
+
channelCountMode: o,
|
|
3483
|
+
numberOfInputs: 2
|
|
3484
|
+
}), u = n(t, {
|
|
3485
|
+
...c,
|
|
3486
|
+
channelCount: r,
|
|
3487
|
+
channelCountMode: o,
|
|
3488
|
+
gain: 1
|
|
3489
|
+
}), d = n(t, {
|
|
3490
|
+
channelCount: 1,
|
|
3491
|
+
channelCountMode: "explicit",
|
|
3492
|
+
channelInterpretation: "discrete",
|
|
3493
|
+
gain: s
|
|
3494
|
+
}), { connectGraph: f, disconnectGraph: m } = p(t, r, u, d, l);
|
|
3495
|
+
Object.defineProperty(d.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(d.gain, "maxValue", { get: () => 1 }), Object.defineProperty(d.gain, "minValue", { get: () => -1 });
|
|
3496
|
+
let h = {
|
|
3497
|
+
get bufferSize() {},
|
|
3498
|
+
get channelCount() {
|
|
3499
|
+
return u.channelCount;
|
|
3500
|
+
},
|
|
3501
|
+
set channelCount(e) {
|
|
3502
|
+
u.channelCount !== e && (g && m(), {connectGraph: f, disconnectGraph: m} = p(t, e, u, d, l), g && f()), u.channelCount = e;
|
|
3503
|
+
},
|
|
3504
|
+
get channelCountMode() {
|
|
3505
|
+
return u.channelCountMode;
|
|
3506
|
+
},
|
|
3507
|
+
set channelCountMode(e) {
|
|
3508
|
+
if (e === "clamped-max" || e === "max") throw i();
|
|
3509
|
+
u.channelCountMode = e;
|
|
3510
|
+
},
|
|
3511
|
+
get channelInterpretation() {
|
|
3512
|
+
return u.channelInterpretation;
|
|
3513
|
+
},
|
|
3514
|
+
set channelInterpretation(e) {
|
|
3515
|
+
u.channelInterpretation = e;
|
|
3516
|
+
},
|
|
3517
|
+
get context() {
|
|
3518
|
+
return u.context;
|
|
3519
|
+
},
|
|
3520
|
+
get inputs() {
|
|
3521
|
+
return [u];
|
|
3522
|
+
},
|
|
3523
|
+
get numberOfInputs() {
|
|
3524
|
+
return u.numberOfInputs;
|
|
3525
|
+
},
|
|
3526
|
+
get numberOfOutputs() {
|
|
3527
|
+
return u.numberOfOutputs;
|
|
3528
|
+
},
|
|
3529
|
+
get pan() {
|
|
3530
|
+
return d.gain;
|
|
3531
|
+
},
|
|
3532
|
+
addEventListener(...e) {
|
|
3533
|
+
return u.addEventListener(e[0], e[1], e[2]);
|
|
3534
|
+
},
|
|
3535
|
+
dispatchEvent(...e) {
|
|
3536
|
+
return u.dispatchEvent(e[0]);
|
|
3537
|
+
},
|
|
3538
|
+
removeEventListener(...e) {
|
|
3539
|
+
return u.removeEventListener(e[0], e[1], e[2]);
|
|
3540
|
+
}
|
|
3541
|
+
}, g = !1;
|
|
3542
|
+
return a(hi(h, l), () => {
|
|
3543
|
+
f(), g = !0;
|
|
3544
|
+
}, () => {
|
|
3545
|
+
m(), g = !1;
|
|
3546
|
+
});
|
|
3547
|
+
};
|
|
3548
|
+
}, Li = (e, t, n, r, i, a, o) => (s, c) => {
|
|
3549
|
+
let l = s.createWaveShaper();
|
|
3550
|
+
if (a !== null && a.name === "webkitAudioContext" && s.createGain().gain.automationRate === void 0) return n(s, c);
|
|
3551
|
+
H(l, c);
|
|
3552
|
+
let u = c.curve === null || c.curve instanceof Float32Array ? c.curve : new Float32Array(c.curve);
|
|
3553
|
+
if (u !== null && u.length < 2) throw t();
|
|
3554
|
+
V(l, { curve: u }, "curve"), V(l, c, "oversample");
|
|
3555
|
+
let d = null, f = !1;
|
|
3556
|
+
return o(l, "curve", (e) => () => e.call(l), (t) => (n) => (t.call(l, n), f && (r(n) && d === null ? d = e(s, l) : !r(n) && d !== null && (d(), d = null)), n)), i(l, () => {
|
|
3557
|
+
f = !0, r(l.curve) && (d = e(s, l));
|
|
3558
|
+
}, () => {
|
|
3559
|
+
f = !1, d !== null && (d(), d = null);
|
|
3560
|
+
});
|
|
3561
|
+
}, Ri = (e, t, n, r, i) => (a, { curve: o, oversample: s, ...c }) => {
|
|
3562
|
+
let l = a.createWaveShaper(), u = a.createWaveShaper();
|
|
3563
|
+
H(l, c), H(u, c);
|
|
3564
|
+
let d = n(a, {
|
|
3565
|
+
...c,
|
|
3566
|
+
gain: 1
|
|
3567
|
+
}), f = n(a, {
|
|
3568
|
+
...c,
|
|
3569
|
+
gain: -1
|
|
3570
|
+
}), p = n(a, {
|
|
3571
|
+
...c,
|
|
3572
|
+
gain: 1
|
|
3573
|
+
}), m = n(a, {
|
|
3574
|
+
...c,
|
|
3575
|
+
gain: -1
|
|
3576
|
+
}), h = null, g = !1, _ = null, v = {
|
|
3577
|
+
get bufferSize() {},
|
|
3578
|
+
get channelCount() {
|
|
3579
|
+
return l.channelCount;
|
|
3580
|
+
},
|
|
3581
|
+
set channelCount(e) {
|
|
3582
|
+
d.channelCount = e, f.channelCount = e, l.channelCount = e, p.channelCount = e, u.channelCount = e, m.channelCount = e;
|
|
3583
|
+
},
|
|
3584
|
+
get channelCountMode() {
|
|
3585
|
+
return l.channelCountMode;
|
|
3586
|
+
},
|
|
3587
|
+
set channelCountMode(e) {
|
|
3588
|
+
d.channelCountMode = e, f.channelCountMode = e, l.channelCountMode = e, p.channelCountMode = e, u.channelCountMode = e, m.channelCountMode = e;
|
|
3589
|
+
},
|
|
3590
|
+
get channelInterpretation() {
|
|
3591
|
+
return l.channelInterpretation;
|
|
3592
|
+
},
|
|
3593
|
+
set channelInterpretation(e) {
|
|
3594
|
+
d.channelInterpretation = e, f.channelInterpretation = e, l.channelInterpretation = e, p.channelInterpretation = e, u.channelInterpretation = e, m.channelInterpretation = e;
|
|
3595
|
+
},
|
|
3596
|
+
get context() {
|
|
3597
|
+
return l.context;
|
|
3598
|
+
},
|
|
3599
|
+
get curve() {
|
|
3600
|
+
return _;
|
|
3601
|
+
},
|
|
3602
|
+
set curve(n) {
|
|
3603
|
+
if (n !== null && n.length < 2) throw t();
|
|
3604
|
+
if (n === null) l.curve = n, u.curve = n;
|
|
3605
|
+
else {
|
|
3606
|
+
let e = n.length, t = new Float32Array(e + 2 - e % 2), r = new Float32Array(e + 2 - e % 2);
|
|
3607
|
+
t[0] = n[0], r[0] = -n[e - 1];
|
|
3608
|
+
let i = Math.ceil((e + 1) / 2), a = (e + 1) / 2 - 1;
|
|
3609
|
+
for (let o = 1; o < i; o += 1) {
|
|
3610
|
+
let s = o / i * a, c = Math.floor(s), l = Math.ceil(s);
|
|
3611
|
+
t[o] = c === l ? n[c] : (1 - (s - c)) * n[c] + (1 - (l - s)) * n[l], r[o] = c === l ? -n[e - 1 - c] : -((1 - (s - c)) * n[e - 1 - c]) - (1 - (l - s)) * n[e - 1 - l];
|
|
3612
|
+
}
|
|
3613
|
+
t[i] = e % 2 == 1 ? n[i - 1] : (n[i - 2] + n[i - 1]) / 2, l.curve = t, u.curve = r;
|
|
3614
|
+
}
|
|
3615
|
+
_ = n, g && (r(_) && h === null ? h = e(a, d) : h !== null && (h(), h = null));
|
|
3616
|
+
},
|
|
3617
|
+
get inputs() {
|
|
3618
|
+
return [d];
|
|
3619
|
+
},
|
|
3620
|
+
get numberOfInputs() {
|
|
3621
|
+
return l.numberOfInputs;
|
|
3622
|
+
},
|
|
3623
|
+
get numberOfOutputs() {
|
|
3624
|
+
return l.numberOfOutputs;
|
|
3625
|
+
},
|
|
3626
|
+
get oversample() {
|
|
3627
|
+
return l.oversample;
|
|
3628
|
+
},
|
|
3629
|
+
set oversample(e) {
|
|
3630
|
+
l.oversample = e, u.oversample = e;
|
|
3631
|
+
},
|
|
3632
|
+
addEventListener(...e) {
|
|
3633
|
+
return d.addEventListener(e[0], e[1], e[2]);
|
|
3634
|
+
},
|
|
3635
|
+
dispatchEvent(...e) {
|
|
3636
|
+
return d.dispatchEvent(e[0]);
|
|
3637
|
+
},
|
|
3638
|
+
removeEventListener(...e) {
|
|
3639
|
+
return d.removeEventListener(e[0], e[1], e[2]);
|
|
3640
|
+
}
|
|
3641
|
+
};
|
|
3642
|
+
return o !== null && (v.curve = o instanceof Float32Array ? o : new Float32Array(o)), s !== v.oversample && (v.oversample = s), i(hi(v, p), () => {
|
|
3643
|
+
d.connect(l).connect(p), d.connect(f).connect(u).connect(m).connect(p), g = !0, r(_) && (h = e(a, d));
|
|
3644
|
+
}, () => {
|
|
3645
|
+
d.disconnect(l), l.disconnect(p), d.disconnect(f), f.disconnect(u), u.disconnect(m), m.disconnect(p), g = !1, h !== null && (h(), h = null);
|
|
3646
|
+
});
|
|
3647
|
+
}, G = () => new DOMException("", "NotSupportedError"), zi = {
|
|
3648
|
+
channelCount: 2,
|
|
3649
|
+
channelCountMode: "max",
|
|
3650
|
+
channelInterpretation: "speakers",
|
|
3651
|
+
detune: 0,
|
|
3652
|
+
frequency: 440,
|
|
3653
|
+
periodicWave: void 0,
|
|
3654
|
+
type: "sine"
|
|
3655
|
+
}, Bi = (e, t, n, r, i, a, o) => class extends e {
|
|
3656
|
+
constructor(e, o) {
|
|
3657
|
+
let s = i(e), c = {
|
|
3658
|
+
...zi,
|
|
3659
|
+
...o
|
|
3660
|
+
}, l = n(s, c), u = a(s), d = u ? r() : null, f = e.sampleRate / 2;
|
|
3661
|
+
super(e, !1, l, d), this._detune = t(this, u, l.detune, 153600, -153600), this._frequency = t(this, u, l.frequency, f, -f), this._nativeOscillatorNode = l, this._onended = null, this._oscillatorNodeRenderer = d, this._oscillatorNodeRenderer !== null && c.periodicWave !== void 0 && (this._oscillatorNodeRenderer.periodicWave = c.periodicWave);
|
|
3662
|
+
}
|
|
3663
|
+
get detune() {
|
|
3664
|
+
return this._detune;
|
|
3665
|
+
}
|
|
3666
|
+
get frequency() {
|
|
3667
|
+
return this._frequency;
|
|
3668
|
+
}
|
|
3669
|
+
get onended() {
|
|
3670
|
+
return this._onended;
|
|
3671
|
+
}
|
|
3672
|
+
set onended(e) {
|
|
3673
|
+
let t = typeof e == "function" ? o(this, e) : null;
|
|
3674
|
+
this._nativeOscillatorNode.onended = t;
|
|
3675
|
+
let n = this._nativeOscillatorNode.onended;
|
|
3676
|
+
this._onended = n !== null && n === t ? e : n;
|
|
3677
|
+
}
|
|
3678
|
+
get type() {
|
|
3679
|
+
return this._nativeOscillatorNode.type;
|
|
3680
|
+
}
|
|
3681
|
+
set type(e) {
|
|
3682
|
+
this._nativeOscillatorNode.type = e, this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.periodicWave = null);
|
|
3683
|
+
}
|
|
3684
|
+
setPeriodicWave(e) {
|
|
3685
|
+
this._nativeOscillatorNode.setPeriodicWave(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.periodicWave = e);
|
|
3686
|
+
}
|
|
3687
|
+
start(e = 0) {
|
|
3688
|
+
if (this._nativeOscillatorNode.start(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.start = e), this.context.state !== "closed") {
|
|
3689
|
+
Ot(this);
|
|
3690
|
+
let e = () => {
|
|
3691
|
+
this._nativeOscillatorNode.removeEventListener("ended", e), Ut(this) && At(this);
|
|
3692
|
+
};
|
|
3693
|
+
this._nativeOscillatorNode.addEventListener("ended", e);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
stop(e = 0) {
|
|
3697
|
+
this._nativeOscillatorNode.stop(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.stop = e);
|
|
3698
|
+
}
|
|
3699
|
+
}, Vi = (e, t, n, r, i) => () => {
|
|
3700
|
+
let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = null, l = async (l, u) => {
|
|
3701
|
+
let d = n(l), f = F(d, u);
|
|
3702
|
+
return f || (d = t(u, {
|
|
3703
|
+
channelCount: d.channelCount,
|
|
3704
|
+
channelCountMode: d.channelCountMode,
|
|
3705
|
+
channelInterpretation: d.channelInterpretation,
|
|
3706
|
+
detune: d.detune.value,
|
|
3707
|
+
frequency: d.frequency.value,
|
|
3708
|
+
periodicWave: o === null ? void 0 : o,
|
|
3709
|
+
type: d.type
|
|
3710
|
+
}), s !== null && d.start(s), c !== null && d.stop(c)), a.set(u, d), f ? (await e(u, l.detune, d.detune), await e(u, l.frequency, d.frequency)) : (await r(u, l.detune, d.detune), await r(u, l.frequency, d.frequency)), await i(l, u, d), d;
|
|
3711
|
+
};
|
|
3712
|
+
return {
|
|
3713
|
+
set periodicWave(e) {
|
|
3714
|
+
o = e;
|
|
3715
|
+
},
|
|
3716
|
+
set start(e) {
|
|
3717
|
+
s = e;
|
|
3718
|
+
},
|
|
3719
|
+
set stop(e) {
|
|
3720
|
+
c = e;
|
|
3721
|
+
},
|
|
3722
|
+
render(e, t) {
|
|
3723
|
+
let n = a.get(t);
|
|
3724
|
+
return n === void 0 ? l(e, t) : Promise.resolve(n);
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
}, Hi = {
|
|
3728
|
+
channelCount: 2,
|
|
3729
|
+
channelCountMode: "clamped-max",
|
|
3730
|
+
channelInterpretation: "speakers",
|
|
3731
|
+
coneInnerAngle: 360,
|
|
3732
|
+
coneOuterAngle: 360,
|
|
3733
|
+
coneOuterGain: 0,
|
|
3734
|
+
distanceModel: "inverse",
|
|
3735
|
+
maxDistance: 1e4,
|
|
3736
|
+
orientationX: 1,
|
|
3737
|
+
orientationY: 0,
|
|
3738
|
+
orientationZ: 0,
|
|
3739
|
+
panningModel: "equalpower",
|
|
3740
|
+
positionX: 0,
|
|
3741
|
+
positionY: 0,
|
|
3742
|
+
positionZ: 0,
|
|
3743
|
+
refDistance: 1,
|
|
3744
|
+
rolloffFactor: 1
|
|
3745
|
+
}, Ui = (e, t, n, r, i, a, o) => class extends e {
|
|
3746
|
+
constructor(e, s) {
|
|
3747
|
+
let c = i(e), l = n(c, {
|
|
3748
|
+
...Hi,
|
|
3749
|
+
...s
|
|
3750
|
+
}), u = a(c), d = u ? r() : null;
|
|
3751
|
+
super(e, !1, l, d), this._nativePannerNode = l, this._orientationX = t(this, u, l.orientationX, L, I), this._orientationY = t(this, u, l.orientationY, L, I), this._orientationZ = t(this, u, l.orientationZ, L, I), this._positionX = t(this, u, l.positionX, L, I), this._positionY = t(this, u, l.positionY, L, I), this._positionZ = t(this, u, l.positionZ, L, I), o(this, 1);
|
|
3752
|
+
}
|
|
3753
|
+
get coneInnerAngle() {
|
|
3754
|
+
return this._nativePannerNode.coneInnerAngle;
|
|
3755
|
+
}
|
|
3756
|
+
set coneInnerAngle(e) {
|
|
3757
|
+
this._nativePannerNode.coneInnerAngle = e;
|
|
3758
|
+
}
|
|
3759
|
+
get coneOuterAngle() {
|
|
3760
|
+
return this._nativePannerNode.coneOuterAngle;
|
|
3761
|
+
}
|
|
3762
|
+
set coneOuterAngle(e) {
|
|
3763
|
+
this._nativePannerNode.coneOuterAngle = e;
|
|
3764
|
+
}
|
|
3765
|
+
get coneOuterGain() {
|
|
3766
|
+
return this._nativePannerNode.coneOuterGain;
|
|
3767
|
+
}
|
|
3768
|
+
set coneOuterGain(e) {
|
|
3769
|
+
this._nativePannerNode.coneOuterGain = e;
|
|
3770
|
+
}
|
|
3771
|
+
get distanceModel() {
|
|
3772
|
+
return this._nativePannerNode.distanceModel;
|
|
3773
|
+
}
|
|
3774
|
+
set distanceModel(e) {
|
|
3775
|
+
this._nativePannerNode.distanceModel = e;
|
|
3776
|
+
}
|
|
3777
|
+
get maxDistance() {
|
|
3778
|
+
return this._nativePannerNode.maxDistance;
|
|
3779
|
+
}
|
|
3780
|
+
set maxDistance(e) {
|
|
3781
|
+
this._nativePannerNode.maxDistance = e;
|
|
3782
|
+
}
|
|
3783
|
+
get orientationX() {
|
|
3784
|
+
return this._orientationX;
|
|
3785
|
+
}
|
|
3786
|
+
get orientationY() {
|
|
3787
|
+
return this._orientationY;
|
|
3788
|
+
}
|
|
3789
|
+
get orientationZ() {
|
|
3790
|
+
return this._orientationZ;
|
|
3791
|
+
}
|
|
3792
|
+
get panningModel() {
|
|
3793
|
+
return this._nativePannerNode.panningModel;
|
|
3794
|
+
}
|
|
3795
|
+
set panningModel(e) {
|
|
3796
|
+
this._nativePannerNode.panningModel = e;
|
|
3797
|
+
}
|
|
3798
|
+
get positionX() {
|
|
3799
|
+
return this._positionX;
|
|
3800
|
+
}
|
|
3801
|
+
get positionY() {
|
|
3802
|
+
return this._positionY;
|
|
3803
|
+
}
|
|
3804
|
+
get positionZ() {
|
|
3805
|
+
return this._positionZ;
|
|
3806
|
+
}
|
|
3807
|
+
get refDistance() {
|
|
3808
|
+
return this._nativePannerNode.refDistance;
|
|
3809
|
+
}
|
|
3810
|
+
set refDistance(e) {
|
|
3811
|
+
this._nativePannerNode.refDistance = e;
|
|
3812
|
+
}
|
|
3813
|
+
get rolloffFactor() {
|
|
3814
|
+
return this._nativePannerNode.rolloffFactor;
|
|
3815
|
+
}
|
|
3816
|
+
set rolloffFactor(e) {
|
|
3817
|
+
this._nativePannerNode.rolloffFactor = e;
|
|
3818
|
+
}
|
|
3819
|
+
}, Wi = (e, t, n, r, i, a, o, s, c, l) => () => {
|
|
3820
|
+
let u = /* @__PURE__ */ new WeakMap(), d = null, f = async (f, p) => {
|
|
3821
|
+
let m = null, h = a(f), g = {
|
|
3822
|
+
channelCount: h.channelCount,
|
|
3823
|
+
channelCountMode: h.channelCountMode,
|
|
3824
|
+
channelInterpretation: h.channelInterpretation
|
|
3825
|
+
}, _ = {
|
|
3826
|
+
...g,
|
|
3827
|
+
coneInnerAngle: h.coneInnerAngle,
|
|
3828
|
+
coneOuterAngle: h.coneOuterAngle,
|
|
3829
|
+
coneOuterGain: h.coneOuterGain,
|
|
3830
|
+
distanceModel: h.distanceModel,
|
|
3831
|
+
maxDistance: h.maxDistance,
|
|
3832
|
+
panningModel: h.panningModel,
|
|
3833
|
+
refDistance: h.refDistance,
|
|
3834
|
+
rolloffFactor: h.rolloffFactor
|
|
3835
|
+
}, v = F(h, p);
|
|
3836
|
+
if ("bufferSize" in h ? m = r(p, {
|
|
3837
|
+
...g,
|
|
3838
|
+
gain: 1
|
|
3839
|
+
}) : v || (h = i(p, {
|
|
3840
|
+
..._,
|
|
3841
|
+
orientationX: h.orientationX.value,
|
|
3842
|
+
orientationY: h.orientationY.value,
|
|
3843
|
+
orientationZ: h.orientationZ.value,
|
|
3844
|
+
positionX: h.positionX.value,
|
|
3845
|
+
positionY: h.positionY.value,
|
|
3846
|
+
positionZ: h.positionZ.value
|
|
3847
|
+
})), u.set(p, m === null ? h : m), m !== null) {
|
|
3848
|
+
if (d === null) {
|
|
3849
|
+
if (o === null) throw Error("Missing the native OfflineAudioContext constructor.");
|
|
3850
|
+
let e = new o(6, f.context.length, p.sampleRate), r = t(e, {
|
|
3851
|
+
channelCount: 1,
|
|
3852
|
+
channelCountMode: "explicit",
|
|
3853
|
+
channelInterpretation: "speakers",
|
|
3854
|
+
numberOfInputs: 6
|
|
3855
|
+
});
|
|
3856
|
+
r.connect(e.destination), d = (async () => {
|
|
3857
|
+
let t = await Promise.all([
|
|
3858
|
+
f.orientationX,
|
|
3859
|
+
f.orientationY,
|
|
3860
|
+
f.orientationZ,
|
|
3861
|
+
f.positionX,
|
|
3862
|
+
f.positionY,
|
|
3863
|
+
f.positionZ
|
|
3864
|
+
].map(async (t, r) => {
|
|
3865
|
+
let i = n(e, {
|
|
3866
|
+
channelCount: 1,
|
|
3867
|
+
channelCountMode: "explicit",
|
|
3868
|
+
channelInterpretation: "discrete",
|
|
3869
|
+
offset: +(r === 0)
|
|
3870
|
+
});
|
|
3871
|
+
return await s(e, t, i.offset), i;
|
|
3872
|
+
}));
|
|
3873
|
+
for (let e = 0; e < 6; e += 1) t[e].connect(r, 0, e), t[e].start(0);
|
|
3874
|
+
return l(e);
|
|
3875
|
+
})();
|
|
3876
|
+
}
|
|
3877
|
+
let e = await d, a = r(p, {
|
|
3878
|
+
...g,
|
|
3879
|
+
gain: 1
|
|
3880
|
+
});
|
|
3881
|
+
await c(f, p, a);
|
|
3882
|
+
let u = [];
|
|
3883
|
+
for (let t = 0; t < e.numberOfChannels; t += 1) u.push(e.getChannelData(t));
|
|
3884
|
+
let h = [
|
|
3885
|
+
u[0][0],
|
|
3886
|
+
u[1][0],
|
|
3887
|
+
u[2][0]
|
|
3888
|
+
], v = [
|
|
3889
|
+
u[3][0],
|
|
3890
|
+
u[4][0],
|
|
3891
|
+
u[5][0]
|
|
3892
|
+
], y = r(p, {
|
|
3893
|
+
...g,
|
|
3894
|
+
gain: 1
|
|
3895
|
+
}), b = i(p, {
|
|
3896
|
+
..._,
|
|
3897
|
+
orientationX: h[0],
|
|
3898
|
+
orientationY: h[1],
|
|
3899
|
+
orientationZ: h[2],
|
|
3900
|
+
positionX: v[0],
|
|
3901
|
+
positionY: v[1],
|
|
3902
|
+
positionZ: v[2]
|
|
3903
|
+
});
|
|
3904
|
+
a.connect(y).connect(b.inputs[0]), b.connect(m);
|
|
3905
|
+
for (let t = 128; t < e.length; t += 128) {
|
|
3906
|
+
let e = [
|
|
3907
|
+
u[0][t],
|
|
3908
|
+
u[1][t],
|
|
3909
|
+
u[2][t]
|
|
3910
|
+
], n = [
|
|
3911
|
+
u[3][t],
|
|
3912
|
+
u[4][t],
|
|
3913
|
+
u[5][t]
|
|
3914
|
+
];
|
|
3915
|
+
if (e.some((e, t) => e !== h[t]) || n.some((e, t) => e !== v[t])) {
|
|
3916
|
+
h = e, v = n;
|
|
3917
|
+
let o = t / p.sampleRate;
|
|
3918
|
+
y.gain.setValueAtTime(0, o), y = r(p, {
|
|
3919
|
+
...g,
|
|
3920
|
+
gain: 0
|
|
3921
|
+
}), b = i(p, {
|
|
3922
|
+
..._,
|
|
3923
|
+
orientationX: h[0],
|
|
3924
|
+
orientationY: h[1],
|
|
3925
|
+
orientationZ: h[2],
|
|
3926
|
+
positionX: v[0],
|
|
3927
|
+
positionY: v[1],
|
|
3928
|
+
positionZ: v[2]
|
|
3929
|
+
}), y.gain.setValueAtTime(1, o), a.connect(y).connect(b.inputs[0]), b.connect(m);
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
return m;
|
|
3933
|
+
}
|
|
3934
|
+
return v ? (await e(p, f.orientationX, h.orientationX), await e(p, f.orientationY, h.orientationY), await e(p, f.orientationZ, h.orientationZ), await e(p, f.positionX, h.positionX), await e(p, f.positionY, h.positionY), await e(p, f.positionZ, h.positionZ)) : (await s(p, f.orientationX, h.orientationX), await s(p, f.orientationY, h.orientationY), await s(p, f.orientationZ, h.orientationZ), await s(p, f.positionX, h.positionX), await s(p, f.positionY, h.positionY), await s(p, f.positionZ, h.positionZ)), pn(h) ? await c(f, p, h.inputs[0]) : await c(f, p, h), h;
|
|
3935
|
+
};
|
|
3936
|
+
return { render(e, t) {
|
|
3937
|
+
let n = u.get(t);
|
|
3938
|
+
return n === void 0 ? f(e, t) : Promise.resolve(n);
|
|
3939
|
+
} };
|
|
3940
|
+
}, Gi = { disableNormalization: !1 }, Ki = (e, t, n, r) => class i {
|
|
3941
|
+
constructor(i, a) {
|
|
3942
|
+
let o = e(t(i), r({
|
|
3943
|
+
...Gi,
|
|
3944
|
+
...a
|
|
3945
|
+
}));
|
|
3946
|
+
return n.add(o), o;
|
|
3947
|
+
}
|
|
3948
|
+
static [Symbol.hasInstance](e) {
|
|
3949
|
+
return typeof e == "object" && !!e && Object.getPrototypeOf(e) === i.prototype || n.has(e);
|
|
3950
|
+
}
|
|
3951
|
+
}, qi = (e, t) => (n, r, i) => (e(r).replay(i), t(r, n, i)), Ji = (e, t, n) => async (r, i, a) => {
|
|
3952
|
+
let o = e(r);
|
|
3953
|
+
await Promise.all(o.activeInputs.map((e, o) => Array.from(e).map(async ([e, s]) => {
|
|
3954
|
+
let c = await t(e).render(e, i), l = r.context.destination;
|
|
3955
|
+
!n(e) && (r !== l || !n(r)) && c.connect(a, s, o);
|
|
3956
|
+
})).reduce((e, t) => [...e, ...t], []));
|
|
3957
|
+
}, Yi = (e, t, n) => async (r, i, a) => {
|
|
3958
|
+
let o = t(r);
|
|
3959
|
+
await Promise.all(Array.from(o.activeInputs).map(async ([t, r]) => {
|
|
3960
|
+
let o = await e(t).render(t, i);
|
|
3961
|
+
n(t) || o.connect(a, r);
|
|
3962
|
+
}));
|
|
3963
|
+
}, Xi = (e, t, n, r) => (i) => e(Xr, () => Xr(i)) ? Promise.resolve(e(r, r)).then((e) => {
|
|
3964
|
+
if (!e) {
|
|
3965
|
+
let e = n(i, 512, 0, 1);
|
|
3966
|
+
i.oncomplete = () => {
|
|
3967
|
+
e.onaudioprocess = null, e.disconnect();
|
|
3968
|
+
}, e.onaudioprocess = () => i.currentTime, e.connect(i.destination);
|
|
3969
|
+
}
|
|
3970
|
+
return i.startRendering();
|
|
3971
|
+
}) : new Promise((e) => {
|
|
3972
|
+
let n = t(i, {
|
|
3973
|
+
channelCount: 1,
|
|
3974
|
+
channelCountMode: "explicit",
|
|
3975
|
+
channelInterpretation: "discrete",
|
|
3976
|
+
gain: 0
|
|
3977
|
+
});
|
|
3978
|
+
i.oncomplete = (t) => {
|
|
3979
|
+
n.disconnect(), e(t.renderedBuffer);
|
|
3980
|
+
}, n.connect(i.destination), i.startRendering();
|
|
3981
|
+
}), Zi = (e) => (t, n) => e.set(t, n), Qi = {
|
|
3982
|
+
channelCount: 2,
|
|
3983
|
+
channelCountMode: "explicit",
|
|
3984
|
+
channelInterpretation: "speakers",
|
|
3985
|
+
pan: 0
|
|
3986
|
+
}, $i = (e, t, n, r, i, a) => class extends e {
|
|
3987
|
+
constructor(e, o) {
|
|
3988
|
+
let s = i(e), c = n(s, {
|
|
3989
|
+
...Qi,
|
|
3990
|
+
...o
|
|
3991
|
+
}), l = a(s), u = l ? r() : null;
|
|
3992
|
+
super(e, !1, c, u), this._pan = t(this, l, c.pan);
|
|
3993
|
+
}
|
|
3994
|
+
get pan() {
|
|
3995
|
+
return this._pan;
|
|
3996
|
+
}
|
|
3997
|
+
}, ea = (e, t, n, r, i) => () => {
|
|
3998
|
+
let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
|
|
3999
|
+
let c = n(o), l = F(c, s);
|
|
4000
|
+
return l || (c = t(s, {
|
|
4001
|
+
channelCount: c.channelCount,
|
|
4002
|
+
channelCountMode: c.channelCountMode,
|
|
4003
|
+
channelInterpretation: c.channelInterpretation,
|
|
4004
|
+
pan: c.pan.value
|
|
4005
|
+
})), a.set(s, c), l ? await e(s, o.pan, c.pan) : await r(s, o.pan, c.pan), pn(c) ? await i(o, s, c.inputs[0]) : await i(o, s, c), c;
|
|
4006
|
+
};
|
|
4007
|
+
return { render(e, t) {
|
|
4008
|
+
let n = a.get(t);
|
|
4009
|
+
return n === void 0 ? o(e, t) : Promise.resolve(n);
|
|
4010
|
+
} };
|
|
4011
|
+
}, ta = (e) => () => {
|
|
4012
|
+
if (e === null) return !1;
|
|
4013
|
+
try {
|
|
4014
|
+
new e({
|
|
4015
|
+
length: 1,
|
|
4016
|
+
sampleRate: 44100
|
|
4017
|
+
});
|
|
4018
|
+
} catch {
|
|
4019
|
+
return !1;
|
|
4020
|
+
}
|
|
4021
|
+
return !0;
|
|
4022
|
+
}, na = (e, t) => async () => {
|
|
4023
|
+
if (e === null) return !0;
|
|
4024
|
+
if (t === null) return !1;
|
|
4025
|
+
let n = new Blob(["class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor(\"a\",A)"], { type: "application/javascript; charset=utf-8" }), r = new t(1, 128, 44100), i = URL.createObjectURL(n), a = !1, o = !1;
|
|
4026
|
+
try {
|
|
4027
|
+
await r.audioWorklet.addModule(i);
|
|
4028
|
+
let t = new e(r, "a", { numberOfOutputs: 0 }), n = r.createOscillator();
|
|
4029
|
+
t.port.onmessage = () => a = !0, t.onprocessorerror = () => o = !0, n.connect(t), n.start(0), await r.startRendering(), await new Promise((e) => setTimeout(e));
|
|
4030
|
+
} catch {} finally {
|
|
4031
|
+
URL.revokeObjectURL(i);
|
|
4032
|
+
}
|
|
4033
|
+
return a && !o;
|
|
4034
|
+
}, ra = (e, t) => () => {
|
|
4035
|
+
if (t === null) return Promise.resolve(!1);
|
|
4036
|
+
let n = new t(1, 1, 44100), r = e(n, {
|
|
4037
|
+
channelCount: 1,
|
|
4038
|
+
channelCountMode: "explicit",
|
|
4039
|
+
channelInterpretation: "discrete",
|
|
4040
|
+
gain: 0
|
|
4041
|
+
});
|
|
4042
|
+
return new Promise((e) => {
|
|
4043
|
+
n.oncomplete = () => {
|
|
4044
|
+
r.disconnect(), e(n.currentTime !== 0);
|
|
4045
|
+
}, n.startRendering();
|
|
4046
|
+
});
|
|
4047
|
+
}, ia = () => new DOMException("", "UnknownError"), aa = {
|
|
4048
|
+
channelCount: 2,
|
|
4049
|
+
channelCountMode: "max",
|
|
4050
|
+
channelInterpretation: "speakers",
|
|
4051
|
+
curve: null,
|
|
4052
|
+
oversample: "none"
|
|
4053
|
+
}, oa = (e, t, n, r, i, a, o) => class extends e {
|
|
4054
|
+
constructor(e, t) {
|
|
4055
|
+
let s = i(e), c = n(s, {
|
|
4056
|
+
...aa,
|
|
4057
|
+
...t
|
|
4058
|
+
}), l = a(s) ? r() : null;
|
|
4059
|
+
super(e, !0, c, l), this._isCurveNullified = !1, this._nativeWaveShaperNode = c, o(this, 1);
|
|
4060
|
+
}
|
|
4061
|
+
get curve() {
|
|
4062
|
+
return this._isCurveNullified ? null : this._nativeWaveShaperNode.curve;
|
|
4063
|
+
}
|
|
4064
|
+
set curve(e) {
|
|
4065
|
+
if (e === null) this._isCurveNullified = !0, this._nativeWaveShaperNode.curve = new Float32Array([0, 0]);
|
|
4066
|
+
else {
|
|
4067
|
+
if (e.length < 2) throw t();
|
|
4068
|
+
this._isCurveNullified = !1, this._nativeWaveShaperNode.curve = e;
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
get oversample() {
|
|
4072
|
+
return this._nativeWaveShaperNode.oversample;
|
|
4073
|
+
}
|
|
4074
|
+
set oversample(e) {
|
|
4075
|
+
this._nativeWaveShaperNode.oversample = e;
|
|
4076
|
+
}
|
|
4077
|
+
}, sa = (e, t, n) => () => {
|
|
4078
|
+
let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
|
|
4079
|
+
let o = t(i);
|
|
4080
|
+
return F(o, a) || (o = e(a, {
|
|
4081
|
+
channelCount: o.channelCount,
|
|
4082
|
+
channelCountMode: o.channelCountMode,
|
|
4083
|
+
channelInterpretation: o.channelInterpretation,
|
|
4084
|
+
curve: o.curve,
|
|
4085
|
+
oversample: o.oversample
|
|
4086
|
+
})), r.set(a, o), pn(o) ? await n(i, a, o.inputs[0]) : await n(i, a, o), o;
|
|
4087
|
+
};
|
|
4088
|
+
return { render(e, t) {
|
|
4089
|
+
let n = r.get(t);
|
|
4090
|
+
return n === void 0 ? i(e, t) : Promise.resolve(n);
|
|
4091
|
+
} };
|
|
4092
|
+
}, ca = () => typeof window > "u" ? null : window, la = (e, t) => (n) => {
|
|
4093
|
+
n.copyFromChannel = (r, i, a = 0) => {
|
|
4094
|
+
let o = e(a), s = e(i);
|
|
4095
|
+
if (s >= n.numberOfChannels) throw t();
|
|
4096
|
+
let c = n.length, l = n.getChannelData(s), u = r.length;
|
|
4097
|
+
for (let e = o < 0 ? -o : 0; e + o < c && e < u; e += 1) r[e] = l[e + o];
|
|
4098
|
+
}, n.copyToChannel = (r, i, a = 0) => {
|
|
4099
|
+
let o = e(a), s = e(i);
|
|
4100
|
+
if (s >= n.numberOfChannels) throw t();
|
|
4101
|
+
let c = n.length, l = n.getChannelData(s), u = r.length;
|
|
4102
|
+
for (let e = o < 0 ? -o : 0; e + o < c && e < u; e += 1) l[e + o] = r[e];
|
|
4103
|
+
};
|
|
4104
|
+
}, ua = (e) => (t) => {
|
|
4105
|
+
t.copyFromChannel = ((n) => (r, i, a = 0) => {
|
|
4106
|
+
let o = e(a), s = e(i);
|
|
4107
|
+
if (o < t.length) return n.call(t, r, s, o);
|
|
4108
|
+
})(t.copyFromChannel), t.copyToChannel = ((n) => (r, i, a = 0) => {
|
|
4109
|
+
let o = e(a), s = e(i);
|
|
4110
|
+
if (o < t.length) return n.call(t, r, s, o);
|
|
4111
|
+
})(t.copyToChannel);
|
|
4112
|
+
}, da = (e) => (t, n) => {
|
|
4113
|
+
let r = n.createBuffer(1, 1, 44100);
|
|
4114
|
+
t.buffer === null && (t.buffer = r), e(t, "buffer", (e) => () => {
|
|
4115
|
+
let n = e.call(t);
|
|
4116
|
+
return n === r ? null : n;
|
|
4117
|
+
}, (e) => (n) => e.call(t, n === null ? r : n));
|
|
4118
|
+
}, fa = (e, t) => (n, r) => {
|
|
4119
|
+
r.channelCount = 1, r.channelCountMode = "explicit", Object.defineProperty(r, "channelCount", {
|
|
4120
|
+
get: () => 1,
|
|
4121
|
+
set: () => {
|
|
4122
|
+
throw e();
|
|
4123
|
+
}
|
|
4124
|
+
}), Object.defineProperty(r, "channelCountMode", {
|
|
4125
|
+
get: () => "explicit",
|
|
4126
|
+
set: () => {
|
|
4127
|
+
throw e();
|
|
4128
|
+
}
|
|
4129
|
+
});
|
|
4130
|
+
let i = n.createBufferSource();
|
|
4131
|
+
t(r, () => {
|
|
4132
|
+
let e = r.numberOfInputs;
|
|
4133
|
+
for (let t = 0; t < e; t += 1) i.connect(r, 0, t);
|
|
4134
|
+
}, () => i.disconnect(r));
|
|
4135
|
+
}, pa = (e, t, n) => e.copyFromChannel === void 0 ? e.getChannelData(n)[0] : (e.copyFromChannel(t, n), t[0]), ma = (e) => {
|
|
4136
|
+
if (e === null) return !1;
|
|
4137
|
+
let t = e.length;
|
|
4138
|
+
return t % 2 == 0 ? e[t / 2 - 1] + e[t / 2] !== 0 : e[Math.floor(t / 2)] !== 0;
|
|
4139
|
+
}, ha = (e, t, n, r) => {
|
|
4140
|
+
let i = e;
|
|
4141
|
+
for (; !i.hasOwnProperty(t);) i = Object.getPrototypeOf(i);
|
|
4142
|
+
let { get: a, set: o } = Object.getOwnPropertyDescriptor(i, t);
|
|
4143
|
+
Object.defineProperty(e, t, {
|
|
4144
|
+
get: n(a),
|
|
4145
|
+
set: r(o)
|
|
4146
|
+
});
|
|
4147
|
+
}, ga = (e) => ({
|
|
4148
|
+
...e,
|
|
4149
|
+
channelCount: e.numberOfOutputs
|
|
4150
|
+
}), _a = (e) => {
|
|
4151
|
+
let { imag: t, real: n } = e;
|
|
4152
|
+
return t === void 0 ? n === void 0 ? {
|
|
4153
|
+
...e,
|
|
4154
|
+
imag: [0, 0],
|
|
4155
|
+
real: [0, 0]
|
|
4156
|
+
} : {
|
|
4157
|
+
...e,
|
|
4158
|
+
imag: Array.from(n, () => 0),
|
|
4159
|
+
real: n
|
|
4160
|
+
} : n === void 0 ? {
|
|
4161
|
+
...e,
|
|
4162
|
+
imag: t,
|
|
4163
|
+
real: Array.from(t, () => 0)
|
|
4164
|
+
} : {
|
|
4165
|
+
...e,
|
|
4166
|
+
imag: t,
|
|
4167
|
+
real: n
|
|
4168
|
+
};
|
|
4169
|
+
}, va = (e, t, n) => {
|
|
4170
|
+
try {
|
|
4171
|
+
e.setValueAtTime(t, n);
|
|
4172
|
+
} catch (r) {
|
|
4173
|
+
if (r.code !== 9) throw r;
|
|
4174
|
+
va(e, t, n + 1e-7);
|
|
4175
|
+
}
|
|
4176
|
+
}, ya = (e) => {
|
|
4177
|
+
let t = e.createBufferSource();
|
|
4178
|
+
t.start();
|
|
4179
|
+
try {
|
|
4180
|
+
t.start();
|
|
4181
|
+
} catch {
|
|
4182
|
+
return !0;
|
|
4183
|
+
}
|
|
4184
|
+
return !1;
|
|
4185
|
+
}, ba = (e) => {
|
|
4186
|
+
let t = e.createBufferSource();
|
|
4187
|
+
t.buffer = e.createBuffer(1, 1, 44100);
|
|
4188
|
+
try {
|
|
4189
|
+
t.start(0, 1);
|
|
4190
|
+
} catch {
|
|
4191
|
+
return !1;
|
|
4192
|
+
}
|
|
4193
|
+
return !0;
|
|
4194
|
+
}, xa = (e) => {
|
|
4195
|
+
let t = e.createBufferSource();
|
|
4196
|
+
t.start();
|
|
4197
|
+
try {
|
|
4198
|
+
t.stop();
|
|
4199
|
+
} catch {
|
|
4200
|
+
return !1;
|
|
4201
|
+
}
|
|
4202
|
+
return !0;
|
|
4203
|
+
}, Sa = (e) => {
|
|
4204
|
+
let t = e.createOscillator();
|
|
4205
|
+
try {
|
|
4206
|
+
t.start(-1);
|
|
4207
|
+
} catch (e) {
|
|
4208
|
+
return e instanceof RangeError;
|
|
4209
|
+
}
|
|
4210
|
+
return !1;
|
|
4211
|
+
}, Ca = (e) => {
|
|
4212
|
+
let t = e.createBuffer(1, 1, 44100), n = e.createBufferSource();
|
|
4213
|
+
n.buffer = t, n.start(), n.stop();
|
|
4214
|
+
try {
|
|
4215
|
+
return n.stop(), !0;
|
|
4216
|
+
} catch {
|
|
4217
|
+
return !1;
|
|
4218
|
+
}
|
|
4219
|
+
}, wa = (e) => {
|
|
4220
|
+
let t = e.createOscillator();
|
|
4221
|
+
try {
|
|
4222
|
+
t.stop(-1);
|
|
4223
|
+
} catch (e) {
|
|
4224
|
+
return e instanceof RangeError;
|
|
4225
|
+
}
|
|
4226
|
+
return !1;
|
|
4227
|
+
}, Ta = (e) => {
|
|
4228
|
+
e.start = ((t) => (n = 0, r = 0, i) => {
|
|
4229
|
+
let a = e.buffer, o = a === null ? r : Math.min(a.duration, r);
|
|
4230
|
+
a !== null && o > a.duration - .5 / e.context.sampleRate ? t.call(e, n, 0, 0) : t.call(e, n, o, i);
|
|
4231
|
+
})(e.start);
|
|
4232
|
+
}, Ea = (e, t) => {
|
|
4233
|
+
let n = t.createGain();
|
|
4234
|
+
e.connect(n);
|
|
4235
|
+
let r = ((t) => () => {
|
|
4236
|
+
t.call(e, n), e.removeEventListener("ended", r);
|
|
4237
|
+
})(e.disconnect);
|
|
4238
|
+
e.addEventListener("ended", r), hi(e, n), e.stop = ((t) => {
|
|
4239
|
+
let r = !1;
|
|
4240
|
+
return (i = 0) => {
|
|
4241
|
+
if (r) try {
|
|
4242
|
+
t.call(e, i);
|
|
4243
|
+
} catch {
|
|
4244
|
+
n.gain.setValueAtTime(0, i);
|
|
4245
|
+
}
|
|
4246
|
+
else t.call(e, i), r = !0;
|
|
4247
|
+
};
|
|
4248
|
+
})(e.stop);
|
|
4249
|
+
}, Da = (e, t) => (n) => {
|
|
4250
|
+
let r = { value: e };
|
|
4251
|
+
return Object.defineProperties(n, {
|
|
4252
|
+
currentTarget: r,
|
|
4253
|
+
target: r
|
|
4254
|
+
}), typeof t == "function" ? t.call(e, n) : t.handleEvent.call(e, n);
|
|
4255
|
+
}, Oa = at(un), ka = Nt(un), Aa = dr(Tt), ja = /* @__PURE__ */ new WeakMap(), Ma = Er(ja), Na = Hn(/* @__PURE__ */ new Map(), /* @__PURE__ */ new WeakMap()), K = ca(), Pa = ei(Na, zt), Fa = Tr(R), q = Ji(R, Fa, xn), Ia = Lt(Pa, z, q), J = Or(pt), La = ki(K), Y = Hr(La), Ra = /* @__PURE__ */ new WeakMap(), za = yr(Da), Ba = oi(K), Va = Rr(Ba), Ha = zr(K), Ua = Br(K), Wa = ci(K), X = Fn(ot(lt), Mt(Oa, ka, mn, Aa, yn, R, Ma, Dt, z, un, Ut, xn, Sn), Na, Lr(ht, yn, R, z, bn, Ut), zt, Ar, G, sr(mn, ht, R, z, bn, J, Ut, Y), pr(Ra, R, wt), za, J, Va, Ha, Ua, Y, Wa), Ga = It(X, Ia, zt, Pa, J, Y), Ka = /* @__PURE__ */ new WeakSet(), qa = ti(K), Ja = er(new Uint32Array(1)), Ya = la(Ja, zt), Xa = ua(Ja), Za = Ht(Ka, Na, G, qa, La, ta(qa), Ya, Xa), Qa = Pt(W), $a = Yi(Fa, $t, xn), Z = Yn($a), eo = ai(Qa, Na, ya, ba, xa, Sa, Ca, wa, Ta, da(ha), Ea), to = qi(Dr($t), $a), no = Kt(Z, eo, z, to, q), Q = In(st(dt), Ra, ft, Ln, rt.createCancelAndHoldAutomationEvent, rt.createCancelScheduledValuesAutomationEvent, rt.createExponentialRampToValueAutomationEvent, rt.createLinearRampToValueAutomationEvent, rt.createSetTargetAutomationEvent, rt.createSetValueAutomationEvent, rt.createSetValueCurveAutomationEvent, Ba, va), ro = Gt(X, no, Q, B, eo, J, Y, Da), io = an(X, on, zt, B, si(W, ha), J, Y, q), ao = Vn(Z, ui, z, to, q), oo = Zi(ja), so = Bn(X, Q, ao, Ar, ui, J, Y, oo), co = Zr(un, Ha), lo = di(Ba, fa(B, co)), uo = Wn(X, Gn(lo, z, q), lo, J, Y), fo = qn(X, Jn(pi, z, q), pi, J, Y, ga), po = mi(Qa, Na, gi(Qa, eo, W, co), Sa, wa), mo = Qn(X, Q, $n(Z, po, z, to, q), po, J, Y, Da), ho = _i(G, ha), go = nr(X, rr(ho, z, q), ho, J, Y, oo), _o = lr(X, Q, ur(Z, vi, z, to, q), vi, J, Y, oo), vo = yi(G), yo = hr(X, Q, gr(Z, vo, z, to, q), vo, G, J, Y, oo), bo = Cr(X, Q, wr(Z, W, z, to, q), W, J, Y), xo = wi(Ar, B, Pi, G), So = Xi(Na, W, Pi, ra(W, La)), Co = Ir(eo, z, La, q, So), wo = Nr(X, bi(xo), Co, J, Y, oo), To = Yr(io, sn(Q, lo, po, Pi, G, pa, Y, ha), za, Y, /* @__PURE__ */ new WeakMap(), Da), Eo = Ai(Qa, Na, Sa, Ca, wa, Ea), Do = Bi(X, Q, Eo, Vi(Z, Eo, z, to, q), J, Y, Da), Oo = Xn(eo), ko = Li(Oo, B, Ri(Oo, B, W, ma, co), ma, co, Ba, ha), Ao = ji(Mi(mn, B, lo, W, Pi, ko, G, yn, pa, co)), jo = Ui(X, Q, Ao, Wi(Z, lo, po, W, Ao, z, La, to, q, So), J, Y, oo), Mo = Ki(Ni(zt), J, /* @__PURE__ */ new WeakSet(), _a), No = Fi(Ii(lo, pi, W, ko, G, co), G), Po = $i(X, Q, No, ea(Z, No, z, to, q), J, Y), Fo = oa(X, B, ko, sa(ko, z, q), J, Y, oo), Io = Ur(K), Lo = br(K), Ro = kr(/* @__PURE__ */ new WeakMap(), La), zo = Io ? Ct(Na, G, vr(K), Lo, xr(it), J, Ro, Y, Wa, /* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap(), na(Wa, La), K) : void 0, Bo = Vr(Va, Y), Vo = rn(Rn(zo, Ga, Za, ro, so, uo, fo, mo, go, or(Ka, Na, ir, _r, /* @__PURE__ */ new WeakSet(), J, Bo, Rt, Xr, Ya, Xa), _o, yo, bo, wo, To, Do, jo, Mo, Po, Fo), B, G, ia, Wr(X, Ti, J, Y), Kr(X, Ei, J, Y), qr(X, Di, J, Y), Jr(X, Oi(B, Y), J), Ba), $;
|
|
4256
|
+
(function(e) {
|
|
4257
|
+
e.INIT = "INIT", e.PLAYING = "PLAYING", e.STOPPED = "STOPPED", e.PAUSED = "PAUSED";
|
|
4258
|
+
})($ ||= {});
|
|
4259
|
+
var Ho;
|
|
4260
|
+
(function(e) {
|
|
4261
|
+
e.STATE_CHANGE = "state-change", e.ITERATION = "iteration";
|
|
4262
|
+
})(Ho ||= {});
|
|
4263
|
+
//#endregion
|
|
4264
|
+
//#region node_modules/@modernized/osmd-audio-player/dist/index.js
|
|
4265
|
+
var Uo = class {
|
|
4266
|
+
constructor(e = new Vo(), t = new Ve()) {
|
|
4267
|
+
this.defaultBpm = 100, this.scoreInstruments = [], this.ready = !1, this.ac = e, this.ac.suspend(), this.instrumentPlayer = t, this.instrumentPlayer.init(this.ac), this.availableInstruments = this.instrumentPlayer.instruments, this.events = new Ge(), this.cursor = null, this.sheet = null, this.scheduler = null, this.iterationSteps = 0, this.currentIterationStep = 0, this.timeoutHandles = [], this.playbackSettings = {
|
|
4268
|
+
bpm: this.defaultBpm,
|
|
4269
|
+
masterVolume: 1
|
|
4270
|
+
}, this.setState($.INIT);
|
|
4271
|
+
}
|
|
4272
|
+
get wholeNoteLength() {
|
|
4273
|
+
return Math.round(60 / this.playbackSettings.bpm * 4e3);
|
|
4274
|
+
}
|
|
4275
|
+
getPlaybackInstrument(e) {
|
|
4276
|
+
if (!this.sheet) return null;
|
|
4277
|
+
let t = this.sheet.Instruments.flatMap((e) => e.Voices).find((t) => t.VoiceId === e);
|
|
4278
|
+
return this.availableInstruments.find((e) => e.midiId === t.midiInstrumentId);
|
|
4279
|
+
}
|
|
4280
|
+
async setInstrument(e, t) {
|
|
4281
|
+
await this.instrumentPlayer.load(t), e.midiInstrumentId = t;
|
|
4282
|
+
}
|
|
4283
|
+
async loadScore(e) {
|
|
4284
|
+
this.ready = !1, this.sheet = e.Sheet, this.scoreInstruments = this.sheet.Instruments, this.cursor = e.cursor, this.sheet.HasBPMInfo && this.setBpm(this.sheet.DefaultStartTempoInBpm), await this.loadInstruments(), this.initInstruments(), this.scheduler = new te(this.wholeNoteLength, this.ac, (e, t) => this.notePlaybackCallback(e, t)), this.countAndSetIterationSteps(), this.ready = !0, this.setState($.STOPPED);
|
|
4285
|
+
}
|
|
4286
|
+
initInstruments() {
|
|
4287
|
+
for (let e of this.sheet.Instruments) for (let t of e.Voices) t.midiInstrumentId = e.MidiInstrumentId;
|
|
4288
|
+
}
|
|
4289
|
+
async loadInstruments() {
|
|
4290
|
+
let e = [];
|
|
4291
|
+
for (let t of this.sheet.Instruments) this.availableInstruments.find((e) => e.midiId === t.MidiInstrumentId) ?? this.fallbackToPiano(t), e.push(this.instrumentPlayer.load(t.MidiInstrumentId));
|
|
4292
|
+
await Promise.all(e);
|
|
4293
|
+
}
|
|
4294
|
+
fallbackToPiano(e) {
|
|
4295
|
+
if (console.warn(`Can't find playback instrument for midiInstrumentId ${e.MidiInstrumentId}. Falling back to piano`), e.MidiInstrumentId = 0, this.availableInstruments.find((e) => e.midiId === 0) == null) throw Error("Piano fallback failed, grand piano not supported");
|
|
4296
|
+
}
|
|
4297
|
+
async play() {
|
|
4298
|
+
await this.ac.resume(), (this.state === $.INIT || this.state === $.STOPPED) && this.cursor.show(), this.setState($.PLAYING), this.scheduler.start();
|
|
4299
|
+
}
|
|
4300
|
+
async stop() {
|
|
4301
|
+
this.setState($.STOPPED), this.stopPlayers(), this.clearTimeouts(), this.scheduler.reset(), this.cursor.reset(), this.currentIterationStep = 0, this.cursor.hide();
|
|
4302
|
+
}
|
|
4303
|
+
pause() {
|
|
4304
|
+
this.setState($.PAUSED), this.ac.suspend(), this.stopPlayers(), this.scheduler.setIterationStep(this.currentIterationStep), this.scheduler.pause(), this.clearTimeouts();
|
|
4305
|
+
}
|
|
4306
|
+
jumpToStep(e) {
|
|
4307
|
+
for (this.pause(), this.currentIterationStep > e && (this.cursor.reset(), this.currentIterationStep = 0); this.currentIterationStep < e;) this.cursor.next(), ++this.currentIterationStep;
|
|
4308
|
+
let t = this.currentIterationStep;
|
|
4309
|
+
this.currentIterationStep > 0 && this.currentIterationStep < this.iterationSteps && ++t, this.scheduler.setIterationStep(t);
|
|
4310
|
+
}
|
|
4311
|
+
setBpm(e) {
|
|
4312
|
+
this.playbackSettings.bpm = e, this.scheduler && (this.scheduler.wholeNoteLength = this.wholeNoteLength);
|
|
4313
|
+
}
|
|
4314
|
+
on(e, t) {
|
|
4315
|
+
this.events.on(e, t);
|
|
4316
|
+
}
|
|
4317
|
+
countAndSetIterationSteps() {
|
|
4318
|
+
this.cursor.reset();
|
|
4319
|
+
let e = 0;
|
|
4320
|
+
for (; !this.cursor.Iterator.EndReached;) this.cursor.Iterator.CurrentVoiceEntries && this.scheduler.loadNotes(this.cursor.Iterator.CurrentVoiceEntries), this.cursor.next(), ++e;
|
|
4321
|
+
this.iterationSteps = e, this.cursor.reset();
|
|
4322
|
+
}
|
|
4323
|
+
notePlaybackCallback(e, t) {
|
|
4324
|
+
if (this.state !== $.PLAYING) return;
|
|
4325
|
+
let n = /* @__PURE__ */ new Map();
|
|
4326
|
+
for (let e of t) {
|
|
4327
|
+
if (e.isRest()) continue;
|
|
4328
|
+
let t = Ue(e, this.wholeNoteLength);
|
|
4329
|
+
if (t === 0) continue;
|
|
4330
|
+
let r = We(e), i = He(e), a = e.ParentVoiceEntry.ParentVoice.midiInstrumentId, o = e.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey || 0;
|
|
4331
|
+
n.has(a) || n.set(a, []), n.get(a).push({
|
|
4332
|
+
note: e.halfTone - o * 12,
|
|
4333
|
+
duration: t / 1e3,
|
|
4334
|
+
gain: r,
|
|
4335
|
+
articulation: i
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
for (let [t, r] of n) this.instrumentPlayer.schedule(t, this.ac.currentTime + e, r);
|
|
4339
|
+
this.timeoutHandles.push(window.setTimeout(() => this.iterationCallback(), Math.max(0, e * 1e3 - 35)), window.setTimeout(() => this.events.emit(Ho.ITERATION, t), e * 1e3));
|
|
4340
|
+
}
|
|
4341
|
+
setState(e) {
|
|
4342
|
+
this.state = e, this.events.emit(Ho.STATE_CHANGE, e);
|
|
4343
|
+
}
|
|
4344
|
+
stopPlayers() {
|
|
4345
|
+
for (let e of this.sheet.Instruments) for (let t of e.Voices) this.instrumentPlayer.stop(t.midiInstrumentId);
|
|
4346
|
+
}
|
|
4347
|
+
clearTimeouts() {
|
|
4348
|
+
for (let e of this.timeoutHandles) clearTimeout(e);
|
|
4349
|
+
this.timeoutHandles = [];
|
|
4350
|
+
}
|
|
4351
|
+
iterationCallback() {
|
|
4352
|
+
this.state === $.PLAYING && (this.currentIterationStep > 0 && this.cursor.next(), ++this.currentIterationStep);
|
|
4353
|
+
}
|
|
4354
|
+
}, Wo = { class: "w-full h-full overflow-y-auto" }, Go = { class: "min-h-full flex flex-col p-4" }, Ko = {
|
|
9
4355
|
key: 0,
|
|
10
4356
|
class: "mb-4 text-center"
|
|
11
|
-
},
|
|
4357
|
+
}, qo = { class: "text-2xl font-bold text-gray-900" }, Jo = { class: "mb-4 flex gap-2 items-center justify-center" }, Yo = ["disabled"], Xo = { class: "text-xl" }, Zo = ["disabled"], Qo = { class: "flex items-center gap-2" }, $o = /* @__PURE__ */ s({
|
|
12
4358
|
__name: "View",
|
|
13
4359
|
props: {
|
|
14
4360
|
selectedResult: {},
|
|
15
4361
|
sendTextMessage: { type: Function }
|
|
16
4362
|
},
|
|
17
4363
|
setup(e) {
|
|
18
|
-
let t = e, n = f(null), s = null,
|
|
4364
|
+
let t = e, n = f(null), s = null, b = null, x = f(!1), S = f(!1), C = f(!1), w = f(200), T = f(!1), E = f(!1), D = async () => {
|
|
19
4365
|
if (!(!n.value || !t.selectedResult.data?.musicXML)) try {
|
|
20
|
-
n.value.innerHTML = "",
|
|
4366
|
+
n.value.innerHTML = "", x.value = !1, S.value = !1, s = new _(n.value, {
|
|
21
4367
|
autoResize: !0,
|
|
22
4368
|
backend: "svg",
|
|
23
4369
|
drawTitle: !1,
|
|
24
4370
|
followCursor: !0
|
|
25
|
-
}), await s.load(t.selectedResult.data.musicXML), await s.render(),
|
|
4371
|
+
}), await s.load(t.selectedResult.data.musicXML), await s.render(), b ||= new Uo(), await b.loadScore(s);
|
|
26
4372
|
let e = s.Sheet?.SourceMeasures?.[0]?.TempoExpressions;
|
|
27
4373
|
if (e && e.length > 0) {
|
|
28
4374
|
let t = e[0], n = t.TempoInBpm || t.tempoInBpm;
|
|
29
|
-
n && (
|
|
4375
|
+
n && (w.value = n);
|
|
30
4376
|
}
|
|
31
|
-
|
|
32
|
-
!
|
|
33
|
-
}),
|
|
4377
|
+
b.on("iteration", (e) => {
|
|
4378
|
+
!T.value && e && e.length === 0 && (b.stop(), S.value = !1);
|
|
4379
|
+
}), x.value = !0;
|
|
34
4380
|
} catch (e) {
|
|
35
4381
|
console.error("Error rendering music:", e), n.value && (n.value.innerHTML = `<div class="text-red-500">Error rendering sheet music: ${e instanceof Error ? e.message : "Unknown error"}</div>`);
|
|
36
4382
|
}
|
|
37
|
-
},
|
|
38
|
-
if (!n.value || !
|
|
4383
|
+
}, O = async () => {
|
|
4384
|
+
if (!n.value || !x.value) return;
|
|
39
4385
|
let e = n.value.querySelector("svg");
|
|
40
4386
|
if (e) {
|
|
41
|
-
|
|
4387
|
+
C.value = !0;
|
|
42
4388
|
try {
|
|
43
|
-
let n = e.viewBox.baseVal.width || e.clientWidth, r = e.viewBox.baseVal.height || e.clientHeight, i = new
|
|
4389
|
+
let n = e.viewBox.baseVal.width || e.clientWidth, r = e.viewBox.baseVal.height || e.clientHeight, i = new v({
|
|
44
4390
|
orientation: n > r ? "landscape" : "portrait",
|
|
45
4391
|
unit: "pt",
|
|
46
4392
|
format: "a4"
|
|
47
4393
|
}), a = i.internal.pageSize.getWidth(), o = i.internal.pageSize.getHeight(), s = Math.min(a / n, o / r), c = n * s, l = r * s;
|
|
48
|
-
await
|
|
4394
|
+
await y(e, i, {
|
|
49
4395
|
x: (a - c) / 2,
|
|
50
4396
|
y: (o - l) / 2,
|
|
51
4397
|
width: c,
|
|
@@ -56,50 +4402,50 @@ var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full fle
|
|
|
56
4402
|
} catch (e) {
|
|
57
4403
|
console.error("Error exporting PDF:", e);
|
|
58
4404
|
} finally {
|
|
59
|
-
|
|
4405
|
+
C.value = !1;
|
|
60
4406
|
}
|
|
61
4407
|
}
|
|
62
|
-
},
|
|
63
|
-
!
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
return h(
|
|
68
|
-
|
|
69
|
-
}), h(
|
|
70
|
-
|
|
71
|
-
}), h(
|
|
72
|
-
|
|
4408
|
+
}, k = async () => {
|
|
4409
|
+
!b || !x.value || (b.setBpm(Math.max(30, Math.min(300, w.value))), b.metronomeVolume = E.value ? .7 : 0, b.isLooping = T.value, await b.play(), S.value = !0);
|
|
4410
|
+
}, A = () => {
|
|
4411
|
+
b && (b.stop(), S.value = !1);
|
|
4412
|
+
};
|
|
4413
|
+
return h(w, () => {
|
|
4414
|
+
b && b.setBpm(Math.max(30, Math.min(300, w.value)));
|
|
4415
|
+
}), h(T, () => {
|
|
4416
|
+
b && (b.isLooping = T.value);
|
|
4417
|
+
}), h(E, () => {
|
|
4418
|
+
b && (b.metronomeVolume = E.value ? .7 : 0);
|
|
73
4419
|
}), l(() => {
|
|
74
|
-
|
|
4420
|
+
D();
|
|
75
4421
|
}), h(() => t.selectedResult.data?.musicXML, () => {
|
|
76
|
-
|
|
4422
|
+
D();
|
|
77
4423
|
}), u(() => {
|
|
78
|
-
|
|
79
|
-
}), (t, s) => (d(), i("div",
|
|
80
|
-
e.selectedResult.title ? (d(), i("div",
|
|
81
|
-
a("div",
|
|
4424
|
+
b && b.stop();
|
|
4425
|
+
}), (t, s) => (d(), i("div", Wo, [a("div", Go, [
|
|
4426
|
+
e.selectedResult.title ? (d(), i("div", Ko, [a("h2", qo, p(e.selectedResult.title), 1)])) : r("", !0),
|
|
4427
|
+
a("div", Jo, [
|
|
82
4428
|
a("button", {
|
|
83
|
-
onClick: s[0] ||= (e) =>
|
|
84
|
-
disabled: !
|
|
85
|
-
class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1",
|
|
86
|
-
}, [a("span",
|
|
4429
|
+
onClick: s[0] ||= (e) => S.value ? A() : k(),
|
|
4430
|
+
disabled: !x.value,
|
|
4431
|
+
class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1", S.value ? "bg-red-500" : "bg-blue-500"])
|
|
4432
|
+
}, [a("span", Xo, p(S.value ? "⏹" : "▶"), 1), o(" " + p(S.value ? "Stop" : "Play"), 1)], 10, Yo),
|
|
87
4433
|
a("button", {
|
|
88
|
-
onClick:
|
|
89
|
-
disabled: !
|
|
4434
|
+
onClick: O,
|
|
4435
|
+
disabled: !x.value || C.value,
|
|
90
4436
|
class: "px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1"
|
|
91
|
-
}, [s[2] ||= a("span", { class: "text-xl" }, "⬇", -1), o(" " + p(
|
|
92
|
-
a("label",
|
|
4437
|
+
}, [s[2] ||= a("span", { class: "text-xl" }, "⬇", -1), o(" " + p(C.value ? "Exporting..." : "PDF"), 1)], 8, Zo),
|
|
4438
|
+
a("label", Qo, [
|
|
93
4439
|
s[3] ||= o(" Tempo ", -1),
|
|
94
4440
|
g(a("input", {
|
|
95
|
-
"onUpdate:modelValue": s[1] ||= (e) =>
|
|
4441
|
+
"onUpdate:modelValue": s[1] ||= (e) => w.value = e,
|
|
96
4442
|
type: "number",
|
|
97
4443
|
min: "30",
|
|
98
4444
|
max: "300",
|
|
99
4445
|
class: "w-20 px-2 py-1 border border-gray-300 rounded"
|
|
100
4446
|
}, null, 512), [[
|
|
101
4447
|
m,
|
|
102
|
-
|
|
4448
|
+
w.value,
|
|
103
4449
|
void 0,
|
|
104
4450
|
{ number: !0 }
|
|
105
4451
|
]]),
|
|
@@ -113,23 +4459,23 @@ var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full fle
|
|
|
113
4459
|
}, null, 512)
|
|
114
4460
|
])]));
|
|
115
4461
|
}
|
|
116
|
-
}),
|
|
4462
|
+
}), es = { class: "text-center p-4 bg-purple-50 rounded" }, ts = {
|
|
117
4463
|
key: 0,
|
|
118
4464
|
class: "text-xs text-gray-600 mt-1 truncate"
|
|
119
|
-
},
|
|
4465
|
+
}, ns = {
|
|
120
4466
|
toolDefinition: t,
|
|
121
4467
|
execute: e,
|
|
122
4468
|
generatingMessage: "Rendering sheet music...",
|
|
123
4469
|
isEnabled: () => !0,
|
|
124
|
-
viewComponent:
|
|
4470
|
+
viewComponent: $o,
|
|
125
4471
|
previewComponent: /* @__PURE__ */ s({
|
|
126
4472
|
__name: "Preview",
|
|
127
4473
|
props: { result: {} },
|
|
128
4474
|
setup(e) {
|
|
129
|
-
return (t, n) => (d(), i("div",
|
|
4475
|
+
return (t, n) => (d(), i("div", es, [n[0] ||= a("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1), e.result.title ? (d(), i("div", ts, p(e.result.title), 1)) : r("", !0)]));
|
|
130
4476
|
}
|
|
131
4477
|
}),
|
|
132
4478
|
samples: n
|
|
133
|
-
},
|
|
4479
|
+
}, rs = { plugin: ns };
|
|
134
4480
|
//#endregion
|
|
135
|
-
export { t as TOOL_DEFINITION,
|
|
4481
|
+
export { t as TOOL_DEFINITION, rs as default, e as executeMusic, ns as plugin };
|