@scalable-vector-audio/sva-wasm 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sva_wasm.d.ts +19 -2
- package/sva_wasm.js +70 -7
- package/sva_wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/sva_wasm.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export class Composition {
|
|
|
9
9
|
* Empties the memory tier only: a persistent pack outlives it by design.
|
|
10
10
|
*/
|
|
11
11
|
clear_cache(): void;
|
|
12
|
+
clear_volatile(): void;
|
|
12
13
|
insert(path: string, text: string): void;
|
|
13
14
|
constructor(name?: string | null);
|
|
14
15
|
/**
|
|
@@ -18,8 +19,9 @@ export class Composition {
|
|
|
18
19
|
static persistent(name: string | null | undefined, cache: string, max_bytes?: number | null): Promise<Composition>;
|
|
19
20
|
/**
|
|
20
21
|
* Unset, `target` is `master`; `seconds` is the horizon and `rate` the observation rate.
|
|
22
|
+
* What reads a `volatile` parameter is kept in a slot, never in either store.
|
|
21
23
|
*/
|
|
22
|
-
render(target?: string | null, rate?: number | null, seconds?: number | null): Rendering;
|
|
24
|
+
render(target?: string | null, rate?: number | null, seconds?: number | null, volatile?: string[] | null): Rendering;
|
|
23
25
|
/**
|
|
24
26
|
* The memory tier's, as `cache_max_bytes` is; `persistent_bytes` is the pack's.
|
|
25
27
|
*/
|
|
@@ -31,6 +33,8 @@ export class Composition {
|
|
|
31
33
|
*/
|
|
32
34
|
readonly persistent_bytes: number;
|
|
33
35
|
readonly persistent_max_bytes: number;
|
|
36
|
+
volatile_max_bytes: number;
|
|
37
|
+
readonly volatile_bytes: number;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export class Rendering {
|
|
@@ -52,23 +56,36 @@ export class Rendering {
|
|
|
52
56
|
readonly target: string;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
export function builtins(): any;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `sva-cli outline`'s `data`.
|
|
63
|
+
*/
|
|
64
|
+
export function outline(text: string): any;
|
|
65
|
+
|
|
55
66
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
56
67
|
|
|
57
68
|
export interface InitOutput {
|
|
58
69
|
readonly memory: WebAssembly.Memory;
|
|
59
70
|
readonly __wbg_composition_free: (a: number, b: number) => void;
|
|
60
71
|
readonly __wbg_rendering_free: (a: number, b: number) => void;
|
|
72
|
+
readonly builtins: () => [number, number, number];
|
|
61
73
|
readonly composition_bound_cache: (a: number, b: number) => void;
|
|
62
74
|
readonly composition_cache_bytes: (a: number) => number;
|
|
63
75
|
readonly composition_cache_max_bytes: (a: number) => number;
|
|
64
76
|
readonly composition_clear_cache: (a: number) => void;
|
|
77
|
+
readonly composition_clear_volatile: (a: number) => void;
|
|
65
78
|
readonly composition_insert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
66
79
|
readonly composition_is_persistent: (a: number) => number;
|
|
67
80
|
readonly composition_new: (a: number, b: number) => number;
|
|
68
81
|
readonly composition_persistent: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
69
82
|
readonly composition_persistent_bytes: (a: number) => number;
|
|
70
83
|
readonly composition_persistent_max_bytes: (a: number) => number;
|
|
71
|
-
readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
84
|
+
readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
85
|
+
readonly composition_set_volatile_max_bytes: (a: number, b: number) => void;
|
|
86
|
+
readonly composition_volatile_bytes: (a: number) => number;
|
|
87
|
+
readonly composition_volatile_max_bytes: (a: number) => number;
|
|
88
|
+
readonly outline: (a: number, b: number) => [number, number, number];
|
|
72
89
|
readonly rendering_channels: (a: number) => number;
|
|
73
90
|
readonly rendering_duration_secs: (a: number) => number;
|
|
74
91
|
readonly rendering_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
package/sva_wasm.js
CHANGED
|
@@ -44,6 +44,9 @@ export class Composition {
|
|
|
44
44
|
clear_cache() {
|
|
45
45
|
wasm.composition_clear_cache(this.__wbg_ptr);
|
|
46
46
|
}
|
|
47
|
+
clear_volatile() {
|
|
48
|
+
wasm.composition_clear_volatile(this.__wbg_ptr);
|
|
49
|
+
}
|
|
47
50
|
/**
|
|
48
51
|
* @param {string} path
|
|
49
52
|
* @param {string} text
|
|
@@ -106,20 +109,44 @@ export class Composition {
|
|
|
106
109
|
}
|
|
107
110
|
/**
|
|
108
111
|
* Unset, `target` is `master`; `seconds` is the horizon and `rate` the observation rate.
|
|
112
|
+
* What reads a `volatile` parameter is kept in a slot, never in either store.
|
|
109
113
|
* @param {string | null} [target]
|
|
110
114
|
* @param {number | null} [rate]
|
|
111
115
|
* @param {number | null} [seconds]
|
|
116
|
+
* @param {string[] | null} [volatile]
|
|
112
117
|
* @returns {Rendering}
|
|
113
118
|
*/
|
|
114
|
-
render(target, rate, seconds) {
|
|
119
|
+
render(target, rate, seconds, volatile) {
|
|
115
120
|
var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
116
121
|
var len0 = WASM_VECTOR_LEN;
|
|
117
|
-
|
|
122
|
+
var ptr1 = isLikeNone(volatile) ? 0 : passArrayJsValueToWasm0(volatile, wasm.__wbindgen_malloc);
|
|
123
|
+
var len1 = WASM_VECTOR_LEN;
|
|
124
|
+
const ret = wasm.composition_render(this.__wbg_ptr, ptr0, len0, isLikeNone(rate) ? Number.MAX_SAFE_INTEGER : (rate) >>> 0, !isLikeNone(seconds), isLikeNone(seconds) ? 0 : seconds, ptr1, len1);
|
|
118
125
|
if (ret[2]) {
|
|
119
126
|
throw takeFromExternrefTable0(ret[1]);
|
|
120
127
|
}
|
|
121
128
|
return Rendering.__wrap(ret[0]);
|
|
122
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* @param {number} max_bytes
|
|
132
|
+
*/
|
|
133
|
+
set volatile_max_bytes(max_bytes) {
|
|
134
|
+
wasm.composition_set_volatile_max_bytes(this.__wbg_ptr, max_bytes);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @returns {number}
|
|
138
|
+
*/
|
|
139
|
+
get volatile_bytes() {
|
|
140
|
+
const ret = wasm.composition_volatile_bytes(this.__wbg_ptr);
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @returns {number}
|
|
145
|
+
*/
|
|
146
|
+
get volatile_max_bytes() {
|
|
147
|
+
const ret = wasm.composition_volatile_max_bytes(this.__wbg_ptr);
|
|
148
|
+
return ret;
|
|
149
|
+
}
|
|
123
150
|
}
|
|
124
151
|
if (Symbol.dispose) Composition.prototype[Symbol.dispose] = Composition.prototype.free;
|
|
125
152
|
|
|
@@ -220,6 +247,32 @@ export class Rendering {
|
|
|
220
247
|
}
|
|
221
248
|
}
|
|
222
249
|
if (Symbol.dispose) Rendering.prototype[Symbol.dispose] = Rendering.prototype.free;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @returns {any}
|
|
253
|
+
*/
|
|
254
|
+
export function builtins() {
|
|
255
|
+
const ret = wasm.builtins();
|
|
256
|
+
if (ret[2]) {
|
|
257
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
258
|
+
}
|
|
259
|
+
return takeFromExternrefTable0(ret[0]);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* `sva-cli outline`'s `data`.
|
|
264
|
+
* @param {string} text
|
|
265
|
+
* @returns {any}
|
|
266
|
+
*/
|
|
267
|
+
export function outline(text) {
|
|
268
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.outline(ptr0, len0);
|
|
271
|
+
if (ret[2]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
273
|
+
}
|
|
274
|
+
return takeFromExternrefTable0(ret[0]);
|
|
275
|
+
}
|
|
223
276
|
function __wbg_get_imports() {
|
|
224
277
|
const import0 = {
|
|
225
278
|
__proto__: null,
|
|
@@ -325,7 +378,7 @@ function __wbg_get_imports() {
|
|
|
325
378
|
const ret = arg0.navigator;
|
|
326
379
|
return ret;
|
|
327
380
|
},
|
|
328
|
-
|
|
381
|
+
__wbg_new_7961ad8a1598f803: function(arg0, arg1) {
|
|
329
382
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
330
383
|
return ret;
|
|
331
384
|
},
|
|
@@ -373,7 +426,7 @@ function __wbg_get_imports() {
|
|
|
373
426
|
const ret = arg0.next();
|
|
374
427
|
return ret;
|
|
375
428
|
}, arguments); },
|
|
376
|
-
|
|
429
|
+
__wbg_parse_37dfa129810c048e: function() { return handleError(function (arg0, arg1) {
|
|
377
430
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
378
431
|
return ret;
|
|
379
432
|
}, arguments); },
|
|
@@ -409,10 +462,10 @@ function __wbg_get_imports() {
|
|
|
409
462
|
__wbg_set_create_8c556c6febf6436c: function(arg0, arg1) {
|
|
410
463
|
arg0.create = arg1 !== 0;
|
|
411
464
|
},
|
|
412
|
-
|
|
465
|
+
__wbg_set_name_2c19c7bdf9770241: function(arg0, arg1, arg2) {
|
|
413
466
|
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
414
467
|
},
|
|
415
|
-
|
|
468
|
+
__wbg_set_refusal_2ebfe380b15aaa4a: function(arg0, arg1) {
|
|
416
469
|
arg0.refusal = arg1;
|
|
417
470
|
},
|
|
418
471
|
__wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
|
|
@@ -447,7 +500,7 @@ function __wbg_get_imports() {
|
|
|
447
500
|
return ret;
|
|
448
501
|
}, arguments); },
|
|
449
502
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
450
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
503
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 98, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
451
504
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
|
|
452
505
|
return ret;
|
|
453
506
|
},
|
|
@@ -579,6 +632,16 @@ function makeMutClosure(arg0, arg1, f) {
|
|
|
579
632
|
return real;
|
|
580
633
|
}
|
|
581
634
|
|
|
635
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
636
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
637
|
+
for (let i = 0; i < array.length; i++) {
|
|
638
|
+
const add = addToExternrefTable0(array[i]);
|
|
639
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
640
|
+
}
|
|
641
|
+
WASM_VECTOR_LEN = array.length;
|
|
642
|
+
return ptr;
|
|
643
|
+
}
|
|
644
|
+
|
|
582
645
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
583
646
|
if (realloc === undefined) {
|
|
584
647
|
const buf = cachedTextEncoder.encode(arg);
|
package/sva_wasm_bg.wasm
CHANGED
|
Binary file
|