@scalable-vector-audio/sva-wasm 0.6.0 → 0.7.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.
- package/package.json +1 -1
- package/sva_wasm.d.ts +61 -37
- package/sva_wasm.js +478 -111
- package/sva_wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/sva_wasm.d.ts
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
-
export class Checkpoint {
|
|
5
|
-
private constructor();
|
|
6
|
-
free(): void;
|
|
7
|
-
[Symbol.dispose](): void;
|
|
8
|
-
readonly position: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
4
|
export class Composition {
|
|
12
5
|
free(): void;
|
|
13
6
|
[Symbol.dispose](): void;
|
|
14
7
|
clear_cache(): void;
|
|
15
8
|
insert(path: string, text: string): void;
|
|
16
9
|
constructor(name?: string | null);
|
|
10
|
+
/**
|
|
11
|
+
* Over the store in `dir`, an origin-private file system directory, or memory alone
|
|
12
|
+
* where there is none.
|
|
13
|
+
*/
|
|
14
|
+
static open(name?: string | null, dir?: FileSystemDirectoryHandle | null): Promise<Composition>;
|
|
15
|
+
/**
|
|
16
|
+
* The only write to the directory `open` was handed: every value computed since the last.
|
|
17
|
+
*/
|
|
18
|
+
persist(): Promise<number>;
|
|
17
19
|
/**
|
|
18
20
|
* `"oldest"` evicts what the latest render neither stored nor read, `"forks"` every value
|
|
19
21
|
* fewer than two nodes read.
|
|
20
22
|
*/
|
|
21
23
|
prune(policy: string): void;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
25
|
+
* `target` as `sva-cli render` takes it, `@piano([0, 2b], f0=C4)`; `representations`
|
|
26
|
+
* what `representations()` answers, `samples` where unset, each a call as
|
|
27
|
+
* `--representation` writes it. `options` sets `rate`, `bits`, `flop_budget`, `until`,
|
|
28
|
+
* `volatile` and `cache`.
|
|
27
29
|
*/
|
|
28
|
-
render(target: string
|
|
30
|
+
render(target: string, representations: string[] | null | undefined, options: any): Promise<Rendering>;
|
|
29
31
|
set_cache_policy(policy: string): void;
|
|
30
32
|
set_prune_policy(policy: string): void;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
* `
|
|
34
|
-
* whose end proves every later sample under `2^-bits`, throwing past `max_secs`.
|
|
34
|
+
* `target` block by block, through this store. `options`: `rate`, `bits`, `until`, `cache`,
|
|
35
|
+
* `live`. Opening and every edit look the store on disk up, so each is awaited.
|
|
35
36
|
*/
|
|
36
|
-
stream(target: string
|
|
37
|
+
stream(target: string, block: number, options: any): Promise<Stream>;
|
|
37
38
|
readonly cache_bytes: number;
|
|
38
39
|
readonly cache_entries: number;
|
|
39
40
|
readonly cache_evictions: number;
|
|
@@ -47,10 +48,11 @@ export class Rendering {
|
|
|
47
48
|
free(): void;
|
|
48
49
|
[Symbol.dispose](): void;
|
|
49
50
|
/**
|
|
50
|
-
* The object `sva-cli render
|
|
51
|
+
* The object `sva-cli render` puts under `data`, one reading per representation asked,
|
|
52
|
+
* arrays capped as it caps.
|
|
51
53
|
*/
|
|
52
|
-
|
|
53
|
-
samples(channel: number
|
|
54
|
+
representations(): any;
|
|
55
|
+
samples(channel: number): Float32Array;
|
|
54
56
|
/**
|
|
55
57
|
* Every lookup this render made of the composition's store, and what each came to.
|
|
56
58
|
*/
|
|
@@ -59,33 +61,46 @@ export class Rendering {
|
|
|
59
61
|
readonly channels: number;
|
|
60
62
|
readonly duration_secs: number;
|
|
61
63
|
readonly sample_rate: number;
|
|
64
|
+
readonly start_secs: number;
|
|
62
65
|
readonly target: string;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
|
-
* A target block by block,
|
|
69
|
+
* A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
|
|
70
|
+
* A key-up replaces a term with one whose release is a number. A term leaves with its handle
|
|
71
|
+
* once its node ends, bar the last.
|
|
67
72
|
*/
|
|
68
73
|
export class Stream {
|
|
69
74
|
private constructor();
|
|
70
75
|
free(): void;
|
|
71
76
|
[Symbol.dispose](): void;
|
|
72
|
-
|
|
77
|
+
/**
|
|
78
|
+
* `term` summed into `@notes`.
|
|
79
|
+
*/
|
|
80
|
+
add(term: string): Promise<number>;
|
|
81
|
+
/**
|
|
82
|
+
* `expr` in place of the target.
|
|
83
|
+
*/
|
|
84
|
+
edit(expr: string): Promise<void>;
|
|
73
85
|
/**
|
|
74
86
|
* Writes the next block into `out`, component `c` from `c * block`, and returns the
|
|
75
87
|
* samples each component took: `block`, fewer where silence ends inside it, `0` after.
|
|
76
88
|
*/
|
|
77
89
|
next(out: Float32Array): number;
|
|
90
|
+
remove(handle: number): Promise<boolean>;
|
|
78
91
|
/**
|
|
79
|
-
*
|
|
92
|
+
* False where the stream no longer holds `handle`.
|
|
80
93
|
*/
|
|
81
|
-
|
|
94
|
+
replace(handle: number, term: string): Promise<boolean>;
|
|
95
|
+
stats(): any;
|
|
82
96
|
/**
|
|
83
|
-
* `{ samples,
|
|
97
|
+
* `{ samples, priced_flops, waves }` since it opened.
|
|
84
98
|
*/
|
|
85
99
|
work(): any;
|
|
86
100
|
readonly block: number;
|
|
87
101
|
readonly channels: number;
|
|
88
102
|
readonly end: number | undefined;
|
|
103
|
+
readonly held_bytes: number;
|
|
89
104
|
readonly position: number;
|
|
90
105
|
readonly sample_rate: number;
|
|
91
106
|
}
|
|
@@ -101,12 +116,10 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
101
116
|
|
|
102
117
|
export interface InitOutput {
|
|
103
118
|
readonly memory: WebAssembly.Memory;
|
|
104
|
-
readonly __wbg_checkpoint_free: (a: number, b: number) => void;
|
|
105
119
|
readonly __wbg_composition_free: (a: number, b: number) => void;
|
|
106
120
|
readonly __wbg_rendering_free: (a: number, b: number) => void;
|
|
107
121
|
readonly __wbg_stream_free: (a: number, b: number) => void;
|
|
108
122
|
readonly builtins: () => [number, number, number];
|
|
109
|
-
readonly checkpoint_position: (a: number) => number;
|
|
110
123
|
readonly composition_cache_bytes: (a: number) => number;
|
|
111
124
|
readonly composition_cache_entries: (a: number) => number;
|
|
112
125
|
readonly composition_cache_evictions: (a: number) => number;
|
|
@@ -115,36 +128,47 @@ export interface InitOutput {
|
|
|
115
128
|
readonly composition_clear_cache: (a: number) => void;
|
|
116
129
|
readonly composition_insert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
117
130
|
readonly composition_new: (a: number, b: number) => number;
|
|
131
|
+
readonly composition_open: (a: number, b: number, c: number) => any;
|
|
132
|
+
readonly composition_persist: (a: number) => any;
|
|
118
133
|
readonly composition_prune: (a: number, b: number, c: number) => [number, number];
|
|
119
134
|
readonly composition_prune_policy: (a: number) => [number, number];
|
|
120
|
-
readonly composition_render: (a: number, b: number, c: number, d: number, e:
|
|
135
|
+
readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
121
136
|
readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
|
|
122
137
|
readonly composition_set_cache_policy: (a: number, b: number, c: number) => [number, number];
|
|
123
138
|
readonly composition_set_prune_policy: (a: number, b: number, c: number) => [number, number];
|
|
124
|
-
readonly composition_stream: (a: number, b: number, c: number, d: number, e:
|
|
139
|
+
readonly composition_stream: (a: number, b: number, c: number, d: number, e: any) => any;
|
|
125
140
|
readonly outline: (a: number, b: number) => [number, number, number];
|
|
126
141
|
readonly rendering_channels: (a: number) => number;
|
|
127
142
|
readonly rendering_duration_secs: (a: number) => number;
|
|
128
|
-
readonly
|
|
143
|
+
readonly rendering_representations: (a: number) => [number, number, number];
|
|
129
144
|
readonly rendering_sample_rate: (a: number) => number;
|
|
130
|
-
readonly rendering_samples: (a: number, b: number
|
|
145
|
+
readonly rendering_samples: (a: number, b: number) => [number, number, number, number];
|
|
146
|
+
readonly rendering_start_secs: (a: number) => number;
|
|
131
147
|
readonly rendering_stats: (a: number) => [number, number, number];
|
|
132
148
|
readonly rendering_target: (a: number) => [number, number];
|
|
133
149
|
readonly rendering_work: (a: number) => [number, number, number];
|
|
134
|
-
readonly
|
|
135
|
-
readonly
|
|
136
|
-
readonly
|
|
137
|
-
readonly
|
|
150
|
+
readonly stream_add: (a: number, b: number, c: number) => any;
|
|
151
|
+
readonly stream_block: (a: number) => [number, number, number];
|
|
152
|
+
readonly stream_channels: (a: number) => [number, number, number];
|
|
153
|
+
readonly stream_edit: (a: number, b: number, c: number) => any;
|
|
154
|
+
readonly stream_end: (a: number) => [number, number, number, number];
|
|
155
|
+
readonly stream_held_bytes: (a: number) => [number, number, number];
|
|
138
156
|
readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
139
|
-
readonly stream_position: (a: number) => number;
|
|
140
|
-
readonly
|
|
141
|
-
readonly
|
|
157
|
+
readonly stream_position: (a: number) => [number, number, number];
|
|
158
|
+
readonly stream_remove: (a: number, b: number) => any;
|
|
159
|
+
readonly stream_replace: (a: number, b: number, c: number, d: number) => any;
|
|
160
|
+
readonly stream_sample_rate: (a: number) => [number, number, number];
|
|
161
|
+
readonly stream_stats: (a: number) => [number, number, number];
|
|
142
162
|
readonly stream_work: (a: number) => [number, number, number];
|
|
163
|
+
readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
|
|
164
|
+
readonly wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150: (a: number, b: number, c: any) => [number, number];
|
|
165
|
+
readonly wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585: (a: number, b: number) => any;
|
|
143
166
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
144
167
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
145
168
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
146
169
|
readonly __externref_table_alloc: () => number;
|
|
147
170
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
171
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
148
172
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
149
173
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
150
174
|
readonly __wbindgen_start: () => void;
|
package/sva_wasm.js
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
/* @ts-self-types="./sva_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
-
export class
|
|
3
|
+
export class Composition {
|
|
4
4
|
static __wrap(ptr) {
|
|
5
|
-
const obj = Object.create(
|
|
5
|
+
const obj = Object.create(Composition.prototype);
|
|
6
6
|
obj.__wbg_ptr = ptr;
|
|
7
|
-
|
|
7
|
+
CompositionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
8
|
return obj;
|
|
9
9
|
}
|
|
10
|
-
__destroy_into_raw() {
|
|
11
|
-
const ptr = this.__wbg_ptr;
|
|
12
|
-
this.__wbg_ptr = 0;
|
|
13
|
-
CheckpointFinalization.unregister(this);
|
|
14
|
-
return ptr;
|
|
15
|
-
}
|
|
16
|
-
free() {
|
|
17
|
-
const ptr = this.__destroy_into_raw();
|
|
18
|
-
wasm.__wbg_checkpoint_free(ptr, 0);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @returns {number}
|
|
22
|
-
*/
|
|
23
|
-
get position() {
|
|
24
|
-
const ret = wasm.checkpoint_position(this.__wbg_ptr);
|
|
25
|
-
return ret;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (Symbol.dispose) Checkpoint.prototype[Symbol.dispose] = Checkpoint.prototype.free;
|
|
29
|
-
|
|
30
|
-
export class Composition {
|
|
31
10
|
__destroy_into_raw() {
|
|
32
11
|
const ptr = this.__wbg_ptr;
|
|
33
12
|
this.__wbg_ptr = 0;
|
|
@@ -106,6 +85,27 @@ export class Composition {
|
|
|
106
85
|
CompositionFinalization.register(this, this.__wbg_ptr, this);
|
|
107
86
|
return this;
|
|
108
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Over the store in `dir`, an origin-private file system directory, or memory alone
|
|
90
|
+
* where there is none.
|
|
91
|
+
* @param {string | null} [name]
|
|
92
|
+
* @param {FileSystemDirectoryHandle | null} [dir]
|
|
93
|
+
* @returns {Promise<Composition>}
|
|
94
|
+
*/
|
|
95
|
+
static open(name, dir) {
|
|
96
|
+
var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
97
|
+
var len0 = WASM_VECTOR_LEN;
|
|
98
|
+
const ret = wasm.composition_open(ptr0, len0, isLikeNone(dir) ? 0 : addToExternrefTable0(dir));
|
|
99
|
+
return ret;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The only write to the directory `open` was handed: every value computed since the last.
|
|
103
|
+
* @returns {Promise<number>}
|
|
104
|
+
*/
|
|
105
|
+
persist() {
|
|
106
|
+
const ret = wasm.composition_persist(this.__wbg_ptr);
|
|
107
|
+
return ret;
|
|
108
|
+
}
|
|
109
109
|
/**
|
|
110
110
|
* `"oldest"` evicts what the latest render neither stored nor read, `"forks"` every value
|
|
111
111
|
* fewer than two nodes read.
|
|
@@ -135,31 +135,22 @@ export class Composition {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* `
|
|
141
|
-
*
|
|
142
|
-
* @param {string
|
|
143
|
-
* @param {
|
|
144
|
-
* @param {any}
|
|
145
|
-
* @
|
|
146
|
-
* @param {number | null} [bits]
|
|
147
|
-
* @param {number | null} [max_secs]
|
|
148
|
-
* @param {string | null} [cache]
|
|
149
|
-
* @returns {Rendering}
|
|
138
|
+
* `target` as `sva-cli render` takes it, `@piano([0, 2b], f0=C4)`; `representations`
|
|
139
|
+
* what `representations()` answers, `samples` where unset, each a call as
|
|
140
|
+
* `--representation` writes it. `options` sets `rate`, `bits`, `flop_budget`, `until`,
|
|
141
|
+
* `volatile` and `cache`.
|
|
142
|
+
* @param {string} target
|
|
143
|
+
* @param {string[] | null | undefined} representations
|
|
144
|
+
* @param {any} options
|
|
145
|
+
* @returns {Promise<Rendering>}
|
|
150
146
|
*/
|
|
151
|
-
render(target,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var ptr1 = isLikeNone(
|
|
147
|
+
render(target, representations, options) {
|
|
148
|
+
const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
149
|
+
const len0 = WASM_VECTOR_LEN;
|
|
150
|
+
var ptr1 = isLikeNone(representations) ? 0 : passArrayJsValueToWasm0(representations, wasm.__wbindgen_malloc);
|
|
155
151
|
var len1 = WASM_VECTOR_LEN;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const ret = wasm.composition_render(this.__wbg_ptr, ptr0, len0, isLikeNone(rate) ? Number.MAX_SAFE_INTEGER : (rate) >>> 0, until, ptr1, len1, isLikeNone(bits) ? Number.MAX_SAFE_INTEGER : (bits) >>> 0, !isLikeNone(max_secs), isLikeNone(max_secs) ? 0 : max_secs, ptr2, len2);
|
|
159
|
-
if (ret[2]) {
|
|
160
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
161
|
-
}
|
|
162
|
-
return Rendering.__wrap(ret[0]);
|
|
152
|
+
const ret = wasm.composition_render(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
|
|
153
|
+
return ret;
|
|
163
154
|
}
|
|
164
155
|
/**
|
|
165
156
|
* @param {number} max_bytes
|
|
@@ -190,26 +181,18 @@ export class Composition {
|
|
|
190
181
|
}
|
|
191
182
|
}
|
|
192
183
|
/**
|
|
193
|
-
*
|
|
194
|
-
* `
|
|
195
|
-
*
|
|
196
|
-
* @param {string | null | undefined} target
|
|
197
|
-
* @param {number | null | undefined} rate
|
|
184
|
+
* `target` block by block, through this store. `options`: `rate`, `bits`, `until`, `cache`,
|
|
185
|
+
* `live`. Opening and every edit look the store on disk up, so each is awaited.
|
|
186
|
+
* @param {string} target
|
|
198
187
|
* @param {number} block
|
|
199
|
-
* @param {any}
|
|
200
|
-
* @
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
var len0 = WASM_VECTOR_LEN;
|
|
208
|
-
const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, isLikeNone(rate) ? Number.MAX_SAFE_INTEGER : (rate) >>> 0, block, bindings, until, isLikeNone(bits) ? Number.MAX_SAFE_INTEGER : (bits) >>> 0, !isLikeNone(max_secs), isLikeNone(max_secs) ? 0 : max_secs);
|
|
209
|
-
if (ret[2]) {
|
|
210
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
211
|
-
}
|
|
212
|
-
return Stream.__wrap(ret[0]);
|
|
188
|
+
* @param {any} options
|
|
189
|
+
* @returns {Promise<Stream>}
|
|
190
|
+
*/
|
|
191
|
+
stream(target, block, options) {
|
|
192
|
+
const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
const len0 = WASM_VECTOR_LEN;
|
|
194
|
+
const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, block, options);
|
|
195
|
+
return ret;
|
|
213
196
|
}
|
|
214
197
|
}
|
|
215
198
|
if (Symbol.dispose) Composition.prototype[Symbol.dispose] = Composition.prototype.free;
|
|
@@ -246,16 +229,12 @@ export class Rendering {
|
|
|
246
229
|
return ret;
|
|
247
230
|
}
|
|
248
231
|
/**
|
|
249
|
-
* The object `sva-cli render
|
|
250
|
-
*
|
|
251
|
-
* @param {number | null} [from_secs]
|
|
252
|
-
* @param {number | null} [to_secs]
|
|
232
|
+
* The object `sva-cli render` puts under `data`, one reading per representation asked,
|
|
233
|
+
* arrays capped as it caps.
|
|
253
234
|
* @returns {any}
|
|
254
235
|
*/
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
const len0 = WASM_VECTOR_LEN;
|
|
258
|
-
const ret = wasm.rendering_query(this.__wbg_ptr, ptr0, len0, !isLikeNone(from_secs), isLikeNone(from_secs) ? 0 : from_secs, !isLikeNone(to_secs), isLikeNone(to_secs) ? 0 : to_secs);
|
|
236
|
+
representations() {
|
|
237
|
+
const ret = wasm.rendering_representations(this.__wbg_ptr);
|
|
259
238
|
if (ret[2]) {
|
|
260
239
|
throw takeFromExternrefTable0(ret[1]);
|
|
261
240
|
}
|
|
@@ -270,12 +249,10 @@ export class Rendering {
|
|
|
270
249
|
}
|
|
271
250
|
/**
|
|
272
251
|
* @param {number} channel
|
|
273
|
-
* @param {number | null} [from_secs]
|
|
274
|
-
* @param {number | null} [to_secs]
|
|
275
252
|
* @returns {Float32Array}
|
|
276
253
|
*/
|
|
277
|
-
samples(channel
|
|
278
|
-
const ret = wasm.rendering_samples(this.__wbg_ptr, channel
|
|
254
|
+
samples(channel) {
|
|
255
|
+
const ret = wasm.rendering_samples(this.__wbg_ptr, channel);
|
|
279
256
|
if (ret[3]) {
|
|
280
257
|
throw takeFromExternrefTable0(ret[2]);
|
|
281
258
|
}
|
|
@@ -283,6 +260,13 @@ export class Rendering {
|
|
|
283
260
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
284
261
|
return v1;
|
|
285
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* @returns {number}
|
|
265
|
+
*/
|
|
266
|
+
get start_secs() {
|
|
267
|
+
const ret = wasm.rendering_start_secs(this.__wbg_ptr);
|
|
268
|
+
return ret;
|
|
269
|
+
}
|
|
286
270
|
/**
|
|
287
271
|
* Every lookup this render made of the composition's store, and what each came to.
|
|
288
272
|
* @returns {any}
|
|
@@ -323,7 +307,9 @@ export class Rendering {
|
|
|
323
307
|
if (Symbol.dispose) Rendering.prototype[Symbol.dispose] = Rendering.prototype.free;
|
|
324
308
|
|
|
325
309
|
/**
|
|
326
|
-
* A target block by block,
|
|
310
|
+
* A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
|
|
311
|
+
* A key-up replaces a term with one whose release is a number. A term leaves with its handle
|
|
312
|
+
* once its node ends, bar the last.
|
|
327
313
|
*/
|
|
328
314
|
export class Stream {
|
|
329
315
|
static __wrap(ptr) {
|
|
@@ -342,34 +328,68 @@ export class Stream {
|
|
|
342
328
|
const ptr = this.__destroy_into_raw();
|
|
343
329
|
wasm.__wbg_stream_free(ptr, 0);
|
|
344
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* `term` summed into `@notes`.
|
|
333
|
+
* @param {string} term
|
|
334
|
+
* @returns {Promise<number>}
|
|
335
|
+
*/
|
|
336
|
+
add(term) {
|
|
337
|
+
const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
338
|
+
const len0 = WASM_VECTOR_LEN;
|
|
339
|
+
const ret = wasm.stream_add(this.__wbg_ptr, ptr0, len0);
|
|
340
|
+
return ret;
|
|
341
|
+
}
|
|
345
342
|
/**
|
|
346
343
|
* @returns {number}
|
|
347
344
|
*/
|
|
348
345
|
get block() {
|
|
349
346
|
const ret = wasm.stream_block(this.__wbg_ptr);
|
|
350
|
-
|
|
347
|
+
if (ret[2]) {
|
|
348
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
349
|
+
}
|
|
350
|
+
return ret[0] >>> 0;
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
353
|
* @returns {number}
|
|
354
354
|
*/
|
|
355
355
|
get channels() {
|
|
356
356
|
const ret = wasm.stream_channels(this.__wbg_ptr);
|
|
357
|
-
|
|
357
|
+
if (ret[2]) {
|
|
358
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
359
|
+
}
|
|
360
|
+
return ret[0] >>> 0;
|
|
358
361
|
}
|
|
359
362
|
/**
|
|
360
|
-
*
|
|
363
|
+
* `expr` in place of the target.
|
|
364
|
+
* @param {string} expr
|
|
365
|
+
* @returns {Promise<void>}
|
|
361
366
|
*/
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
367
|
+
edit(expr) {
|
|
368
|
+
const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
370
|
+
const ret = wasm.stream_edit(this.__wbg_ptr, ptr0, len0);
|
|
371
|
+
return ret;
|
|
365
372
|
}
|
|
366
373
|
/**
|
|
367
374
|
* @returns {number | undefined}
|
|
368
375
|
*/
|
|
369
376
|
get end() {
|
|
370
377
|
const ret = wasm.stream_end(this.__wbg_ptr);
|
|
378
|
+
if (ret[3]) {
|
|
379
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
380
|
+
}
|
|
371
381
|
return ret[0] === 0 ? undefined : ret[1];
|
|
372
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* @returns {number}
|
|
385
|
+
*/
|
|
386
|
+
get held_bytes() {
|
|
387
|
+
const ret = wasm.stream_held_bytes(this.__wbg_ptr);
|
|
388
|
+
if (ret[2]) {
|
|
389
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
390
|
+
}
|
|
391
|
+
return ret[0];
|
|
392
|
+
}
|
|
373
393
|
/**
|
|
374
394
|
* Writes the next block into `out`, component `c` from `c * block`, and returns the
|
|
375
395
|
* samples each component took: `block`, fewer where silence ends inside it, `0` after.
|
|
@@ -390,34 +410,53 @@ export class Stream {
|
|
|
390
410
|
*/
|
|
391
411
|
get position() {
|
|
392
412
|
const ret = wasm.stream_position(this.__wbg_ptr);
|
|
413
|
+
if (ret[2]) {
|
|
414
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
415
|
+
}
|
|
416
|
+
return ret[0];
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* @param {number} handle
|
|
420
|
+
* @returns {Promise<boolean>}
|
|
421
|
+
*/
|
|
422
|
+
remove(handle) {
|
|
423
|
+
const ret = wasm.stream_remove(this.__wbg_ptr, handle);
|
|
393
424
|
return ret;
|
|
394
425
|
}
|
|
395
426
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @param {
|
|
398
|
-
* @param {
|
|
399
|
-
* @
|
|
400
|
-
* @param {number | null} [bits]
|
|
401
|
-
* @param {number | null} [max_secs]
|
|
402
|
-
* @returns {Stream}
|
|
427
|
+
* False where the stream no longer holds `handle`.
|
|
428
|
+
* @param {number} handle
|
|
429
|
+
* @param {string} term
|
|
430
|
+
* @returns {Promise<boolean>}
|
|
403
431
|
*/
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
return Stream.__wrap(ret[0]);
|
|
432
|
+
replace(handle, term) {
|
|
433
|
+
const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
434
|
+
const len0 = WASM_VECTOR_LEN;
|
|
435
|
+
const ret = wasm.stream_replace(this.__wbg_ptr, handle, ptr0, len0);
|
|
436
|
+
return ret;
|
|
411
437
|
}
|
|
412
438
|
/**
|
|
413
439
|
* @returns {number}
|
|
414
440
|
*/
|
|
415
441
|
get sample_rate() {
|
|
416
442
|
const ret = wasm.stream_sample_rate(this.__wbg_ptr);
|
|
417
|
-
|
|
443
|
+
if (ret[2]) {
|
|
444
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
445
|
+
}
|
|
446
|
+
return ret[0] >>> 0;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* @returns {any}
|
|
450
|
+
*/
|
|
451
|
+
stats() {
|
|
452
|
+
const ret = wasm.stream_stats(this.__wbg_ptr);
|
|
453
|
+
if (ret[2]) {
|
|
454
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
455
|
+
}
|
|
456
|
+
return takeFromExternrefTable0(ret[0]);
|
|
418
457
|
}
|
|
419
458
|
/**
|
|
420
|
-
* `{ samples,
|
|
459
|
+
* `{ samples, priced_flops, waves }` since it opened.
|
|
421
460
|
* @returns {any}
|
|
422
461
|
*/
|
|
423
462
|
work() {
|
|
@@ -458,9 +497,29 @@ export function outline(text) {
|
|
|
458
497
|
function __wbg_get_imports() {
|
|
459
498
|
const import0 = {
|
|
460
499
|
__proto__: null,
|
|
500
|
+
__wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
|
|
501
|
+
const v = arg0;
|
|
502
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
503
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
504
|
+
},
|
|
461
505
|
__wbg___wbindgen_copy_to_typed_array_cccd104be8cf0b8d: function(arg0, arg1, arg2) {
|
|
462
506
|
new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
|
|
463
507
|
},
|
|
508
|
+
__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
|
|
509
|
+
const ret = debugString(arg1);
|
|
510
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
511
|
+
const len1 = WASM_VECTOR_LEN;
|
|
512
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
513
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
514
|
+
},
|
|
515
|
+
__wbg___wbindgen_is_falsy_4502df4d571fca70: function(arg0) {
|
|
516
|
+
const ret = !arg0;
|
|
517
|
+
return ret;
|
|
518
|
+
},
|
|
519
|
+
__wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
|
|
520
|
+
const ret = typeof(arg0) === 'function';
|
|
521
|
+
return ret;
|
|
522
|
+
},
|
|
464
523
|
__wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
|
|
465
524
|
const ret = arg0 === null;
|
|
466
525
|
return ret;
|
|
@@ -486,6 +545,33 @@ function __wbg_get_imports() {
|
|
|
486
545
|
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
487
546
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
488
547
|
},
|
|
548
|
+
__wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
|
|
549
|
+
arg0._wbg_cb_unref();
|
|
550
|
+
},
|
|
551
|
+
__wbg_arrayBuffer_be9196be466b026c: function(arg0) {
|
|
552
|
+
const ret = arg0.arrayBuffer();
|
|
553
|
+
return ret;
|
|
554
|
+
},
|
|
555
|
+
__wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
|
|
556
|
+
const ret = arg0.call(arg1);
|
|
557
|
+
return ret;
|
|
558
|
+
}, arguments); },
|
|
559
|
+
__wbg_call_6bcf8d3e20937e46: function() { return handleError(function (arg0, arg1, arg2) {
|
|
560
|
+
const ret = arg0.call(arg1, arg2);
|
|
561
|
+
return ret;
|
|
562
|
+
}, arguments); },
|
|
563
|
+
__wbg_close_3a3da2c0b5950d54: function(arg0) {
|
|
564
|
+
const ret = arg0.close();
|
|
565
|
+
return ret;
|
|
566
|
+
},
|
|
567
|
+
__wbg_composition_new: function(arg0) {
|
|
568
|
+
const ret = Composition.__wrap(arg0);
|
|
569
|
+
return ret;
|
|
570
|
+
},
|
|
571
|
+
__wbg_createWritable_7eba132720802ecc: function(arg0) {
|
|
572
|
+
const ret = arg0.createWritable();
|
|
573
|
+
return ret;
|
|
574
|
+
},
|
|
489
575
|
__wbg_entries_972a87586902cf87: function(arg0) {
|
|
490
576
|
const ret = Object.entries(arg0);
|
|
491
577
|
return ret;
|
|
@@ -494,6 +580,22 @@ function __wbg_get_imports() {
|
|
|
494
580
|
const ret = Array.from(arg0);
|
|
495
581
|
return ret;
|
|
496
582
|
},
|
|
583
|
+
__wbg_getDirectoryHandle_638d1a5c4bf1966d: function(arg0, arg1, arg2, arg3) {
|
|
584
|
+
const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
|
|
585
|
+
return ret;
|
|
586
|
+
},
|
|
587
|
+
__wbg_getFileHandle_98d7c52e03604ca5: function(arg0, arg1, arg2, arg3) {
|
|
588
|
+
const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
|
|
589
|
+
return ret;
|
|
590
|
+
},
|
|
591
|
+
__wbg_getFile_84e299f9ca29fcea: function(arg0) {
|
|
592
|
+
const ret = arg0.getFile();
|
|
593
|
+
return ret;
|
|
594
|
+
},
|
|
595
|
+
__wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
|
|
596
|
+
const ret = Reflect.get(arg0, arg1);
|
|
597
|
+
return ret;
|
|
598
|
+
}, arguments); },
|
|
497
599
|
__wbg_get_b1f0ab13c737f856: function(arg0, arg1) {
|
|
498
600
|
const ret = arg0[arg1 >>> 0];
|
|
499
601
|
return ret;
|
|
@@ -512,25 +614,186 @@ function __wbg_get_imports() {
|
|
|
512
614
|
const ret = result;
|
|
513
615
|
return ret;
|
|
514
616
|
},
|
|
617
|
+
__wbg_isArray_5674713bb7b79043: function(arg0) {
|
|
618
|
+
const ret = Array.isArray(arg0);
|
|
619
|
+
return ret;
|
|
620
|
+
},
|
|
621
|
+
__wbg_keys_c94929b6f83bc1b9: function(arg0) {
|
|
622
|
+
const ret = arg0.keys();
|
|
623
|
+
return ret;
|
|
624
|
+
},
|
|
625
|
+
__wbg_length_31bdaf014f5fbde2: function(arg0) {
|
|
626
|
+
const ret = arg0.length;
|
|
627
|
+
return ret;
|
|
628
|
+
},
|
|
515
629
|
__wbg_length_4e1adc0d42e23620: function(arg0) {
|
|
516
630
|
const ret = arg0.length;
|
|
517
631
|
return ret;
|
|
518
632
|
},
|
|
519
|
-
|
|
633
|
+
__wbg_move_8bee0fab8a394cb5: function(arg0, arg1, arg2, arg3) {
|
|
634
|
+
const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
|
|
635
|
+
return ret;
|
|
636
|
+
},
|
|
637
|
+
__wbg_new_1da3429bc3c4541c: function(arg0) {
|
|
638
|
+
const ret = new Uint8Array(arg0);
|
|
639
|
+
return ret;
|
|
640
|
+
},
|
|
641
|
+
__wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
|
|
642
|
+
try {
|
|
643
|
+
var state0 = {a: arg0, b: arg1};
|
|
644
|
+
var cb0 = (arg0, arg1) => {
|
|
645
|
+
const a = state0.a;
|
|
646
|
+
state0.a = 0;
|
|
647
|
+
try {
|
|
648
|
+
return wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(a, state0.b, arg0, arg1);
|
|
649
|
+
} finally {
|
|
650
|
+
state0.a = a;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
const ret = new Promise(cb0);
|
|
654
|
+
return ret;
|
|
655
|
+
} finally {
|
|
656
|
+
state0.a = 0;
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
__wbg_new_bebc3f4757acf305: function() {
|
|
660
|
+
const ret = new Object();
|
|
661
|
+
return ret;
|
|
662
|
+
},
|
|
663
|
+
__wbg_new_c76aa635a13cdc59: function(arg0, arg1) {
|
|
520
664
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
521
665
|
return ret;
|
|
522
666
|
},
|
|
523
|
-
|
|
667
|
+
__wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
|
|
668
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
669
|
+
return ret;
|
|
670
|
+
},
|
|
671
|
+
__wbg_new_typed_6f8b0d724fe26c07: function(arg0, arg1) {
|
|
672
|
+
try {
|
|
673
|
+
var state0 = {a: arg0, b: arg1};
|
|
674
|
+
var cb0 = (arg0, arg1) => {
|
|
675
|
+
const a = state0.a;
|
|
676
|
+
state0.a = 0;
|
|
677
|
+
try {
|
|
678
|
+
return wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(a, state0.b, arg0, arg1);
|
|
679
|
+
} finally {
|
|
680
|
+
state0.a = a;
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
const ret = new Promise(cb0);
|
|
684
|
+
return ret;
|
|
685
|
+
} finally {
|
|
686
|
+
state0.a = 0;
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
__wbg_next_3e3ca2daea5cd939: function(arg0) {
|
|
690
|
+
const ret = arg0.next();
|
|
691
|
+
return ret;
|
|
692
|
+
},
|
|
693
|
+
__wbg_parse_27e7dc84974fe18b: function() { return handleError(function (arg0, arg1) {
|
|
524
694
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
525
695
|
return ret;
|
|
526
696
|
}, arguments); },
|
|
527
|
-
|
|
697
|
+
__wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
|
|
698
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
699
|
+
},
|
|
700
|
+
__wbg_query_e8d4a4541f8a732e: function(arg0) {
|
|
701
|
+
const ret = arg0.query();
|
|
702
|
+
return ret;
|
|
703
|
+
},
|
|
704
|
+
__wbg_queueMicrotask_85c90f6987555d65: function(arg0) {
|
|
705
|
+
const ret = arg0.queueMicrotask;
|
|
706
|
+
return ret;
|
|
707
|
+
},
|
|
708
|
+
__wbg_queueMicrotask_f6a1fa10b81d1fc0: function(arg0) {
|
|
709
|
+
queueMicrotask(arg0);
|
|
710
|
+
},
|
|
711
|
+
__wbg_random_7bce4e9e78e2e0d0: function() {
|
|
712
|
+
const ret = Math.random();
|
|
713
|
+
return ret;
|
|
714
|
+
},
|
|
715
|
+
__wbg_removeEntry_31eaa4b3d8f57600: function(arg0, arg1, arg2, arg3) {
|
|
716
|
+
const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
|
|
717
|
+
return ret;
|
|
718
|
+
},
|
|
719
|
+
__wbg_removeEntry_c2d36332ccabb790: function(arg0, arg1, arg2) {
|
|
720
|
+
const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
|
|
721
|
+
return ret;
|
|
722
|
+
},
|
|
723
|
+
__wbg_rendering_new: function(arg0) {
|
|
724
|
+
const ret = Rendering.__wrap(arg0);
|
|
725
|
+
return ret;
|
|
726
|
+
},
|
|
727
|
+
__wbg_request_d9d81a79185ecd35: function(arg0, arg1, arg2, arg3) {
|
|
728
|
+
const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
|
|
729
|
+
return ret;
|
|
730
|
+
},
|
|
731
|
+
__wbg_resolve_35ec7e0c6af4c82c: function(arg0) {
|
|
732
|
+
const ret = Promise.resolve(arg0);
|
|
733
|
+
return ret;
|
|
734
|
+
},
|
|
735
|
+
__wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
|
|
736
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
737
|
+
return ret;
|
|
738
|
+
}, arguments); },
|
|
739
|
+
__wbg_set_name_eefc31a33db38edb: function(arg0, arg1, arg2) {
|
|
528
740
|
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
529
741
|
},
|
|
530
|
-
|
|
742
|
+
__wbg_set_refusal_b8f13d05e8212be6: function(arg0, arg1) {
|
|
531
743
|
arg0.refusal = arg1;
|
|
532
744
|
},
|
|
745
|
+
__wbg_size_a1ed0c98f6f32013: function(arg0) {
|
|
746
|
+
const ret = arg0.size;
|
|
747
|
+
return ret;
|
|
748
|
+
},
|
|
749
|
+
__wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
|
|
750
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
751
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
752
|
+
},
|
|
753
|
+
__wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
|
|
754
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
755
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
756
|
+
},
|
|
757
|
+
__wbg_static_accessor_SELF_d8b50611246a6d92: function() {
|
|
758
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
759
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
760
|
+
},
|
|
761
|
+
__wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
|
|
762
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
763
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
764
|
+
},
|
|
765
|
+
__wbg_stream_new: function(arg0) {
|
|
766
|
+
const ret = Stream.__wrap(arg0);
|
|
767
|
+
return ret;
|
|
768
|
+
},
|
|
769
|
+
__wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
|
|
770
|
+
const ret = arg0.then(arg1, arg2);
|
|
771
|
+
return ret;
|
|
772
|
+
},
|
|
773
|
+
__wbg_then_b830475380919203: function(arg0, arg1) {
|
|
774
|
+
const ret = arg0.then(arg1);
|
|
775
|
+
return ret;
|
|
776
|
+
},
|
|
777
|
+
__wbg_write_d29f03282c34951b: function(arg0, arg1) {
|
|
778
|
+
const ret = arg0.write(arg1);
|
|
779
|
+
return ret;
|
|
780
|
+
},
|
|
533
781
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
782
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 521, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
783
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
|
|
784
|
+
return ret;
|
|
785
|
+
},
|
|
786
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
787
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 73, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
|
|
788
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585);
|
|
789
|
+
return ret;
|
|
790
|
+
},
|
|
791
|
+
__wbindgen_generic_0000000000000003: function(arg0) {
|
|
792
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
793
|
+
const ret = arg0;
|
|
794
|
+
return ret;
|
|
795
|
+
},
|
|
796
|
+
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
534
797
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
535
798
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
536
799
|
return ret;
|
|
@@ -551,9 +814,22 @@ function __wbg_get_imports() {
|
|
|
551
814
|
};
|
|
552
815
|
}
|
|
553
816
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
817
|
+
function wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1) {
|
|
818
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1);
|
|
819
|
+
return ret;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150(arg0, arg1, arg2) {
|
|
823
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150(arg0, arg1, arg2);
|
|
824
|
+
if (ret[1]) {
|
|
825
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
function wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(arg0, arg1, arg2, arg3) {
|
|
830
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95(arg0, arg1, arg2, arg3);
|
|
831
|
+
}
|
|
832
|
+
|
|
557
833
|
const CompositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
558
834
|
? { register: () => {}, unregister: () => {} }
|
|
559
835
|
: new FinalizationRegistry(ptr => wasm.__wbg_composition_free(ptr, 1));
|
|
@@ -570,10 +846,73 @@ function addToExternrefTable0(obj) {
|
|
|
570
846
|
return idx;
|
|
571
847
|
}
|
|
572
848
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
849
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
850
|
+
? { register: () => {}, unregister: () => {} }
|
|
851
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
852
|
+
|
|
853
|
+
function debugString(val) {
|
|
854
|
+
// primitive types
|
|
855
|
+
const type = typeof val;
|
|
856
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
857
|
+
return `${val}`;
|
|
858
|
+
}
|
|
859
|
+
if (type == 'string') {
|
|
860
|
+
return `"${val}"`;
|
|
861
|
+
}
|
|
862
|
+
if (type == 'symbol') {
|
|
863
|
+
const description = val.description;
|
|
864
|
+
if (description == null) {
|
|
865
|
+
return 'Symbol';
|
|
866
|
+
} else {
|
|
867
|
+
return `Symbol(${description})`;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
if (type == 'function') {
|
|
871
|
+
const name = val.name;
|
|
872
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
873
|
+
return `Function(${name})`;
|
|
874
|
+
} else {
|
|
875
|
+
return 'Function';
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
// objects
|
|
879
|
+
if (Array.isArray(val)) {
|
|
880
|
+
const length = val.length;
|
|
881
|
+
let debug = '[';
|
|
882
|
+
if (length > 0) {
|
|
883
|
+
debug += debugString(val[0]);
|
|
884
|
+
}
|
|
885
|
+
for(let i = 1; i < length; i++) {
|
|
886
|
+
debug += ', ' + debugString(val[i]);
|
|
887
|
+
}
|
|
888
|
+
debug += ']';
|
|
889
|
+
return debug;
|
|
890
|
+
}
|
|
891
|
+
// Test for built-in
|
|
892
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
893
|
+
let className;
|
|
894
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
895
|
+
className = builtInMatches[1];
|
|
896
|
+
} else {
|
|
897
|
+
// Failed to match the standard '[object ClassName]'
|
|
898
|
+
return toString.call(val);
|
|
899
|
+
}
|
|
900
|
+
if (className == 'Object') {
|
|
901
|
+
// we're a user defined class or Object
|
|
902
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
903
|
+
// easier than looping through ownProperties of `val`.
|
|
904
|
+
try {
|
|
905
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
906
|
+
} catch (_) {
|
|
907
|
+
return 'Object';
|
|
908
|
+
}
|
|
576
909
|
}
|
|
910
|
+
// errors
|
|
911
|
+
if (val instanceof Error) {
|
|
912
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
913
|
+
}
|
|
914
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
915
|
+
return className;
|
|
577
916
|
}
|
|
578
917
|
|
|
579
918
|
function getArrayF32FromWasm0(ptr, len) {
|
|
@@ -627,6 +966,34 @@ function isLikeNone(x) {
|
|
|
627
966
|
return x === undefined || x === null;
|
|
628
967
|
}
|
|
629
968
|
|
|
969
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
970
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
971
|
+
const real = (...args) => {
|
|
972
|
+
|
|
973
|
+
// First up with a closure we increment the internal reference
|
|
974
|
+
// count. This ensures that the Rust closure environment won't
|
|
975
|
+
// be deallocated while we're invoking it.
|
|
976
|
+
state.cnt++;
|
|
977
|
+
const a = state.a;
|
|
978
|
+
state.a = 0;
|
|
979
|
+
try {
|
|
980
|
+
return f(a, state.b, ...args);
|
|
981
|
+
} finally {
|
|
982
|
+
state.a = a;
|
|
983
|
+
real._wbg_cb_unref();
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
real._wbg_cb_unref = () => {
|
|
987
|
+
if (--state.cnt === 0) {
|
|
988
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
989
|
+
state.a = 0;
|
|
990
|
+
CLOSURE_DTORS.unregister(state);
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
994
|
+
return real;
|
|
995
|
+
}
|
|
996
|
+
|
|
630
997
|
function passArrayF32ToWasm0(arg, malloc) {
|
|
631
998
|
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
632
999
|
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
package/sva_wasm_bg.wasm
CHANGED
|
Binary file
|