@flo-audio/libflo-audio 0.1.1

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.
@@ -0,0 +1,1401 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function debugString(val) {
10
+ // primitive types
11
+ const type = typeof val;
12
+ if (type == 'number' || type == 'boolean' || val == null) {
13
+ return `${val}`;
14
+ }
15
+ if (type == 'string') {
16
+ return `"${val}"`;
17
+ }
18
+ if (type == 'symbol') {
19
+ const description = val.description;
20
+ if (description == null) {
21
+ return 'Symbol';
22
+ } else {
23
+ return `Symbol(${description})`;
24
+ }
25
+ }
26
+ if (type == 'function') {
27
+ const name = val.name;
28
+ if (typeof name == 'string' && name.length > 0) {
29
+ return `Function(${name})`;
30
+ } else {
31
+ return 'Function';
32
+ }
33
+ }
34
+ // objects
35
+ if (Array.isArray(val)) {
36
+ const length = val.length;
37
+ let debug = '[';
38
+ if (length > 0) {
39
+ debug += debugString(val[0]);
40
+ }
41
+ for(let i = 1; i < length; i++) {
42
+ debug += ', ' + debugString(val[i]);
43
+ }
44
+ debug += ']';
45
+ return debug;
46
+ }
47
+ // Test for built-in
48
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
49
+ let className;
50
+ if (builtInMatches && builtInMatches.length > 1) {
51
+ className = builtInMatches[1];
52
+ } else {
53
+ // Failed to match the standard '[object ClassName]'
54
+ return toString.call(val);
55
+ }
56
+ if (className == 'Object') {
57
+ // we're a user defined class or Object
58
+ // JSON.stringify avoids problems with cycles, and is generally much
59
+ // easier than looping through ownProperties of `val`.
60
+ try {
61
+ return 'Object(' + JSON.stringify(val) + ')';
62
+ } catch (_) {
63
+ return 'Object';
64
+ }
65
+ }
66
+ // errors
67
+ if (val instanceof Error) {
68
+ return `${val.name}: ${val.message}\n${val.stack}`;
69
+ }
70
+ // TODO we could test for more things here, like `Set`s and `Map`s.
71
+ return className;
72
+ }
73
+
74
+ function getArrayF32FromWasm0(ptr, len) {
75
+ ptr = ptr >>> 0;
76
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
77
+ }
78
+
79
+ function getArrayU8FromWasm0(ptr, len) {
80
+ ptr = ptr >>> 0;
81
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
82
+ }
83
+
84
+ let cachedDataViewMemory0 = null;
85
+ function getDataViewMemory0() {
86
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
87
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
88
+ }
89
+ return cachedDataViewMemory0;
90
+ }
91
+
92
+ let cachedFloat32ArrayMemory0 = null;
93
+ function getFloat32ArrayMemory0() {
94
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
95
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
96
+ }
97
+ return cachedFloat32ArrayMemory0;
98
+ }
99
+
100
+ function getStringFromWasm0(ptr, len) {
101
+ ptr = ptr >>> 0;
102
+ return decodeText(ptr, len);
103
+ }
104
+
105
+ let cachedUint8ArrayMemory0 = null;
106
+ function getUint8ArrayMemory0() {
107
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
108
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
109
+ }
110
+ return cachedUint8ArrayMemory0;
111
+ }
112
+
113
+ function handleError(f, args) {
114
+ try {
115
+ return f.apply(this, args);
116
+ } catch (e) {
117
+ const idx = addToExternrefTable0(e);
118
+ wasm.__wbindgen_exn_store(idx);
119
+ }
120
+ }
121
+
122
+ function isLikeNone(x) {
123
+ return x === undefined || x === null;
124
+ }
125
+
126
+ function passArray8ToWasm0(arg, malloc) {
127
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
128
+ getUint8ArrayMemory0().set(arg, ptr / 1);
129
+ WASM_VECTOR_LEN = arg.length;
130
+ return ptr;
131
+ }
132
+
133
+ function passArrayF32ToWasm0(arg, malloc) {
134
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
135
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
136
+ WASM_VECTOR_LEN = arg.length;
137
+ return ptr;
138
+ }
139
+
140
+ function passStringToWasm0(arg, malloc, realloc) {
141
+ if (realloc === undefined) {
142
+ const buf = cachedTextEncoder.encode(arg);
143
+ const ptr = malloc(buf.length, 1) >>> 0;
144
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
145
+ WASM_VECTOR_LEN = buf.length;
146
+ return ptr;
147
+ }
148
+
149
+ let len = arg.length;
150
+ let ptr = malloc(len, 1) >>> 0;
151
+
152
+ const mem = getUint8ArrayMemory0();
153
+
154
+ let offset = 0;
155
+
156
+ for (; offset < len; offset++) {
157
+ const code = arg.charCodeAt(offset);
158
+ if (code > 0x7F) break;
159
+ mem[ptr + offset] = code;
160
+ }
161
+ if (offset !== len) {
162
+ if (offset !== 0) {
163
+ arg = arg.slice(offset);
164
+ }
165
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
166
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
167
+ const ret = cachedTextEncoder.encodeInto(arg, view);
168
+
169
+ offset += ret.written;
170
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
171
+ }
172
+
173
+ WASM_VECTOR_LEN = offset;
174
+ return ptr;
175
+ }
176
+
177
+ function takeFromExternrefTable0(idx) {
178
+ const value = wasm.__wbindgen_externrefs.get(idx);
179
+ wasm.__externref_table_dealloc(idx);
180
+ return value;
181
+ }
182
+
183
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
184
+ cachedTextDecoder.decode();
185
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
186
+ let numBytesDecoded = 0;
187
+ function decodeText(ptr, len) {
188
+ numBytesDecoded += len;
189
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
190
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
191
+ cachedTextDecoder.decode();
192
+ numBytesDecoded = len;
193
+ }
194
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
195
+ }
196
+
197
+ const cachedTextEncoder = new TextEncoder();
198
+
199
+ if (!('encodeInto' in cachedTextEncoder)) {
200
+ cachedTextEncoder.encodeInto = function (arg, view) {
201
+ const buf = cachedTextEncoder.encode(arg);
202
+ view.set(buf);
203
+ return {
204
+ read: arg.length,
205
+ written: buf.length
206
+ };
207
+ }
208
+ }
209
+
210
+ let WASM_VECTOR_LEN = 0;
211
+
212
+ const AudioInfoFinalization = (typeof FinalizationRegistry === 'undefined')
213
+ ? { register: () => {}, unregister: () => {} }
214
+ : new FinalizationRegistry(ptr => wasm.__wbg_audioinfo_free(ptr >>> 0, 1));
215
+
216
+ const WasmStreamingDecoderFinalization = (typeof FinalizationRegistry === 'undefined')
217
+ ? { register: () => {}, unregister: () => {} }
218
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmstreamingdecoder_free(ptr >>> 0, 1));
219
+
220
+ /**
221
+ * info about a flo file
222
+ */
223
+ export class AudioInfo {
224
+ static __wrap(ptr) {
225
+ ptr = ptr >>> 0;
226
+ const obj = Object.create(AudioInfo.prototype);
227
+ obj.__wbg_ptr = ptr;
228
+ AudioInfoFinalization.register(obj, obj.__wbg_ptr, obj);
229
+ return obj;
230
+ }
231
+ __destroy_into_raw() {
232
+ const ptr = this.__wbg_ptr;
233
+ this.__wbg_ptr = 0;
234
+ AudioInfoFinalization.unregister(this);
235
+ return ptr;
236
+ }
237
+ free() {
238
+ const ptr = this.__destroy_into_raw();
239
+ wasm.__wbg_audioinfo_free(ptr, 0);
240
+ }
241
+ /**
242
+ * Sample rate in Hz
243
+ * @returns {number}
244
+ */
245
+ get sample_rate() {
246
+ const ret = wasm.__wbg_get_audioinfo_sample_rate(this.__wbg_ptr);
247
+ return ret >>> 0;
248
+ }
249
+ /**
250
+ * Sample rate in Hz
251
+ * @param {number} arg0
252
+ */
253
+ set sample_rate(arg0) {
254
+ wasm.__wbg_set_audioinfo_sample_rate(this.__wbg_ptr, arg0);
255
+ }
256
+ /**
257
+ * Number of channels
258
+ * @returns {number}
259
+ */
260
+ get channels() {
261
+ const ret = wasm.__wbg_get_audioinfo_channels(this.__wbg_ptr);
262
+ return ret;
263
+ }
264
+ /**
265
+ * Number of channels
266
+ * @param {number} arg0
267
+ */
268
+ set channels(arg0) {
269
+ wasm.__wbg_set_audioinfo_channels(this.__wbg_ptr, arg0);
270
+ }
271
+ /**
272
+ * Bits per sample
273
+ * @returns {number}
274
+ */
275
+ get bit_depth() {
276
+ const ret = wasm.__wbg_get_audioinfo_bit_depth(this.__wbg_ptr);
277
+ return ret;
278
+ }
279
+ /**
280
+ * Bits per sample
281
+ * @param {number} arg0
282
+ */
283
+ set bit_depth(arg0) {
284
+ wasm.__wbg_set_audioinfo_bit_depth(this.__wbg_ptr, arg0);
285
+ }
286
+ /**
287
+ * Total number of frames
288
+ * @returns {bigint}
289
+ */
290
+ get total_frames() {
291
+ const ret = wasm.__wbg_get_audioinfo_total_frames(this.__wbg_ptr);
292
+ return BigInt.asUintN(64, ret);
293
+ }
294
+ /**
295
+ * Total number of frames
296
+ * @param {bigint} arg0
297
+ */
298
+ set total_frames(arg0) {
299
+ wasm.__wbg_set_audioinfo_total_frames(this.__wbg_ptr, arg0);
300
+ }
301
+ /**
302
+ * Duration in seconds
303
+ * @returns {number}
304
+ */
305
+ get duration_secs() {
306
+ const ret = wasm.__wbg_get_audioinfo_duration_secs(this.__wbg_ptr);
307
+ return ret;
308
+ }
309
+ /**
310
+ * Duration in seconds
311
+ * @param {number} arg0
312
+ */
313
+ set duration_secs(arg0) {
314
+ wasm.__wbg_set_audioinfo_duration_secs(this.__wbg_ptr, arg0);
315
+ }
316
+ /**
317
+ * File size in bytes
318
+ * @returns {number}
319
+ */
320
+ get file_size() {
321
+ const ret = wasm.__wbg_get_audioinfo_file_size(this.__wbg_ptr);
322
+ return ret >>> 0;
323
+ }
324
+ /**
325
+ * File size in bytes
326
+ * @param {number} arg0
327
+ */
328
+ set file_size(arg0) {
329
+ wasm.__wbg_set_audioinfo_file_size(this.__wbg_ptr, arg0);
330
+ }
331
+ /**
332
+ * Compression ratio (original / compressed)
333
+ * @returns {number}
334
+ */
335
+ get compression_ratio() {
336
+ const ret = wasm.__wbg_get_audioinfo_compression_ratio(this.__wbg_ptr);
337
+ return ret;
338
+ }
339
+ /**
340
+ * Compression ratio (original / compressed)
341
+ * @param {number} arg0
342
+ */
343
+ set compression_ratio(arg0) {
344
+ wasm.__wbg_set_audioinfo_compression_ratio(this.__wbg_ptr, arg0);
345
+ }
346
+ /**
347
+ * Is CRC valid?
348
+ * @returns {boolean}
349
+ */
350
+ get crc_valid() {
351
+ const ret = wasm.__wbg_get_audioinfo_crc_valid(this.__wbg_ptr);
352
+ return ret !== 0;
353
+ }
354
+ /**
355
+ * Is CRC valid?
356
+ * @param {boolean} arg0
357
+ */
358
+ set crc_valid(arg0) {
359
+ wasm.__wbg_set_audioinfo_crc_valid(this.__wbg_ptr, arg0);
360
+ }
361
+ /**
362
+ * Is lossy compression mode?
363
+ * @returns {boolean}
364
+ */
365
+ get is_lossy() {
366
+ const ret = wasm.__wbg_get_audioinfo_is_lossy(this.__wbg_ptr);
367
+ return ret !== 0;
368
+ }
369
+ /**
370
+ * Is lossy compression mode?
371
+ * @param {boolean} arg0
372
+ */
373
+ set is_lossy(arg0) {
374
+ wasm.__wbg_set_audioinfo_is_lossy(this.__wbg_ptr, arg0);
375
+ }
376
+ /**
377
+ * Lossy quality 0-4 (only valid if is_lossy)
378
+ * @returns {number}
379
+ */
380
+ get lossy_quality() {
381
+ const ret = wasm.__wbg_get_audioinfo_lossy_quality(this.__wbg_ptr);
382
+ return ret;
383
+ }
384
+ /**
385
+ * Lossy quality 0-4 (only valid if is_lossy)
386
+ * @param {number} arg0
387
+ */
388
+ set lossy_quality(arg0) {
389
+ wasm.__wbg_set_audioinfo_lossy_quality(this.__wbg_ptr, arg0);
390
+ }
391
+ /**
392
+ * @returns {string}
393
+ */
394
+ get version() {
395
+ let deferred1_0;
396
+ let deferred1_1;
397
+ try {
398
+ const ret = wasm.audioinfo_version(this.__wbg_ptr);
399
+ deferred1_0 = ret[0];
400
+ deferred1_1 = ret[1];
401
+ return getStringFromWasm0(ret[0], ret[1]);
402
+ } finally {
403
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
404
+ }
405
+ }
406
+ }
407
+ if (Symbol.dispose) AudioInfo.prototype[Symbol.dispose] = AudioInfo.prototype.free;
408
+
409
+ export class WasmStreamingDecoder {
410
+ __destroy_into_raw() {
411
+ const ptr = this.__wbg_ptr;
412
+ this.__wbg_ptr = 0;
413
+ WasmStreamingDecoderFinalization.unregister(this);
414
+ return ptr;
415
+ }
416
+ free() {
417
+ const ptr = this.__destroy_into_raw();
418
+ wasm.__wbg_wasmstreamingdecoder_free(ptr, 0);
419
+ }
420
+ /**
421
+ * Decode the next available frame
422
+ *
423
+ * Returns interleaved f32 samples for one frame, or null if no frame is ready.
424
+ * This enables true streaming: decode and play frames as they arrive.
425
+ *
426
+ * Usage pattern:
427
+ * ```js
428
+ * while (true) {
429
+ * const samples = decoder.next_frame();
430
+ * if (samples === null) break; // No more frames ready
431
+ * playAudio(samples);
432
+ * }
433
+ * ```
434
+ * @returns {any}
435
+ */
436
+ next_frame() {
437
+ const ret = wasm.wasmstreamingdecoder_next_frame(this.__wbg_ptr);
438
+ if (ret[2]) {
439
+ throw takeFromExternrefTable0(ret[1]);
440
+ }
441
+ return takeFromExternrefTable0(ret[0]);
442
+ }
443
+ /**
444
+ * stream done?
445
+ * @returns {boolean}
446
+ */
447
+ is_finished() {
448
+ const ret = wasm.wasmstreamingdecoder_is_finished(this.__wbg_ptr);
449
+ return ret !== 0;
450
+ }
451
+ /**
452
+ * bytes currently buffered
453
+ * @returns {number}
454
+ */
455
+ buffered_bytes() {
456
+ const ret = wasm.wasmstreamingdecoder_buffered_bytes(this.__wbg_ptr);
457
+ return ret >>> 0;
458
+ }
459
+ /**
460
+ * how many frames ready to decode
461
+ * @returns {number}
462
+ */
463
+ available_frames() {
464
+ const ret = wasm.wasmstreamingdecoder_available_frames(this.__wbg_ptr);
465
+ return ret >>> 0;
466
+ }
467
+ /**
468
+ * decode all currently available samples
469
+ * @returns {Float32Array}
470
+ */
471
+ decode_available() {
472
+ const ret = wasm.wasmstreamingdecoder_decode_available(this.__wbg_ptr);
473
+ if (ret[3]) {
474
+ throw takeFromExternrefTable0(ret[2]);
475
+ }
476
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
477
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
478
+ return v1;
479
+ }
480
+ /**
481
+ * current frame index
482
+ * @returns {number}
483
+ */
484
+ current_frame_index() {
485
+ const ret = wasm.wasmstreamingdecoder_current_frame_index(this.__wbg_ptr);
486
+ return ret >>> 0;
487
+ }
488
+ /**
489
+ * new streaming decoder
490
+ */
491
+ constructor() {
492
+ const ret = wasm.wasmstreamingdecoder_new();
493
+ this.__wbg_ptr = ret >>> 0;
494
+ WasmStreamingDecoderFinalization.register(this, this.__wbg_ptr, this);
495
+ return this;
496
+ }
497
+ /**
498
+ * feed data to the decoder, call as bytes come in from network
499
+ * @param {Uint8Array} data
500
+ * @returns {boolean}
501
+ */
502
+ feed(data) {
503
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
504
+ const len0 = WASM_VECTOR_LEN;
505
+ const ret = wasm.wasmstreamingdecoder_feed(this.__wbg_ptr, ptr0, len0);
506
+ if (ret[2]) {
507
+ throw takeFromExternrefTable0(ret[1]);
508
+ }
509
+ return ret[0] !== 0;
510
+ }
511
+ /**
512
+ * Reset the decoder to initial state
513
+ *
514
+ * Use this to start decoding a new stream.
515
+ */
516
+ reset() {
517
+ wasm.wasmstreamingdecoder_reset(this.__wbg_ptr);
518
+ }
519
+ /**
520
+ * Get the current state as a string
521
+ * @returns {string}
522
+ */
523
+ state() {
524
+ let deferred1_0;
525
+ let deferred1_1;
526
+ try {
527
+ const ret = wasm.wasmstreamingdecoder_state(this.__wbg_ptr);
528
+ deferred1_0 = ret[0];
529
+ deferred1_1 = ret[1];
530
+ return getStringFromWasm0(ret[0], ret[1]);
531
+ } finally {
532
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
533
+ }
534
+ }
535
+ /**
536
+ * Get audio information (available after header is parsed)
537
+ *
538
+ * Returns null if header hasn't been parsed yet.
539
+ * @returns {any}
540
+ */
541
+ get_info() {
542
+ const ret = wasm.wasmstreamingdecoder_get_info(this.__wbg_ptr);
543
+ if (ret[2]) {
544
+ throw takeFromExternrefTable0(ret[1]);
545
+ }
546
+ return takeFromExternrefTable0(ret[0]);
547
+ }
548
+ /**
549
+ * Check if the decoder is ready to produce audio
550
+ * @returns {boolean}
551
+ */
552
+ is_ready() {
553
+ const ret = wasm.wasmstreamingdecoder_is_ready(this.__wbg_ptr);
554
+ return ret !== 0;
555
+ }
556
+ /**
557
+ * Check if there was an error
558
+ * @returns {boolean}
559
+ */
560
+ has_error() {
561
+ const ret = wasm.wasmstreamingdecoder_has_error(this.__wbg_ptr);
562
+ return ret !== 0;
563
+ }
564
+ }
565
+ if (Symbol.dispose) WasmStreamingDecoder.prototype[Symbol.dispose] = WasmStreamingDecoder.prototype.free;
566
+
567
+ /**
568
+ * Create metadata from basic fields and serialize to MessagePack
569
+ *
570
+ * # Arguments
571
+ * * `title` - Optional title
572
+ * * `artist` - Optional artist
573
+ * * `album` - Optional album
574
+ *
575
+ * # Returns
576
+ * MessagePack bytes containing metadata
577
+ * @param {string | null} [title]
578
+ * @param {string | null} [artist]
579
+ * @param {string | null} [album]
580
+ * @returns {Uint8Array}
581
+ */
582
+ export function create_metadata(title, artist, album) {
583
+ var ptr0 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
584
+ var len0 = WASM_VECTOR_LEN;
585
+ var ptr1 = isLikeNone(artist) ? 0 : passStringToWasm0(artist, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
586
+ var len1 = WASM_VECTOR_LEN;
587
+ var ptr2 = isLikeNone(album) ? 0 : passStringToWasm0(album, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
588
+ var len2 = WASM_VECTOR_LEN;
589
+ const ret = wasm.create_metadata(ptr0, len0, ptr1, len1, ptr2, len2);
590
+ if (ret[3]) {
591
+ throw takeFromExternrefTable0(ret[2]);
592
+ }
593
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
594
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
595
+ return v4;
596
+ }
597
+
598
+ /**
599
+ * Create metadata from a JavaScript object
600
+ *
601
+ * Accepts an object with any of the supported metadata fields.
602
+ * See FloMetadata for available fields.
603
+ *
604
+ * # Returns
605
+ * MessagePack bytes containing metadata
606
+ * @param {any} obj
607
+ * @returns {Uint8Array}
608
+ */
609
+ export function create_metadata_from_object(obj) {
610
+ const ret = wasm.create_metadata_from_object(obj);
611
+ if (ret[3]) {
612
+ throw takeFromExternrefTable0(ret[2]);
613
+ }
614
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
615
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
616
+ return v1;
617
+ }
618
+
619
+ /**
620
+ * decode flo file to samples
621
+ *
622
+ * This automatically detects whether the file uses lossless or lossy encoding
623
+ * and dispatches to the appropriate decoder.
624
+ *
625
+ * # Arguments
626
+ * * `data` - flo™ file bytes
627
+ *
628
+ * # Returns
629
+ * Interleaved audio samples (f32, -1.0 to 1.0)
630
+ * @param {Uint8Array} data
631
+ * @returns {Float32Array}
632
+ */
633
+ export function decode(data) {
634
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
635
+ const len0 = WASM_VECTOR_LEN;
636
+ const ret = wasm.decode(ptr0, len0);
637
+ if (ret[3]) {
638
+ throw takeFromExternrefTable0(ret[2]);
639
+ }
640
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
641
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
642
+ return v2;
643
+ }
644
+
645
+ /**
646
+ * encode samples to flo lossless
647
+ *
648
+ * # Arguments
649
+ * * `samples` - Interleaved audio samples (f32, -1.0 to 1.0)
650
+ * * `sample_rate` - Sample rate in Hz (e.g., 44100)
651
+ * * `channels` - Number of channels (1 or 2)
652
+ * * `bit_depth` - Bits per sample (16, 24, or 32)
653
+ * * `metadata` - Optional MessagePack metadata
654
+ *
655
+ * # Returns
656
+ * flo™ file as byte array
657
+ *
658
+ * # Note
659
+ * For advanced usage with custom compression levels (0-9),
660
+ * use the `Encoder` builder pattern directly.
661
+ * @param {Float32Array} samples
662
+ * @param {number} sample_rate
663
+ * @param {number} channels
664
+ * @param {number} bit_depth
665
+ * @param {Uint8Array | null} [metadata]
666
+ * @returns {Uint8Array}
667
+ */
668
+ export function encode(samples, sample_rate, channels, bit_depth, metadata) {
669
+ const ptr0 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
670
+ const len0 = WASM_VECTOR_LEN;
671
+ var ptr1 = isLikeNone(metadata) ? 0 : passArray8ToWasm0(metadata, wasm.__wbindgen_malloc);
672
+ var len1 = WASM_VECTOR_LEN;
673
+ const ret = wasm.encode(ptr0, len0, sample_rate, channels, bit_depth, ptr1, len1);
674
+ if (ret[3]) {
675
+ throw takeFromExternrefTable0(ret[2]);
676
+ }
677
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
678
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
679
+ return v3;
680
+ }
681
+
682
+ /**
683
+ * encode samples to flo lossy
684
+ *
685
+ * # Arguments
686
+ * * `samples` - Interleaved audio samples (f32, -1.0 to 1.0)
687
+ * * `sample_rate` - Sample rate in Hz (e.g., 44100)
688
+ * * `channels` - Number of audio channels (1 or 2)
689
+ * * `bit_depth` - Bits per sample (typically 16)
690
+ * * `quality` - Quality level 0-4 (0=low/~64kbps, 4=transparent/~320kbps)
691
+ * * `metadata` - Optional MessagePack metadata
692
+ *
693
+ * # Returns
694
+ * flo™ file as byte array
695
+ *
696
+ * # Note
697
+ * For advanced usage with continuous quality control (0.0-1.0) or custom settings,
698
+ * use the `LossyEncoder` builder pattern directly.
699
+ * @param {Float32Array} samples
700
+ * @param {number} sample_rate
701
+ * @param {number} channels
702
+ * @param {number} _bit_depth
703
+ * @param {number} quality
704
+ * @param {Uint8Array | null} [metadata]
705
+ * @returns {Uint8Array}
706
+ */
707
+ export function encode_lossy(samples, sample_rate, channels, _bit_depth, quality, metadata) {
708
+ const ptr0 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
709
+ const len0 = WASM_VECTOR_LEN;
710
+ var ptr1 = isLikeNone(metadata) ? 0 : passArray8ToWasm0(metadata, wasm.__wbindgen_malloc);
711
+ var len1 = WASM_VECTOR_LEN;
712
+ const ret = wasm.encode_lossy(ptr0, len0, sample_rate, channels, _bit_depth, quality, ptr1, len1);
713
+ if (ret[3]) {
714
+ throw takeFromExternrefTable0(ret[2]);
715
+ }
716
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
717
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
718
+ return v3;
719
+ }
720
+
721
+ /**
722
+ * encode to flo lossy with target bitrate
723
+ *
724
+ * # Arguments
725
+ * * `samples` - Interleaved audio samples (f32, -1.0 to 1.0)
726
+ * * `sample_rate` - Sample rate in Hz (e.g., 44100)
727
+ * * `channels` - Number of audio channels
728
+ * * `bit_depth` - Bits per sample (16, 24, or 32)
729
+ * * `target_bitrate_kbps` - Target bitrate in kbps (e.g., 128, 192, 256, 320)
730
+ * * `metadata` - Optional MessagePack metadata
731
+ *
732
+ * # Returns
733
+ * flo™ file as byte array
734
+ * @param {Float32Array} samples
735
+ * @param {number} sample_rate
736
+ * @param {number} channels
737
+ * @param {number} _bit_depth
738
+ * @param {number} target_bitrate_kbps
739
+ * @param {Uint8Array | null} [metadata]
740
+ * @returns {Uint8Array}
741
+ */
742
+ export function encode_with_bitrate(samples, sample_rate, channels, _bit_depth, target_bitrate_kbps, metadata) {
743
+ const ptr0 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
744
+ const len0 = WASM_VECTOR_LEN;
745
+ var ptr1 = isLikeNone(metadata) ? 0 : passArray8ToWasm0(metadata, wasm.__wbindgen_malloc);
746
+ var len1 = WASM_VECTOR_LEN;
747
+ const ret = wasm.encode_with_bitrate(ptr0, len0, sample_rate, channels, _bit_depth, target_bitrate_kbps, ptr1, len1);
748
+ if (ret[3]) {
749
+ throw takeFromExternrefTable0(ret[2]);
750
+ }
751
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
752
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
753
+ return v3;
754
+ }
755
+
756
+ /**
757
+ * Get cover art from a flo™ file
758
+ *
759
+ * # Arguments
760
+ * * `data` - flo™ file bytes
761
+ *
762
+ * # Returns
763
+ * Object with `mime_type` and `data` (Uint8Array) or null if no cover
764
+ * @param {Uint8Array} data
765
+ * @returns {any}
766
+ */
767
+ export function get_cover_art(data) {
768
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
769
+ const len0 = WASM_VECTOR_LEN;
770
+ const ret = wasm.get_cover_art(ptr0, len0);
771
+ if (ret[2]) {
772
+ throw takeFromExternrefTable0(ret[1]);
773
+ }
774
+ return takeFromExternrefTable0(ret[0]);
775
+ }
776
+
777
+ /**
778
+ * Extract metadata from a flo™ file
779
+ *
780
+ * # Arguments
781
+ * * `data` - flo™ file bytes
782
+ *
783
+ * # Returns
784
+ * JavaScript object with metadata fields (or null if no metadata)
785
+ * @param {Uint8Array} data
786
+ * @returns {any}
787
+ */
788
+ export function get_metadata(data) {
789
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
790
+ const len0 = WASM_VECTOR_LEN;
791
+ const ret = wasm.get_metadata(ptr0, len0);
792
+ if (ret[2]) {
793
+ throw takeFromExternrefTable0(ret[1]);
794
+ }
795
+ return takeFromExternrefTable0(ret[0]);
796
+ }
797
+
798
+ /**
799
+ * Get just the metadata bytes from a flo™ file
800
+ *
801
+ * # Arguments
802
+ * * `flo_data` - flo™ file bytes
803
+ *
804
+ * # Returns
805
+ * Raw MessagePack metadata bytes (or empty array)
806
+ * @param {Uint8Array} flo_data
807
+ * @returns {Uint8Array}
808
+ */
809
+ export function get_metadata_bytes(flo_data) {
810
+ const ptr0 = passArray8ToWasm0(flo_data, wasm.__wbindgen_malloc);
811
+ const len0 = WASM_VECTOR_LEN;
812
+ const ret = wasm.get_metadata_bytes(ptr0, len0);
813
+ if (ret[3]) {
814
+ throw takeFromExternrefTable0(ret[2]);
815
+ }
816
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
817
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
818
+ return v2;
819
+ }
820
+
821
+ /**
822
+ * Get section markers from a flo™ file
823
+ *
824
+ * # Returns
825
+ * Array of section markers or null if none
826
+ * @param {Uint8Array} data
827
+ * @returns {any}
828
+ */
829
+ export function get_section_markers(data) {
830
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
831
+ const len0 = WASM_VECTOR_LEN;
832
+ const ret = wasm.get_section_markers(ptr0, len0);
833
+ if (ret[2]) {
834
+ throw takeFromExternrefTable0(ret[1]);
835
+ }
836
+ return takeFromExternrefTable0(ret[0]);
837
+ }
838
+
839
+ /**
840
+ * Get synced lyrics from a flo™ file
841
+ *
842
+ * # Returns
843
+ * Array of synced lyrics objects or null if none
844
+ * @param {Uint8Array} data
845
+ * @returns {any}
846
+ */
847
+ export function get_synced_lyrics(data) {
848
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
849
+ const len0 = WASM_VECTOR_LEN;
850
+ const ret = wasm.get_synced_lyrics(ptr0, len0);
851
+ if (ret[2]) {
852
+ throw takeFromExternrefTable0(ret[1]);
853
+ }
854
+ return takeFromExternrefTable0(ret[0]);
855
+ }
856
+
857
+ /**
858
+ * Get waveform data from a flo™ file for instant visualization
859
+ *
860
+ * # Returns
861
+ * WaveformData object or null if not present
862
+ * @param {Uint8Array} data
863
+ * @returns {any}
864
+ */
865
+ export function get_waveform_data(data) {
866
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
867
+ const len0 = WASM_VECTOR_LEN;
868
+ const ret = wasm.get_waveform_data(ptr0, len0);
869
+ if (ret[2]) {
870
+ throw takeFromExternrefTable0(ret[1]);
871
+ }
872
+ return takeFromExternrefTable0(ret[0]);
873
+ }
874
+
875
+ /**
876
+ * does the file have metadata?
877
+ * @param {Uint8Array} flo_data
878
+ * @returns {boolean}
879
+ */
880
+ export function has_metadata(flo_data) {
881
+ const ptr0 = passArray8ToWasm0(flo_data, wasm.__wbindgen_malloc);
882
+ const len0 = WASM_VECTOR_LEN;
883
+ const ret = wasm.has_metadata(ptr0, len0);
884
+ return ret !== 0;
885
+ }
886
+
887
+ /**
888
+ * Get information about a flo™ file
889
+ *
890
+ * # Arguments
891
+ * * `data` - flo™ file bytes
892
+ *
893
+ * # Returns
894
+ * AudioInfo struct with file details
895
+ * @param {Uint8Array} data
896
+ * @returns {AudioInfo}
897
+ */
898
+ export function info(data) {
899
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
900
+ const len0 = WASM_VECTOR_LEN;
901
+ const ret = wasm.info(ptr0, len0);
902
+ if (ret[2]) {
903
+ throw takeFromExternrefTable0(ret[1]);
904
+ }
905
+ return AudioInfo.__wrap(ret[0]);
906
+ }
907
+
908
+ /**
909
+ * Replace just the metadata in a flo™ file (convenience function)
910
+ *
911
+ * Takes a metadata object directly instead of MessagePack bytes.
912
+ *
913
+ * # Arguments
914
+ * * `flo_data` - Original flo™ file bytes
915
+ * * `metadata` - JavaScript metadata object
916
+ *
917
+ * # Returns
918
+ * New flo™ file with updated metadata
919
+ * @param {Uint8Array} flo_data
920
+ * @param {any} metadata
921
+ * @returns {Uint8Array}
922
+ */
923
+ export function set_metadata(flo_data, metadata) {
924
+ const ptr0 = passArray8ToWasm0(flo_data, wasm.__wbindgen_malloc);
925
+ const len0 = WASM_VECTOR_LEN;
926
+ const ret = wasm.set_metadata(ptr0, len0, metadata);
927
+ if (ret[3]) {
928
+ throw takeFromExternrefTable0(ret[2]);
929
+ }
930
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
931
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
932
+ return v2;
933
+ }
934
+
935
+ /**
936
+ * Set a single field in existing metadata bytes
937
+ *
938
+ * Uses serde to dynamically set fields - field names match FloMetadata struct.
939
+ * For complex fields (pictures, synced_lyrics, etc.) use create_metadata_from_object.
940
+ *
941
+ * # Arguments
942
+ * * `metadata` - Existing MessagePack metadata bytes (or empty for new)
943
+ * * `field` - Field name (e.g., "title", "artist", "bpm")
944
+ * * `value` - Field value (string, number, or null)
945
+ *
946
+ * # Returns
947
+ * Updated MessagePack metadata bytes
948
+ * @param {Uint8Array | null | undefined} metadata
949
+ * @param {string} field
950
+ * @param {any} value
951
+ * @returns {Uint8Array}
952
+ */
953
+ export function set_metadata_field(metadata, field, value) {
954
+ var ptr0 = isLikeNone(metadata) ? 0 : passArray8ToWasm0(metadata, wasm.__wbindgen_malloc);
955
+ var len0 = WASM_VECTOR_LEN;
956
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
957
+ const len1 = WASM_VECTOR_LEN;
958
+ const ret = wasm.set_metadata_field(ptr0, len0, ptr1, len1, value);
959
+ if (ret[3]) {
960
+ throw takeFromExternrefTable0(ret[2]);
961
+ }
962
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
963
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
964
+ return v3;
965
+ }
966
+
967
+ /**
968
+ * Remove all metadata from a flo™ file
969
+ *
970
+ * # Arguments
971
+ * * `flo_data` - Original flo™ file bytes
972
+ *
973
+ * # Returns
974
+ * New flo™ file with no metadata
975
+ * @param {Uint8Array} flo_data
976
+ * @returns {Uint8Array}
977
+ */
978
+ export function strip_metadata(flo_data) {
979
+ const ptr0 = passArray8ToWasm0(flo_data, wasm.__wbindgen_malloc);
980
+ const len0 = WASM_VECTOR_LEN;
981
+ const ret = wasm.strip_metadata(ptr0, len0);
982
+ if (ret[3]) {
983
+ throw takeFromExternrefTable0(ret[2]);
984
+ }
985
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
986
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
987
+ return v2;
988
+ }
989
+
990
+ /**
991
+ * update metadata without re-encoding audio
992
+ *
993
+ * # Arguments
994
+ * * `flo_data` - Original flo™ file bytes
995
+ * * `new_metadata` - New MessagePack metadata bytes (use create_metadata_*)
996
+ *
997
+ * # Returns
998
+ * New flo™ file with updated metadata
999
+ * @param {Uint8Array} flo_data
1000
+ * @param {Uint8Array} new_metadata
1001
+ * @returns {Uint8Array}
1002
+ */
1003
+ export function update_metadata(flo_data, new_metadata) {
1004
+ const ptr0 = passArray8ToWasm0(flo_data, wasm.__wbindgen_malloc);
1005
+ const len0 = WASM_VECTOR_LEN;
1006
+ const ptr1 = passArray8ToWasm0(new_metadata, wasm.__wbindgen_malloc);
1007
+ const len1 = WASM_VECTOR_LEN;
1008
+ const ret = wasm.update_metadata(ptr0, len0, ptr1, len1);
1009
+ if (ret[3]) {
1010
+ throw takeFromExternrefTable0(ret[2]);
1011
+ }
1012
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1013
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1014
+ return v3;
1015
+ }
1016
+
1017
+ /**
1018
+ * Validate flo™ file integrity
1019
+ *
1020
+ * # Arguments
1021
+ * * `data` - flo™ file bytes
1022
+ *
1023
+ * # Returns
1024
+ * true if file is valid and CRC matches
1025
+ * @param {Uint8Array} data
1026
+ * @returns {boolean}
1027
+ */
1028
+ export function validate(data) {
1029
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
1030
+ const len0 = WASM_VECTOR_LEN;
1031
+ const ret = wasm.validate(ptr0, len0);
1032
+ if (ret[2]) {
1033
+ throw takeFromExternrefTable0(ret[1]);
1034
+ }
1035
+ return ret[0] !== 0;
1036
+ }
1037
+
1038
+ /**
1039
+ * get lib version
1040
+ * @returns {string}
1041
+ */
1042
+ export function version() {
1043
+ let deferred1_0;
1044
+ let deferred1_1;
1045
+ try {
1046
+ const ret = wasm.version();
1047
+ deferred1_0 = ret[0];
1048
+ deferred1_1 = ret[1];
1049
+ return getStringFromWasm0(ret[0], ret[1]);
1050
+ } finally {
1051
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1052
+ }
1053
+ }
1054
+
1055
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1056
+
1057
+ async function __wbg_load(module, imports) {
1058
+ if (typeof Response === 'function' && module instanceof Response) {
1059
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1060
+ try {
1061
+ return await WebAssembly.instantiateStreaming(module, imports);
1062
+ } catch (e) {
1063
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1064
+
1065
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1066
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1067
+
1068
+ } else {
1069
+ throw e;
1070
+ }
1071
+ }
1072
+ }
1073
+
1074
+ const bytes = await module.arrayBuffer();
1075
+ return await WebAssembly.instantiate(bytes, imports);
1076
+ } else {
1077
+ const instance = await WebAssembly.instantiate(module, imports);
1078
+
1079
+ if (instance instanceof WebAssembly.Instance) {
1080
+ return { instance, module };
1081
+ } else {
1082
+ return instance;
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ function __wbg_get_imports() {
1088
+ const imports = {};
1089
+ imports.wbg = {};
1090
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1091
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1092
+ return ret;
1093
+ };
1094
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
1095
+ const ret = Number(arg0);
1096
+ return ret;
1097
+ };
1098
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1099
+ const ret = String(arg1);
1100
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1101
+ const len1 = WASM_VECTOR_LEN;
1102
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1103
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1104
+ };
1105
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
1106
+ const v = arg1;
1107
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1108
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1109
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1110
+ };
1111
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1112
+ const v = arg0;
1113
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1114
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1115
+ };
1116
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1117
+ const ret = debugString(arg1);
1118
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1119
+ const len1 = WASM_VECTOR_LEN;
1120
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1121
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1122
+ };
1123
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1124
+ const ret = arg0 in arg1;
1125
+ return ret;
1126
+ };
1127
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
1128
+ const ret = typeof(arg0) === 'bigint';
1129
+ return ret;
1130
+ };
1131
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
1132
+ const ret = typeof(arg0) === 'function';
1133
+ return ret;
1134
+ };
1135
+ imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
1136
+ const ret = arg0 === null;
1137
+ return ret;
1138
+ };
1139
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1140
+ const val = arg0;
1141
+ const ret = typeof(val) === 'object' && val !== null;
1142
+ return ret;
1143
+ };
1144
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1145
+ const ret = typeof(arg0) === 'string';
1146
+ return ret;
1147
+ };
1148
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1149
+ const ret = arg0 === undefined;
1150
+ return ret;
1151
+ };
1152
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
1153
+ const ret = arg0 === arg1;
1154
+ return ret;
1155
+ };
1156
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1157
+ const ret = arg0 == arg1;
1158
+ return ret;
1159
+ };
1160
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1161
+ const obj = arg1;
1162
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1163
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1164
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1165
+ };
1166
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1167
+ const obj = arg1;
1168
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1169
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1170
+ var len1 = WASM_VECTOR_LEN;
1171
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1172
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1173
+ };
1174
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1175
+ throw new Error(getStringFromWasm0(arg0, arg1));
1176
+ };
1177
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1178
+ const ret = arg0.call(arg1);
1179
+ return ret;
1180
+ }, arguments) };
1181
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1182
+ const ret = arg0.done;
1183
+ return ret;
1184
+ };
1185
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
1186
+ const ret = Object.entries(arg0);
1187
+ return ret;
1188
+ };
1189
+ imports.wbg.__wbg_from_29a8414a7a7cd19d = function(arg0) {
1190
+ const ret = Array.from(arg0);
1191
+ return ret;
1192
+ };
1193
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1194
+ const ret = arg0[arg1 >>> 0];
1195
+ return ret;
1196
+ };
1197
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1198
+ const ret = Reflect.get(arg0, arg1);
1199
+ return ret;
1200
+ }, arguments) };
1201
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1202
+ const ret = arg0[arg1];
1203
+ return ret;
1204
+ };
1205
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1206
+ let result;
1207
+ try {
1208
+ result = arg0 instanceof ArrayBuffer;
1209
+ } catch (_) {
1210
+ result = false;
1211
+ }
1212
+ const ret = result;
1213
+ return ret;
1214
+ };
1215
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1216
+ let result;
1217
+ try {
1218
+ result = arg0 instanceof Uint8Array;
1219
+ } catch (_) {
1220
+ result = false;
1221
+ }
1222
+ const ret = result;
1223
+ return ret;
1224
+ };
1225
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1226
+ const ret = Array.isArray(arg0);
1227
+ return ret;
1228
+ };
1229
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1230
+ const ret = Number.isSafeInteger(arg0);
1231
+ return ret;
1232
+ };
1233
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
1234
+ const ret = Symbol.iterator;
1235
+ return ret;
1236
+ };
1237
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1238
+ const ret = arg0.length;
1239
+ return ret;
1240
+ };
1241
+ imports.wbg.__wbg_length_86ce4877baf913bb = function(arg0) {
1242
+ const ret = arg0.length;
1243
+ return ret;
1244
+ };
1245
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1246
+ const ret = arg0.length;
1247
+ return ret;
1248
+ };
1249
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1250
+ const ret = new Object();
1251
+ return ret;
1252
+ };
1253
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1254
+ const ret = new Array();
1255
+ return ret;
1256
+ };
1257
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1258
+ const ret = new Uint8Array(arg0);
1259
+ return ret;
1260
+ };
1261
+ imports.wbg.__wbg_new_b546ae120718850e = function() {
1262
+ const ret = new Map();
1263
+ return ret;
1264
+ };
1265
+ imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
1266
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1267
+ return ret;
1268
+ };
1269
+ imports.wbg.__wbg_new_with_length_95ba657dfb7d3dfb = function(arg0) {
1270
+ const ret = new Float32Array(arg0 >>> 0);
1271
+ return ret;
1272
+ };
1273
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1274
+ const ret = arg0.next;
1275
+ return ret;
1276
+ };
1277
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1278
+ const ret = arg0.next();
1279
+ return ret;
1280
+ }, arguments) };
1281
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1282
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1283
+ };
1284
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1285
+ arg0[arg1] = arg2;
1286
+ };
1287
+ imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
1288
+ const ret = Reflect.set(arg0, arg1, arg2);
1289
+ return ret;
1290
+ }, arguments) };
1291
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1292
+ arg0[arg1 >>> 0] = arg2;
1293
+ };
1294
+ imports.wbg.__wbg_set_cb0e657d1901c8d8 = function(arg0, arg1, arg2) {
1295
+ arg0.set(getArrayF32FromWasm0(arg1, arg2));
1296
+ };
1297
+ imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1298
+ const ret = arg0.set(arg1, arg2);
1299
+ return ret;
1300
+ };
1301
+ imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
1302
+ const ret = JSON.stringify(arg0);
1303
+ return ret;
1304
+ }, arguments) };
1305
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1306
+ const ret = arg0.value;
1307
+ return ret;
1308
+ };
1309
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1310
+ // Cast intrinsic for `Ref(String) -> Externref`.
1311
+ const ret = getStringFromWasm0(arg0, arg1);
1312
+ return ret;
1313
+ };
1314
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1315
+ // Cast intrinsic for `U64 -> Externref`.
1316
+ const ret = BigInt.asUintN(64, arg0);
1317
+ return ret;
1318
+ };
1319
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1320
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1321
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1322
+ return ret;
1323
+ };
1324
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1325
+ // Cast intrinsic for `F64 -> Externref`.
1326
+ const ret = arg0;
1327
+ return ret;
1328
+ };
1329
+ imports.wbg.__wbindgen_init_externref_table = function() {
1330
+ const table = wasm.__wbindgen_externrefs;
1331
+ const offset = table.grow(4);
1332
+ table.set(0, undefined);
1333
+ table.set(offset + 0, undefined);
1334
+ table.set(offset + 1, null);
1335
+ table.set(offset + 2, true);
1336
+ table.set(offset + 3, false);
1337
+ };
1338
+
1339
+ return imports;
1340
+ }
1341
+
1342
+ function __wbg_finalize_init(instance, module) {
1343
+ wasm = instance.exports;
1344
+ __wbg_init.__wbindgen_wasm_module = module;
1345
+ cachedDataViewMemory0 = null;
1346
+ cachedFloat32ArrayMemory0 = null;
1347
+ cachedUint8ArrayMemory0 = null;
1348
+
1349
+
1350
+ wasm.__wbindgen_start();
1351
+ return wasm;
1352
+ }
1353
+
1354
+ function initSync(module) {
1355
+ if (wasm !== undefined) return wasm;
1356
+
1357
+
1358
+ if (typeof module !== 'undefined') {
1359
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1360
+ ({module} = module)
1361
+ } else {
1362
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1363
+ }
1364
+ }
1365
+
1366
+ const imports = __wbg_get_imports();
1367
+ if (!(module instanceof WebAssembly.Module)) {
1368
+ module = new WebAssembly.Module(module);
1369
+ }
1370
+ const instance = new WebAssembly.Instance(module, imports);
1371
+ return __wbg_finalize_init(instance, module);
1372
+ }
1373
+
1374
+ async function __wbg_init(module_or_path) {
1375
+ if (wasm !== undefined) return wasm;
1376
+
1377
+
1378
+ if (typeof module_or_path !== 'undefined') {
1379
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1380
+ ({module_or_path} = module_or_path)
1381
+ } else {
1382
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1383
+ }
1384
+ }
1385
+
1386
+ if (typeof module_or_path === 'undefined') {
1387
+ module_or_path = new URL('libflo_audio_bg.wasm', import.meta.url);
1388
+ }
1389
+ const imports = __wbg_get_imports();
1390
+
1391
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1392
+ module_or_path = fetch(module_or_path);
1393
+ }
1394
+
1395
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1396
+
1397
+ return __wbg_finalize_init(instance, module);
1398
+ }
1399
+
1400
+ export { initSync };
1401
+ export default __wbg_init;