kordweb 0.5.4
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/LICENSE +21 -0
- package/README.md +224 -0
- package/klib.d.ts +254 -0
- package/klib.js +1039 -0
- package/klib_bg.wasm +0 -0
- package/package.json +31 -0
package/klib.js
ADDED
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
const lAudioContext = (typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : undefined));
|
|
2
|
+
let wasm;
|
|
3
|
+
|
|
4
|
+
const heap = new Array(128).fill(undefined);
|
|
5
|
+
|
|
6
|
+
heap.push(undefined, null, true, false);
|
|
7
|
+
|
|
8
|
+
function getObject(idx) { return heap[idx]; }
|
|
9
|
+
|
|
10
|
+
let heap_next = heap.length;
|
|
11
|
+
|
|
12
|
+
function dropObject(idx) {
|
|
13
|
+
if (idx < 132) return;
|
|
14
|
+
heap[idx] = heap_next;
|
|
15
|
+
heap_next = idx;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function takeObject(idx) {
|
|
19
|
+
const ret = getObject(idx);
|
|
20
|
+
dropObject(idx);
|
|
21
|
+
return ret;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
25
|
+
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
|
|
28
|
+
let cachedUint8Memory0 = null;
|
|
29
|
+
|
|
30
|
+
function getUint8Memory0() {
|
|
31
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
32
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
33
|
+
}
|
|
34
|
+
return cachedUint8Memory0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getStringFromWasm0(ptr, len) {
|
|
38
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function addHeapObject(obj) {
|
|
42
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
+
const idx = heap_next;
|
|
44
|
+
heap_next = heap[idx];
|
|
45
|
+
|
|
46
|
+
heap[idx] = obj;
|
|
47
|
+
return idx;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function debugString(val) {
|
|
51
|
+
// primitive types
|
|
52
|
+
const type = typeof val;
|
|
53
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
54
|
+
return `${val}`;
|
|
55
|
+
}
|
|
56
|
+
if (type == 'string') {
|
|
57
|
+
return `"${val}"`;
|
|
58
|
+
}
|
|
59
|
+
if (type == 'symbol') {
|
|
60
|
+
const description = val.description;
|
|
61
|
+
if (description == null) {
|
|
62
|
+
return 'Symbol';
|
|
63
|
+
} else {
|
|
64
|
+
return `Symbol(${description})`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (type == 'function') {
|
|
68
|
+
const name = val.name;
|
|
69
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
70
|
+
return `Function(${name})`;
|
|
71
|
+
} else {
|
|
72
|
+
return 'Function';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// objects
|
|
76
|
+
if (Array.isArray(val)) {
|
|
77
|
+
const length = val.length;
|
|
78
|
+
let debug = '[';
|
|
79
|
+
if (length > 0) {
|
|
80
|
+
debug += debugString(val[0]);
|
|
81
|
+
}
|
|
82
|
+
for(let i = 1; i < length; i++) {
|
|
83
|
+
debug += ', ' + debugString(val[i]);
|
|
84
|
+
}
|
|
85
|
+
debug += ']';
|
|
86
|
+
return debug;
|
|
87
|
+
}
|
|
88
|
+
// Test for built-in
|
|
89
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
90
|
+
let className;
|
|
91
|
+
if (builtInMatches.length > 1) {
|
|
92
|
+
className = builtInMatches[1];
|
|
93
|
+
} else {
|
|
94
|
+
// Failed to match the standard '[object ClassName]'
|
|
95
|
+
return toString.call(val);
|
|
96
|
+
}
|
|
97
|
+
if (className == 'Object') {
|
|
98
|
+
// we're a user defined class or Object
|
|
99
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
100
|
+
// easier than looping through ownProperties of `val`.
|
|
101
|
+
try {
|
|
102
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
103
|
+
} catch (_) {
|
|
104
|
+
return 'Object';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// errors
|
|
108
|
+
if (val instanceof Error) {
|
|
109
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
110
|
+
}
|
|
111
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
112
|
+
return className;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let WASM_VECTOR_LEN = 0;
|
|
116
|
+
|
|
117
|
+
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
118
|
+
|
|
119
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
120
|
+
? function (arg, view) {
|
|
121
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
122
|
+
}
|
|
123
|
+
: function (arg, view) {
|
|
124
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
125
|
+
view.set(buf);
|
|
126
|
+
return {
|
|
127
|
+
read: arg.length,
|
|
128
|
+
written: buf.length
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
133
|
+
|
|
134
|
+
if (realloc === undefined) {
|
|
135
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
136
|
+
const ptr = malloc(buf.length);
|
|
137
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
138
|
+
WASM_VECTOR_LEN = buf.length;
|
|
139
|
+
return ptr;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let len = arg.length;
|
|
143
|
+
let ptr = malloc(len);
|
|
144
|
+
|
|
145
|
+
const mem = getUint8Memory0();
|
|
146
|
+
|
|
147
|
+
let offset = 0;
|
|
148
|
+
|
|
149
|
+
for (; offset < len; offset++) {
|
|
150
|
+
const code = arg.charCodeAt(offset);
|
|
151
|
+
if (code > 0x7F) break;
|
|
152
|
+
mem[ptr + offset] = code;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (offset !== len) {
|
|
156
|
+
if (offset !== 0) {
|
|
157
|
+
arg = arg.slice(offset);
|
|
158
|
+
}
|
|
159
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
160
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
161
|
+
const ret = encodeString(arg, view);
|
|
162
|
+
|
|
163
|
+
offset += ret.written;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
WASM_VECTOR_LEN = offset;
|
|
167
|
+
return ptr;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let cachedInt32Memory0 = null;
|
|
171
|
+
|
|
172
|
+
function getInt32Memory0() {
|
|
173
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
174
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
175
|
+
}
|
|
176
|
+
return cachedInt32Memory0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const CLOSURE_DTORS = new FinalizationRegistry(state => {
|
|
180
|
+
wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
184
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
185
|
+
const real = (...args) => {
|
|
186
|
+
// First up with a closure we increment the internal reference
|
|
187
|
+
// count. This ensures that the Rust closure environment won't
|
|
188
|
+
// be deallocated while we're invoking it.
|
|
189
|
+
state.cnt++;
|
|
190
|
+
const a = state.a;
|
|
191
|
+
state.a = 0;
|
|
192
|
+
try {
|
|
193
|
+
return f(a, state.b, ...args);
|
|
194
|
+
} finally {
|
|
195
|
+
if (--state.cnt === 0) {
|
|
196
|
+
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
|
197
|
+
CLOSURE_DTORS.unregister(state)
|
|
198
|
+
} else {
|
|
199
|
+
state.a = a;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
real.original = state;
|
|
204
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
205
|
+
return real;
|
|
206
|
+
}
|
|
207
|
+
function __wbg_adapter_20(arg0, arg1, arg2) {
|
|
208
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h747aa41a80ad2697(arg0, arg1, addHeapObject(arg2));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function __wbg_adapter_23(arg0, arg1) {
|
|
212
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heeae151cfd26f044(arg0, arg1);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
let cachedFloat32Memory0 = null;
|
|
216
|
+
|
|
217
|
+
function getFloat32Memory0() {
|
|
218
|
+
if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
|
|
219
|
+
cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
|
|
220
|
+
}
|
|
221
|
+
return cachedFloat32Memory0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function passArrayF32ToWasm0(arg, malloc) {
|
|
225
|
+
const ptr = malloc(arg.length * 4);
|
|
226
|
+
getFloat32Memory0().set(arg, ptr / 4);
|
|
227
|
+
WASM_VECTOR_LEN = arg.length;
|
|
228
|
+
return ptr;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function _assertClass(instance, klass) {
|
|
232
|
+
if (!(instance instanceof klass)) {
|
|
233
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
234
|
+
}
|
|
235
|
+
return instance.ptr;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function handleError(f, args) {
|
|
239
|
+
try {
|
|
240
|
+
return f.apply(this, args);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
247
|
+
return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
248
|
+
}
|
|
249
|
+
function __wbg_adapter_91(arg0, arg1, arg2, arg3) {
|
|
250
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h768f6593dd414d73(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const KordChordFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordchord_free(ptr));
|
|
254
|
+
/**
|
|
255
|
+
* The [`Chord`] wrapper.
|
|
256
|
+
*/
|
|
257
|
+
export class KordChord {
|
|
258
|
+
|
|
259
|
+
static __wrap(ptr) {
|
|
260
|
+
const obj = Object.create(KordChord.prototype);
|
|
261
|
+
obj.ptr = ptr;
|
|
262
|
+
KordChordFinalization.register(obj, obj.ptr, obj);
|
|
263
|
+
return obj;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
__destroy_into_raw() {
|
|
267
|
+
const ptr = this.ptr;
|
|
268
|
+
this.ptr = 0;
|
|
269
|
+
KordChordFinalization.unregister(this);
|
|
270
|
+
return ptr;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
free() {
|
|
274
|
+
const ptr = this.__destroy_into_raw();
|
|
275
|
+
wasm.__wbg_kordchord_free(ptr);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Creates a new [`Chord`] from a frequency.
|
|
279
|
+
* @param {string} name
|
|
280
|
+
* @returns {KordChord}
|
|
281
|
+
*/
|
|
282
|
+
static parse(name) {
|
|
283
|
+
try {
|
|
284
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
285
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
287
|
+
wasm.kordchord_parse(retptr, ptr0, len0);
|
|
288
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
289
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
290
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
291
|
+
if (r2) {
|
|
292
|
+
throw takeObject(r1);
|
|
293
|
+
}
|
|
294
|
+
return KordChord.__wrap(r0);
|
|
295
|
+
} finally {
|
|
296
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Creates a new [`Chord`] from a set of [`Note`]s.
|
|
301
|
+
*
|
|
302
|
+
* The [`Note`]s should be represented as a space-separated string.
|
|
303
|
+
* E.g., `C E G`.
|
|
304
|
+
* @param {string} notes
|
|
305
|
+
* @returns {KordChords}
|
|
306
|
+
*/
|
|
307
|
+
static from_notes_string(notes) {
|
|
308
|
+
try {
|
|
309
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
310
|
+
const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
311
|
+
const len0 = WASM_VECTOR_LEN;
|
|
312
|
+
wasm.kordchord_from_notes_string(retptr, ptr0, len0);
|
|
313
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
314
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
315
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
316
|
+
if (r2) {
|
|
317
|
+
throw takeObject(r1);
|
|
318
|
+
}
|
|
319
|
+
return KordChords.__wrap(r0);
|
|
320
|
+
} finally {
|
|
321
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Creates a new [`Chord`] from a set of [`Note`]s.
|
|
326
|
+
* @param {KordNotes} notes
|
|
327
|
+
* @returns {KordChords}
|
|
328
|
+
*/
|
|
329
|
+
static from_notes(notes) {
|
|
330
|
+
try {
|
|
331
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
332
|
+
_assertClass(notes, KordNotes);
|
|
333
|
+
var ptr0 = notes.__destroy_into_raw();
|
|
334
|
+
wasm.kordchord_from_notes(retptr, ptr0);
|
|
335
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
336
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
337
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
338
|
+
if (r2) {
|
|
339
|
+
throw takeObject(r1);
|
|
340
|
+
}
|
|
341
|
+
return KordChords.__wrap(r0);
|
|
342
|
+
} finally {
|
|
343
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Returns the [`Chord`]'s friendly name.
|
|
348
|
+
* @returns {string}
|
|
349
|
+
*/
|
|
350
|
+
name() {
|
|
351
|
+
try {
|
|
352
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
353
|
+
wasm.kordchord_name(retptr, this.ptr);
|
|
354
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
355
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
356
|
+
return getStringFromWasm0(r0, r1);
|
|
357
|
+
} finally {
|
|
358
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
359
|
+
wasm.__wbindgen_free(r0, r1);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the [`Chord`]'s precise name.
|
|
364
|
+
* @returns {string}
|
|
365
|
+
*/
|
|
366
|
+
precise_name() {
|
|
367
|
+
try {
|
|
368
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
369
|
+
wasm.kordchord_precise_name(retptr, this.ptr);
|
|
370
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
371
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
372
|
+
return getStringFromWasm0(r0, r1);
|
|
373
|
+
} finally {
|
|
374
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
375
|
+
wasm.__wbindgen_free(r0, r1);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Returns the [`Chord`]'s description.
|
|
380
|
+
* @returns {string}
|
|
381
|
+
*/
|
|
382
|
+
description() {
|
|
383
|
+
try {
|
|
384
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
|
+
wasm.kordchord_description(retptr, this.ptr);
|
|
386
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
387
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
388
|
+
return getStringFromWasm0(r0, r1);
|
|
389
|
+
} finally {
|
|
390
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
391
|
+
wasm.__wbindgen_free(r0, r1);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Returns the [`Chord`]'s display text.
|
|
396
|
+
* @returns {string}
|
|
397
|
+
*/
|
|
398
|
+
display() {
|
|
399
|
+
try {
|
|
400
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
401
|
+
wasm.kordchord_display(retptr, this.ptr);
|
|
402
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
403
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
404
|
+
return getStringFromWasm0(r0, r1);
|
|
405
|
+
} finally {
|
|
406
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
407
|
+
wasm.__wbindgen_free(r0, r1);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Returns the [`Chord`]'s root note.
|
|
412
|
+
* @returns {string}
|
|
413
|
+
*/
|
|
414
|
+
root() {
|
|
415
|
+
try {
|
|
416
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
417
|
+
wasm.kordchord_root(retptr, this.ptr);
|
|
418
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
419
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
420
|
+
return getStringFromWasm0(r0, r1);
|
|
421
|
+
} finally {
|
|
422
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
423
|
+
wasm.__wbindgen_free(r0, r1);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Returns the [`Chord`]'s slash note.
|
|
428
|
+
* @returns {string}
|
|
429
|
+
*/
|
|
430
|
+
slash() {
|
|
431
|
+
try {
|
|
432
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
433
|
+
wasm.kordchord_slash(retptr, this.ptr);
|
|
434
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
435
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
436
|
+
return getStringFromWasm0(r0, r1);
|
|
437
|
+
} finally {
|
|
438
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
439
|
+
wasm.__wbindgen_free(r0, r1);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Returns the [`Chord`]'s inversion.
|
|
444
|
+
* @returns {number}
|
|
445
|
+
*/
|
|
446
|
+
inversion() {
|
|
447
|
+
const ret = wasm.kordchord_inversion(this.ptr);
|
|
448
|
+
return ret;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Returns whether or not the [`Chord`] is "crunchy".
|
|
452
|
+
* @returns {boolean}
|
|
453
|
+
*/
|
|
454
|
+
is_crunchy() {
|
|
455
|
+
const ret = wasm.kordchord_is_crunchy(this.ptr);
|
|
456
|
+
return ret !== 0;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Returns the [`Chord`]'s chord tones.
|
|
460
|
+
* @returns {KordNotes}
|
|
461
|
+
*/
|
|
462
|
+
chord() {
|
|
463
|
+
const ret = wasm.kordchord_chord(this.ptr);
|
|
464
|
+
return KordNotes.__wrap(ret);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Returns the [`Chord`]'s chord tones as a string.
|
|
468
|
+
* @returns {string}
|
|
469
|
+
*/
|
|
470
|
+
chord_string() {
|
|
471
|
+
try {
|
|
472
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
473
|
+
wasm.kordchord_chord_string(retptr, this.ptr);
|
|
474
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
475
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
476
|
+
return getStringFromWasm0(r0, r1);
|
|
477
|
+
} finally {
|
|
478
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
479
|
+
wasm.__wbindgen_free(r0, r1);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Returns the [`Chord`]'s scale tones.
|
|
484
|
+
* @returns {KordNotes}
|
|
485
|
+
*/
|
|
486
|
+
scale() {
|
|
487
|
+
const ret = wasm.kordchord_scale(this.ptr);
|
|
488
|
+
return KordNotes.__wrap(ret);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Returns the [`Chord`]'s scale tones as a string.
|
|
492
|
+
* @returns {string}
|
|
493
|
+
*/
|
|
494
|
+
scale_string() {
|
|
495
|
+
try {
|
|
496
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
497
|
+
wasm.kordchord_scale_string(retptr, this.ptr);
|
|
498
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
499
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
500
|
+
return getStringFromWasm0(r0, r1);
|
|
501
|
+
} finally {
|
|
502
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
503
|
+
wasm.__wbindgen_free(r0, r1);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Plays the [`Chord`].
|
|
508
|
+
* @param {number} delay
|
|
509
|
+
* @param {number} length
|
|
510
|
+
* @param {number} fade_in
|
|
511
|
+
* @returns {Promise<void>}
|
|
512
|
+
*/
|
|
513
|
+
play(delay, length, fade_in) {
|
|
514
|
+
const ret = wasm.kordchord_play(this.ptr, delay, length, fade_in);
|
|
515
|
+
return takeObject(ret);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const KordChordsFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordchords_free(ptr));
|
|
520
|
+
/**
|
|
521
|
+
* The [`Chord`]s wrapper.
|
|
522
|
+
*/
|
|
523
|
+
export class KordChords {
|
|
524
|
+
|
|
525
|
+
static __wrap(ptr) {
|
|
526
|
+
const obj = Object.create(KordChords.prototype);
|
|
527
|
+
obj.ptr = ptr;
|
|
528
|
+
KordChordsFinalization.register(obj, obj.ptr, obj);
|
|
529
|
+
return obj;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
__destroy_into_raw() {
|
|
533
|
+
const ptr = this.ptr;
|
|
534
|
+
this.ptr = 0;
|
|
535
|
+
KordChordsFinalization.unregister(this);
|
|
536
|
+
return ptr;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
free() {
|
|
540
|
+
const ptr = this.__destroy_into_raw();
|
|
541
|
+
wasm.__wbg_kordchords_free(ptr);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Gets an item from the collection.
|
|
545
|
+
* @param {number} index
|
|
546
|
+
* @returns {KordChord | undefined}
|
|
547
|
+
*/
|
|
548
|
+
get(index) {
|
|
549
|
+
const ret = wasm.kordchords_get(this.ptr, index);
|
|
550
|
+
return ret === 0 ? undefined : KordChord.__wrap(ret);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Returns the number of items in the collection.
|
|
554
|
+
* @returns {number}
|
|
555
|
+
*/
|
|
556
|
+
get length() {
|
|
557
|
+
const ret = wasm.kordchords_length(this.ptr);
|
|
558
|
+
return ret >>> 0;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Returns the [`Chord`]s as a space-separated string.
|
|
562
|
+
* @returns {string}
|
|
563
|
+
*/
|
|
564
|
+
to_string() {
|
|
565
|
+
try {
|
|
566
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
567
|
+
wasm.kordchords_to_string(retptr, this.ptr);
|
|
568
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
569
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
570
|
+
return getStringFromWasm0(r0, r1);
|
|
571
|
+
} finally {
|
|
572
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
573
|
+
wasm.__wbindgen_free(r0, r1);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const KordNoteFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnote_free(ptr));
|
|
579
|
+
/**
|
|
580
|
+
* The [`Note`] wrapper.
|
|
581
|
+
*/
|
|
582
|
+
export class KordNote {
|
|
583
|
+
|
|
584
|
+
static __wrap(ptr) {
|
|
585
|
+
const obj = Object.create(KordNote.prototype);
|
|
586
|
+
obj.ptr = ptr;
|
|
587
|
+
KordNoteFinalization.register(obj, obj.ptr, obj);
|
|
588
|
+
return obj;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
__destroy_into_raw() {
|
|
592
|
+
const ptr = this.ptr;
|
|
593
|
+
this.ptr = 0;
|
|
594
|
+
KordNoteFinalization.unregister(this);
|
|
595
|
+
return ptr;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
free() {
|
|
599
|
+
const ptr = this.__destroy_into_raw();
|
|
600
|
+
wasm.__wbg_kordnote_free(ptr);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Creates a new [`Note`] from a frequency.
|
|
604
|
+
* @param {string} name
|
|
605
|
+
* @returns {KordNote}
|
|
606
|
+
*/
|
|
607
|
+
static parse(name) {
|
|
608
|
+
try {
|
|
609
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
610
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
611
|
+
const len0 = WASM_VECTOR_LEN;
|
|
612
|
+
wasm.kordnote_parse(retptr, ptr0, len0);
|
|
613
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
614
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
615
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
616
|
+
if (r2) {
|
|
617
|
+
throw takeObject(r1);
|
|
618
|
+
}
|
|
619
|
+
return KordNote.__wrap(r0);
|
|
620
|
+
} finally {
|
|
621
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Returns [`Note`]s from audio data.
|
|
626
|
+
* @param {Float32Array} data
|
|
627
|
+
* @param {number} length_in_seconds
|
|
628
|
+
* @returns {KordNotes}
|
|
629
|
+
*/
|
|
630
|
+
static from_audio(data, length_in_seconds) {
|
|
631
|
+
try {
|
|
632
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
633
|
+
const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
|
|
634
|
+
const len0 = WASM_VECTOR_LEN;
|
|
635
|
+
wasm.kordnote_from_audio(retptr, ptr0, len0, length_in_seconds);
|
|
636
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
637
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
638
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
639
|
+
if (r2) {
|
|
640
|
+
throw takeObject(r1);
|
|
641
|
+
}
|
|
642
|
+
return KordNotes.__wrap(r0);
|
|
643
|
+
} finally {
|
|
644
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Returns [`Note`]s from audio data using the ML inference algorithm.
|
|
649
|
+
* @param {Float32Array} data
|
|
650
|
+
* @param {number} length_in_seconds
|
|
651
|
+
* @returns {KordNotes}
|
|
652
|
+
*/
|
|
653
|
+
static from_audio_ml(data, length_in_seconds) {
|
|
654
|
+
try {
|
|
655
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
656
|
+
const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
|
|
657
|
+
const len0 = WASM_VECTOR_LEN;
|
|
658
|
+
wasm.kordnote_from_audio_ml(retptr, ptr0, len0, length_in_seconds);
|
|
659
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
660
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
661
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
662
|
+
if (r2) {
|
|
663
|
+
throw takeObject(r1);
|
|
664
|
+
}
|
|
665
|
+
return KordNotes.__wrap(r0);
|
|
666
|
+
} finally {
|
|
667
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Returns the [`Note`]'s friendly name.
|
|
672
|
+
* @returns {string}
|
|
673
|
+
*/
|
|
674
|
+
name() {
|
|
675
|
+
try {
|
|
676
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
677
|
+
wasm.kordnote_name(retptr, this.ptr);
|
|
678
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
679
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
680
|
+
return getStringFromWasm0(r0, r1);
|
|
681
|
+
} finally {
|
|
682
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
683
|
+
wasm.__wbindgen_free(r0, r1);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Returns the [`Note`]'s [`NamedPitch`].
|
|
688
|
+
* @returns {string}
|
|
689
|
+
*/
|
|
690
|
+
pitch() {
|
|
691
|
+
try {
|
|
692
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
693
|
+
wasm.kordnote_pitch(retptr, this.ptr);
|
|
694
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
695
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
696
|
+
return getStringFromWasm0(r0, r1);
|
|
697
|
+
} finally {
|
|
698
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
699
|
+
wasm.__wbindgen_free(r0, r1);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Returns the [`Note`]'s [`Octave`].
|
|
704
|
+
* @returns {number}
|
|
705
|
+
*/
|
|
706
|
+
octave() {
|
|
707
|
+
const ret = wasm.kordnote_octave(this.ptr);
|
|
708
|
+
return ret;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Returns the [`Note`]'s frequency.
|
|
712
|
+
* @returns {number}
|
|
713
|
+
*/
|
|
714
|
+
frequency() {
|
|
715
|
+
const ret = wasm.kordnote_frequency(this.ptr);
|
|
716
|
+
return ret;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
const KordNotesFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnotes_free(ptr));
|
|
721
|
+
/**
|
|
722
|
+
* The [`Note`]s wrapper.
|
|
723
|
+
*/
|
|
724
|
+
export class KordNotes {
|
|
725
|
+
|
|
726
|
+
static __wrap(ptr) {
|
|
727
|
+
const obj = Object.create(KordNotes.prototype);
|
|
728
|
+
obj.ptr = ptr;
|
|
729
|
+
KordNotesFinalization.register(obj, obj.ptr, obj);
|
|
730
|
+
return obj;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
__destroy_into_raw() {
|
|
734
|
+
const ptr = this.ptr;
|
|
735
|
+
this.ptr = 0;
|
|
736
|
+
KordNotesFinalization.unregister(this);
|
|
737
|
+
return ptr;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
free() {
|
|
741
|
+
const ptr = this.__destroy_into_raw();
|
|
742
|
+
wasm.__wbg_kordnotes_free(ptr);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Gets an item from the collection.
|
|
746
|
+
* @param {number} index
|
|
747
|
+
* @returns {KordNote | undefined}
|
|
748
|
+
*/
|
|
749
|
+
get(index) {
|
|
750
|
+
const ret = wasm.kordnotes_get(this.ptr, index);
|
|
751
|
+
return ret === 0 ? undefined : KordNote.__wrap(ret);
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Returns the number of items in the collection.
|
|
755
|
+
* @returns {number}
|
|
756
|
+
*/
|
|
757
|
+
get length() {
|
|
758
|
+
const ret = wasm.kordchords_length(this.ptr);
|
|
759
|
+
return ret >>> 0;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Returns the [`Note`]s as a space-separated string.
|
|
763
|
+
* @returns {string}
|
|
764
|
+
*/
|
|
765
|
+
to_string() {
|
|
766
|
+
try {
|
|
767
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
768
|
+
wasm.kordnotes_to_string(retptr, this.ptr);
|
|
769
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
770
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
771
|
+
return getStringFromWasm0(r0, r1);
|
|
772
|
+
} finally {
|
|
773
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
774
|
+
wasm.__wbindgen_free(r0, r1);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
async function load(module, imports) {
|
|
780
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
781
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
782
|
+
try {
|
|
783
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
784
|
+
|
|
785
|
+
} catch (e) {
|
|
786
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
787
|
+
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);
|
|
788
|
+
|
|
789
|
+
} else {
|
|
790
|
+
throw e;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
const bytes = await module.arrayBuffer();
|
|
796
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
797
|
+
|
|
798
|
+
} else {
|
|
799
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
800
|
+
|
|
801
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
802
|
+
return { instance, module };
|
|
803
|
+
|
|
804
|
+
} else {
|
|
805
|
+
return instance;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function getImports() {
|
|
811
|
+
const imports = {};
|
|
812
|
+
imports.wbg = {};
|
|
813
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
814
|
+
takeObject(arg0);
|
|
815
|
+
};
|
|
816
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
817
|
+
const obj = takeObject(arg0).original;
|
|
818
|
+
if (obj.cnt-- == 1) {
|
|
819
|
+
obj.a = 0;
|
|
820
|
+
return true;
|
|
821
|
+
}
|
|
822
|
+
const ret = false;
|
|
823
|
+
return ret;
|
|
824
|
+
};
|
|
825
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
826
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
827
|
+
return addHeapObject(ret);
|
|
828
|
+
};
|
|
829
|
+
imports.wbg.__wbindgen_boolean_get = function(arg0) {
|
|
830
|
+
const v = getObject(arg0);
|
|
831
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
832
|
+
return ret;
|
|
833
|
+
};
|
|
834
|
+
imports.wbg.__wbg_instanceof_Window_e266f02eee43b570 = function(arg0) {
|
|
835
|
+
let result;
|
|
836
|
+
try {
|
|
837
|
+
result = getObject(arg0) instanceof Window;
|
|
838
|
+
} catch {
|
|
839
|
+
result = false;
|
|
840
|
+
}
|
|
841
|
+
const ret = result;
|
|
842
|
+
return ret;
|
|
843
|
+
};
|
|
844
|
+
imports.wbg.__wbg_setTimeout_6609c9aa64f32bfc = function() { return handleError(function (arg0, arg1, arg2) {
|
|
845
|
+
const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
|
|
846
|
+
return ret;
|
|
847
|
+
}, arguments) };
|
|
848
|
+
imports.wbg.__wbg_destination_5dfc354bcf2eb941 = function(arg0) {
|
|
849
|
+
const ret = getObject(arg0).destination;
|
|
850
|
+
return addHeapObject(ret);
|
|
851
|
+
};
|
|
852
|
+
imports.wbg.__wbg_currentTime_d94729a1b5fd59a5 = function(arg0) {
|
|
853
|
+
const ret = getObject(arg0).currentTime;
|
|
854
|
+
return ret;
|
|
855
|
+
};
|
|
856
|
+
imports.wbg.__wbg_newwithcontextoptions_6c6a79a71ed7efa3 = function() { return handleError(function (arg0) {
|
|
857
|
+
const ret = new lAudioContext(getObject(arg0));
|
|
858
|
+
return addHeapObject(ret);
|
|
859
|
+
}, arguments) };
|
|
860
|
+
imports.wbg.__wbg_close_82409a9d656a7c26 = function() { return handleError(function (arg0) {
|
|
861
|
+
const ret = getObject(arg0).close();
|
|
862
|
+
return addHeapObject(ret);
|
|
863
|
+
}, arguments) };
|
|
864
|
+
imports.wbg.__wbg_createBuffer_d142e00390bff447 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
865
|
+
const ret = getObject(arg0).createBuffer(arg1 >>> 0, arg2 >>> 0, arg3);
|
|
866
|
+
return addHeapObject(ret);
|
|
867
|
+
}, arguments) };
|
|
868
|
+
imports.wbg.__wbg_createBufferSource_1473226efd418a08 = function() { return handleError(function (arg0) {
|
|
869
|
+
const ret = getObject(arg0).createBufferSource();
|
|
870
|
+
return addHeapObject(ret);
|
|
871
|
+
}, arguments) };
|
|
872
|
+
imports.wbg.__wbg_resume_72fe7cd3e68b861a = function() { return handleError(function (arg0) {
|
|
873
|
+
const ret = getObject(arg0).resume();
|
|
874
|
+
return addHeapObject(ret);
|
|
875
|
+
}, arguments) };
|
|
876
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
877
|
+
const ret = arg0;
|
|
878
|
+
return addHeapObject(ret);
|
|
879
|
+
};
|
|
880
|
+
imports.wbg.__wbg_setbuffer_bad384d1628a8306 = function(arg0, arg1) {
|
|
881
|
+
getObject(arg0).buffer = getObject(arg1);
|
|
882
|
+
};
|
|
883
|
+
imports.wbg.__wbg_setonended_15b13187aec41ac9 = function(arg0, arg1) {
|
|
884
|
+
getObject(arg0).onended = getObject(arg1);
|
|
885
|
+
};
|
|
886
|
+
imports.wbg.__wbg_start_9169e040a16354b9 = function() { return handleError(function (arg0, arg1) {
|
|
887
|
+
getObject(arg0).start(arg1);
|
|
888
|
+
}, arguments) };
|
|
889
|
+
imports.wbg.__wbg_connect_77f2f818a74097e1 = function() { return handleError(function (arg0, arg1) {
|
|
890
|
+
const ret = getObject(arg0).connect(getObject(arg1));
|
|
891
|
+
return addHeapObject(ret);
|
|
892
|
+
}, arguments) };
|
|
893
|
+
imports.wbg.__wbg_copyToChannel_9babe9bf308bffc3 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
894
|
+
getObject(arg0).copyToChannel(getArrayF32FromWasm0(arg1, arg2), arg3);
|
|
895
|
+
}, arguments) };
|
|
896
|
+
imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
|
|
897
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
898
|
+
return addHeapObject(ret);
|
|
899
|
+
};
|
|
900
|
+
imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
|
|
901
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
902
|
+
return addHeapObject(ret);
|
|
903
|
+
}, arguments) };
|
|
904
|
+
imports.wbg.__wbg_new_f9876326328f45ed = function() {
|
|
905
|
+
const ret = new Object();
|
|
906
|
+
return addHeapObject(ret);
|
|
907
|
+
};
|
|
908
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
909
|
+
const ret = getObject(arg0);
|
|
910
|
+
return addHeapObject(ret);
|
|
911
|
+
};
|
|
912
|
+
imports.wbg.__wbg_self_e7c1f827057f6584 = function() { return handleError(function () {
|
|
913
|
+
const ret = self.self;
|
|
914
|
+
return addHeapObject(ret);
|
|
915
|
+
}, arguments) };
|
|
916
|
+
imports.wbg.__wbg_window_a09ec664e14b1b81 = function() { return handleError(function () {
|
|
917
|
+
const ret = window.window;
|
|
918
|
+
return addHeapObject(ret);
|
|
919
|
+
}, arguments) };
|
|
920
|
+
imports.wbg.__wbg_globalThis_87cbb8506fecf3a9 = function() { return handleError(function () {
|
|
921
|
+
const ret = globalThis.globalThis;
|
|
922
|
+
return addHeapObject(ret);
|
|
923
|
+
}, arguments) };
|
|
924
|
+
imports.wbg.__wbg_global_c85a9259e621f3db = function() { return handleError(function () {
|
|
925
|
+
const ret = global.global;
|
|
926
|
+
return addHeapObject(ret);
|
|
927
|
+
}, arguments) };
|
|
928
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
929
|
+
const ret = getObject(arg0) === undefined;
|
|
930
|
+
return ret;
|
|
931
|
+
};
|
|
932
|
+
imports.wbg.__wbg_eval_be0434aab6074e1e = function() { return handleError(function (arg0, arg1) {
|
|
933
|
+
const ret = eval(getStringFromWasm0(arg0, arg1));
|
|
934
|
+
return addHeapObject(ret);
|
|
935
|
+
}, arguments) };
|
|
936
|
+
imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
|
|
937
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
938
|
+
return addHeapObject(ret);
|
|
939
|
+
}, arguments) };
|
|
940
|
+
imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function(arg0, arg1) {
|
|
941
|
+
try {
|
|
942
|
+
var state0 = {a: arg0, b: arg1};
|
|
943
|
+
var cb0 = (arg0, arg1) => {
|
|
944
|
+
const a = state0.a;
|
|
945
|
+
state0.a = 0;
|
|
946
|
+
try {
|
|
947
|
+
return __wbg_adapter_91(a, state0.b, arg0, arg1);
|
|
948
|
+
} finally {
|
|
949
|
+
state0.a = a;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
const ret = new Promise(cb0);
|
|
953
|
+
return addHeapObject(ret);
|
|
954
|
+
} finally {
|
|
955
|
+
state0.a = state0.b = 0;
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
imports.wbg.__wbg_resolve_fd40f858d9db1a04 = function(arg0) {
|
|
959
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
960
|
+
return addHeapObject(ret);
|
|
961
|
+
};
|
|
962
|
+
imports.wbg.__wbg_then_ec5db6d509eb475f = function(arg0, arg1) {
|
|
963
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
964
|
+
return addHeapObject(ret);
|
|
965
|
+
};
|
|
966
|
+
imports.wbg.__wbg_set_6aa458a4ebdb65cb = function() { return handleError(function (arg0, arg1, arg2) {
|
|
967
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
968
|
+
return ret;
|
|
969
|
+
}, arguments) };
|
|
970
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
971
|
+
const ret = debugString(getObject(arg1));
|
|
972
|
+
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
973
|
+
const len0 = WASM_VECTOR_LEN;
|
|
974
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
975
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
976
|
+
};
|
|
977
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
978
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
979
|
+
};
|
|
980
|
+
imports.wbg.__wbindgen_closure_wrapper1008 = function(arg0, arg1, arg2) {
|
|
981
|
+
const ret = makeMutClosure(arg0, arg1, 468, __wbg_adapter_20);
|
|
982
|
+
return addHeapObject(ret);
|
|
983
|
+
};
|
|
984
|
+
imports.wbg.__wbindgen_closure_wrapper1308 = function(arg0, arg1, arg2) {
|
|
985
|
+
const ret = makeMutClosure(arg0, arg1, 588, __wbg_adapter_23);
|
|
986
|
+
return addHeapObject(ret);
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
return imports;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
function initMemory(imports, maybe_memory) {
|
|
993
|
+
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
function finalizeInit(instance, module) {
|
|
997
|
+
wasm = instance.exports;
|
|
998
|
+
init.__wbindgen_wasm_module = module;
|
|
999
|
+
cachedFloat32Memory0 = null;
|
|
1000
|
+
cachedInt32Memory0 = null;
|
|
1001
|
+
cachedUint8Memory0 = null;
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
return wasm;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
function initSync(module) {
|
|
1008
|
+
const imports = getImports();
|
|
1009
|
+
|
|
1010
|
+
initMemory(imports);
|
|
1011
|
+
|
|
1012
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1013
|
+
module = new WebAssembly.Module(module);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1017
|
+
|
|
1018
|
+
return finalizeInit(instance, module);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
async function init(input) {
|
|
1022
|
+
if (typeof input === 'undefined') {
|
|
1023
|
+
input = new URL('klib_bg.wasm', import.meta.url);
|
|
1024
|
+
}
|
|
1025
|
+
const imports = getImports();
|
|
1026
|
+
|
|
1027
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
1028
|
+
input = fetch(input);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
initMemory(imports);
|
|
1032
|
+
|
|
1033
|
+
const { instance, module } = await load(await input, imports);
|
|
1034
|
+
|
|
1035
|
+
return finalizeInit(instance, module);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export { initSync }
|
|
1039
|
+
export default init;
|