@scalable-vector-audio/sva-wasm 0.7.1 → 0.7.3

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@scalable-vector-audio/sva-wasm",
3
3
  "type": "module",
4
4
  "description": "JS bindings: a composition a page fills node by node, rendered in the browser",
5
- "version": "0.7.1",
5
+ "version": "0.7.3",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -9,7 +9,7 @@ export class Composition {
9
9
  constructor(name?: string | null);
10
10
  /**
11
11
  * Over the store in `dir`, an origin-private file system directory, or memory alone
12
- * where there is none.
12
+ * where there is none or its store will not open.
13
13
  */
14
14
  static open(name?: string | null, dir?: FileSystemDirectoryHandle | null): Promise<Composition>;
15
15
  /**
@@ -32,9 +32,15 @@ export class Composition {
32
32
  set_prune_policy(policy: string): void;
33
33
  /**
34
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
+ * `live`.
36
36
  */
37
37
  stream(target: string, block: number, options: any): Promise<Stream>;
38
+ /**
39
+ * `target` staged as `render` would, until `persist`; `{ stats, representations }`,
40
+ * the latter `representations()` for `readings`, null unasked. Options: `rate`, `bits`,
41
+ * `flop_budget`, `readings`.
42
+ */
43
+ warm(target: string, options: any): Promise<any>;
38
44
  readonly cache_bytes: number;
39
45
  readonly cache_entries: number;
40
46
  readonly cache_evictions: number;
@@ -68,7 +74,8 @@ export class Rendering {
68
74
  /**
69
75
  * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
70
76
  * 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.
77
+ * once its node ends, bar the last. An edit lands at the first block boundary after the store
78
+ * answered it; `next` and every getter answer meanwhile.
72
79
  */
73
80
  export class Stream {
74
81
  private constructor();
@@ -82,6 +89,10 @@ export class Stream {
82
89
  * `expr` in place of the target.
83
90
  */
84
91
  edit(expr: string): Promise<void>;
92
+ /**
93
+ * Reads the stored samples the next second of blocks plays, as the stream plays on.
94
+ */
95
+ fetch(): Promise<void>;
85
96
  /**
86
97
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
87
98
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
@@ -137,6 +148,7 @@ export interface InitOutput {
137
148
  readonly composition_set_cache_policy: (a: number, b: number, c: number) => [number, number];
138
149
  readonly composition_set_prune_policy: (a: number, b: number, c: number) => [number, number];
139
150
  readonly composition_stream: (a: number, b: number, c: number, d: number, e: any) => any;
151
+ readonly composition_warm: (a: number, b: number, c: number, d: any) => any;
140
152
  readonly outline: (a: number, b: number) => [number, number, number];
141
153
  readonly rendering_channels: (a: number) => number;
142
154
  readonly rendering_duration_secs: (a: number) => number;
@@ -148,21 +160,22 @@ export interface InitOutput {
148
160
  readonly rendering_target: (a: number) => [number, number];
149
161
  readonly rendering_work: (a: number) => [number, number, number];
150
162
  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];
163
+ readonly stream_block: (a: number) => number;
164
+ readonly stream_channels: (a: number) => number;
153
165
  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];
166
+ readonly stream_end: (a: number) => [number, number];
167
+ readonly stream_fetch: (a: number) => any;
168
+ readonly stream_held_bytes: (a: number) => number;
156
169
  readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
157
- readonly stream_position: (a: number) => [number, number, number];
170
+ readonly stream_position: (a: number) => number;
158
171
  readonly stream_remove: (a: number, b: number) => any;
159
172
  readonly stream_replace: (a: number, b: number, c: number, d: number) => any;
160
- readonly stream_sample_rate: (a: number) => [number, number, number];
173
+ readonly stream_sample_rate: (a: number) => number;
161
174
  readonly stream_stats: (a: number) => [number, number, number];
162
175
  readonly stream_work: (a: number) => [number, number, number];
163
176
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
164
177
  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;
178
+ readonly wasm_bindgen__convert__closures_____invoke__hc194386506580090: (a: number, b: number) => any;
166
179
  readonly __wbindgen_malloc: (a: number, b: number) => number;
167
180
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
168
181
  readonly __wbindgen_exn_store: (a: number) => void;
package/sva_wasm.js CHANGED
@@ -87,7 +87,7 @@ export class Composition {
87
87
  }
88
88
  /**
89
89
  * Over the store in `dir`, an origin-private file system directory, or memory alone
90
- * where there is none.
90
+ * where there is none or its store will not open.
91
91
  * @param {string | null} [name]
92
92
  * @param {FileSystemDirectoryHandle | null} [dir]
93
93
  * @returns {Promise<Composition>}
@@ -182,7 +182,7 @@ export class Composition {
182
182
  }
183
183
  /**
184
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.
185
+ * `live`.
186
186
  * @param {string} target
187
187
  * @param {number} block
188
188
  * @param {any} options
@@ -194,6 +194,20 @@ export class Composition {
194
194
  const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, block, options);
195
195
  return ret;
196
196
  }
197
+ /**
198
+ * `target` staged as `render` would, until `persist`; `{ stats, representations }`,
199
+ * the latter `representations()` for `readings`, null unasked. Options: `rate`, `bits`,
200
+ * `flop_budget`, `readings`.
201
+ * @param {string} target
202
+ * @param {any} options
203
+ * @returns {Promise<any>}
204
+ */
205
+ warm(target, options) {
206
+ const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
207
+ const len0 = WASM_VECTOR_LEN;
208
+ const ret = wasm.composition_warm(this.__wbg_ptr, ptr0, len0, options);
209
+ return ret;
210
+ }
197
211
  }
198
212
  if (Symbol.dispose) Composition.prototype[Symbol.dispose] = Composition.prototype.free;
199
213
 
@@ -309,7 +323,8 @@ if (Symbol.dispose) Rendering.prototype[Symbol.dispose] = Rendering.prototype.fr
309
323
  /**
310
324
  * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
311
325
  * 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.
326
+ * once its node ends, bar the last. An edit lands at the first block boundary after the store
327
+ * answered it; `next` and every getter answer meanwhile.
313
328
  */
314
329
  export class Stream {
315
330
  static __wrap(ptr) {
@@ -344,20 +359,14 @@ export class Stream {
344
359
  */
345
360
  get block() {
346
361
  const ret = wasm.stream_block(this.__wbg_ptr);
347
- if (ret[2]) {
348
- throw takeFromExternrefTable0(ret[1]);
349
- }
350
- return ret[0] >>> 0;
362
+ return ret >>> 0;
351
363
  }
352
364
  /**
353
365
  * @returns {number}
354
366
  */
355
367
  get channels() {
356
368
  const ret = wasm.stream_channels(this.__wbg_ptr);
357
- if (ret[2]) {
358
- throw takeFromExternrefTable0(ret[1]);
359
- }
360
- return ret[0] >>> 0;
369
+ return ret >>> 0;
361
370
  }
362
371
  /**
363
372
  * `expr` in place of the target.
@@ -375,20 +384,22 @@ export class Stream {
375
384
  */
376
385
  get end() {
377
386
  const ret = wasm.stream_end(this.__wbg_ptr);
378
- if (ret[3]) {
379
- throw takeFromExternrefTable0(ret[2]);
380
- }
381
387
  return ret[0] === 0 ? undefined : ret[1];
382
388
  }
389
+ /**
390
+ * Reads the stored samples the next second of blocks plays, as the stream plays on.
391
+ * @returns {Promise<void>}
392
+ */
393
+ fetch() {
394
+ const ret = wasm.stream_fetch(this.__wbg_ptr);
395
+ return ret;
396
+ }
383
397
  /**
384
398
  * @returns {number}
385
399
  */
386
400
  get held_bytes() {
387
401
  const ret = wasm.stream_held_bytes(this.__wbg_ptr);
388
- if (ret[2]) {
389
- throw takeFromExternrefTable0(ret[1]);
390
- }
391
- return ret[0];
402
+ return ret;
392
403
  }
393
404
  /**
394
405
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
@@ -410,10 +421,7 @@ export class Stream {
410
421
  */
411
422
  get position() {
412
423
  const ret = wasm.stream_position(this.__wbg_ptr);
413
- if (ret[2]) {
414
- throw takeFromExternrefTable0(ret[1]);
415
- }
416
- return ret[0];
424
+ return ret;
417
425
  }
418
426
  /**
419
427
  * @param {number} handle
@@ -440,10 +448,7 @@ export class Stream {
440
448
  */
441
449
  get sample_rate() {
442
450
  const ret = wasm.stream_sample_rate(this.__wbg_ptr);
443
- if (ret[2]) {
444
- throw takeFromExternrefTable0(ret[1]);
445
- }
446
- return ret[0] >>> 0;
451
+ return ret >>> 0;
447
452
  }
448
453
  /**
449
454
  * @returns {any}
@@ -548,7 +553,7 @@ function __wbg_get_imports() {
548
553
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
549
554
  arg0._wbg_cb_unref();
550
555
  },
551
- __wbg_arrayBuffer_be9196be466b026c: function(arg0) {
556
+ __wbg_arrayBuffer_8fa1b62e3be35f83: function(arg0) {
552
557
  const ret = arg0.arrayBuffer();
553
558
  return ret;
554
559
  },
@@ -560,7 +565,7 @@ function __wbg_get_imports() {
560
565
  const ret = arg0.call(arg1, arg2);
561
566
  return ret;
562
567
  }, arguments); },
563
- __wbg_close_3a3da2c0b5950d54: function(arg0) {
568
+ __wbg_close_431a12f30dd16967: function(arg0) {
564
569
  const ret = arg0.close();
565
570
  return ret;
566
571
  },
@@ -568,7 +573,7 @@ function __wbg_get_imports() {
568
573
  const ret = Composition.__wrap(arg0);
569
574
  return ret;
570
575
  },
571
- __wbg_createWritable_7eba132720802ecc: function(arg0) {
576
+ __wbg_createWritable_39924c898fe58254: function(arg0) {
572
577
  const ret = arg0.createWritable();
573
578
  return ret;
574
579
  },
@@ -580,15 +585,15 @@ function __wbg_get_imports() {
580
585
  const ret = Array.from(arg0);
581
586
  return ret;
582
587
  },
583
- __wbg_getDirectoryHandle_638d1a5c4bf1966d: function(arg0, arg1, arg2, arg3) {
588
+ __wbg_getDirectoryHandle_a1f6c2ddc8e8180b: function(arg0, arg1, arg2, arg3) {
584
589
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
585
590
  return ret;
586
591
  },
587
- __wbg_getFileHandle_98d7c52e03604ca5: function(arg0, arg1, arg2, arg3) {
592
+ __wbg_getFileHandle_81f015ebb1e92030: function(arg0, arg1, arg2, arg3) {
588
593
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
589
594
  return ret;
590
595
  },
591
- __wbg_getFile_84e299f9ca29fcea: function(arg0) {
596
+ __wbg_getFile_553fb0f9fc58716e: function(arg0) {
592
597
  const ret = arg0.getFile();
593
598
  return ret;
594
599
  },
@@ -618,7 +623,7 @@ function __wbg_get_imports() {
618
623
  const ret = Array.isArray(arg0);
619
624
  return ret;
620
625
  },
621
- __wbg_keys_c94929b6f83bc1b9: function(arg0) {
626
+ __wbg_keys_18de252854592697: function(arg0) {
622
627
  const ret = arg0.keys();
623
628
  return ret;
624
629
  },
@@ -630,10 +635,21 @@ function __wbg_get_imports() {
630
635
  const ret = arg0.length;
631
636
  return ret;
632
637
  },
633
- __wbg_move_8bee0fab8a394cb5: function(arg0, arg1, arg2, arg3) {
638
+ __wbg_move_9838343335ced49d: function(arg0, arg1, arg2, arg3) {
634
639
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
635
640
  return ret;
636
641
  },
642
+ __wbg_name_1a1b7c43667f99f5: function(arg0, arg1) {
643
+ const ret = arg1.name;
644
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
645
+ const len1 = WASM_VECTOR_LEN;
646
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
647
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
648
+ },
649
+ __wbg_new_11a85008814947b0: function(arg0, arg1) {
650
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
651
+ return ret;
652
+ },
637
653
  __wbg_new_1da3429bc3c4541c: function(arg0) {
638
654
  const ret = new Uint8Array(arg0);
639
655
  return ret;
@@ -660,10 +676,6 @@ function __wbg_get_imports() {
660
676
  const ret = new Object();
661
677
  return ret;
662
678
  },
663
- __wbg_new_c76aa635a13cdc59: function(arg0, arg1) {
664
- const ret = new Error(getStringFromWasm0(arg0, arg1));
665
- return ret;
666
- },
667
679
  __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
668
680
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
669
681
  return ret;
@@ -686,18 +698,18 @@ function __wbg_get_imports() {
686
698
  state0.a = 0;
687
699
  }
688
700
  },
689
- __wbg_next_3e3ca2daea5cd939: function(arg0) {
701
+ __wbg_next_791a8d00715c4466: function(arg0) {
690
702
  const ret = arg0.next();
691
703
  return ret;
692
704
  },
693
- __wbg_parse_27e7dc84974fe18b: function() { return handleError(function (arg0, arg1) {
705
+ __wbg_parse_13fc413f981d786c: function() { return handleError(function (arg0, arg1) {
694
706
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
695
707
  return ret;
696
708
  }, arguments); },
697
709
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
698
710
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
699
711
  },
700
- __wbg_query_e8d4a4541f8a732e: function(arg0) {
712
+ __wbg_query_4f8c74fb7cf23e42: function(arg0) {
701
713
  const ret = arg0.query();
702
714
  return ret;
703
715
  },
@@ -712,19 +724,19 @@ function __wbg_get_imports() {
712
724
  const ret = Math.random();
713
725
  return ret;
714
726
  },
715
- __wbg_removeEntry_31eaa4b3d8f57600: function(arg0, arg1, arg2, arg3) {
716
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
727
+ __wbg_removeEntry_3abdf44a9a4738c8: function(arg0, arg1, arg2) {
728
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
717
729
  return ret;
718
730
  },
719
- __wbg_removeEntry_c2d36332ccabb790: function(arg0, arg1, arg2) {
720
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
731
+ __wbg_removeEntry_7914045ff1a983a4: function(arg0, arg1, arg2, arg3) {
732
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
721
733
  return ret;
722
734
  },
723
735
  __wbg_rendering_new: function(arg0) {
724
736
  const ret = Rendering.__wrap(arg0);
725
737
  return ret;
726
738
  },
727
- __wbg_request_d9d81a79185ecd35: function(arg0, arg1, arg2, arg3) {
739
+ __wbg_request_6030b3039b1ae0dc: function(arg0, arg1, arg2, arg3) {
728
740
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
729
741
  return ret;
730
742
  },
@@ -736,16 +748,20 @@ function __wbg_get_imports() {
736
748
  const ret = Reflect.set(arg0, arg1, arg2);
737
749
  return ret;
738
750
  }, arguments); },
739
- __wbg_set_name_eefc31a33db38edb: function(arg0, arg1, arg2) {
751
+ __wbg_set_name_93caa23cdf04a087: function(arg0, arg1, arg2) {
740
752
  arg0.name = getStringFromWasm0(arg1, arg2);
741
753
  },
742
- __wbg_set_refusal_b8f13d05e8212be6: function(arg0, arg1) {
754
+ __wbg_set_refusal_280ba8e696e1aa4c: function(arg0, arg1) {
743
755
  arg0.refusal = arg1;
744
756
  },
745
- __wbg_size_a1ed0c98f6f32013: function(arg0) {
757
+ __wbg_size_ce4c161c70d82206: function(arg0) {
746
758
  const ret = arg0.size;
747
759
  return ret;
748
760
  },
761
+ __wbg_slice_6f166d9c74deb2bb: function(arg0, arg1, arg2) {
762
+ const ret = arg0.slice(arg1, arg2);
763
+ return ret;
764
+ },
749
765
  __wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
750
766
  const ret = typeof global === 'undefined' ? null : global;
751
767
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -774,18 +790,21 @@ function __wbg_get_imports() {
774
790
  const ret = arg0.then(arg1);
775
791
  return ret;
776
792
  },
777
- __wbg_write_d29f03282c34951b: function(arg0, arg1) {
793
+ __wbg_warn_6232f611e2e359d1: function(arg0, arg1) {
794
+ console.warn(getStringFromWasm0(arg0, arg1));
795
+ },
796
+ __wbg_write_c5dcd6f362f80fb4: function(arg0, arg1) {
778
797
  const ret = arg0.write(arg1);
779
798
  return ret;
780
799
  },
781
800
  __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`.
801
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 524, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
783
802
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
784
803
  return ret;
785
804
  },
786
805
  __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);
806
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 93, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
807
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc194386506580090);
789
808
  return ret;
790
809
  },
791
810
  __wbindgen_generic_0000000000000003: function(arg0) {
@@ -814,8 +833,8 @@ function __wbg_get_imports() {
814
833
  };
815
834
  }
816
835
 
817
- function wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1) {
818
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1);
836
+ function wasm_bindgen__convert__closures_____invoke__hc194386506580090(arg0, arg1) {
837
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc194386506580090(arg0, arg1);
819
838
  return ret;
820
839
  }
821
840
 
package/sva_wasm_bg.wasm CHANGED
Binary file