@scalable-vector-audio/sva-wasm 0.7.3 → 0.7.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/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.3",
5
+ "version": "0.7.4",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -74,25 +74,32 @@ export class Rendering {
74
74
  /**
75
75
  * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
76
76
  * A key-up replaces a term with one whose release is a number. A term leaves with its handle
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.
77
+ * once the stream passes its support, bar the last. An edit lands at the first block boundary
78
+ * after the store answered it; `next` and every getter answer meanwhile.
79
79
  */
80
80
  export class Stream {
81
81
  private constructor();
82
82
  free(): void;
83
83
  [Symbol.dispose](): void;
84
84
  /**
85
- * `term` summed into `@notes`.
85
+ * `term` summed into `@notes`. `options.at`: `"written"` (the stream's `t`) or
86
+ * `"landing"`, its sample 0 the sample it lands at.
86
87
  */
87
- add(term: string): Promise<number>;
88
+ add(term: string, options?: any | null): Promise<number>;
88
89
  /**
89
- * `expr` in place of the target.
90
+ * `late`: edits landed past where issued.
91
+ */
92
+ counts(): any;
93
+ /**
94
+ * `expr` in place of the target. Each edit's promise rejects as a `conflict` where the
95
+ * page frees the stream first.
90
96
  */
91
97
  edit(expr: string): Promise<void>;
92
98
  /**
93
99
  * Reads the stored samples the next second of blocks plays, as the stream plays on.
94
100
  */
95
101
  fetch(): Promise<void>;
102
+ landed(handle: number): number | undefined;
96
103
  /**
97
104
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
98
105
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
@@ -100,9 +107,13 @@ export class Stream {
100
107
  next(out: Float32Array): number;
101
108
  remove(handle: number): Promise<boolean>;
102
109
  /**
103
- * False where the stream no longer holds `handle`.
110
+ * False where `handle` is gone. `"landing"`: where its add landed.
111
+ */
112
+ replace(handle: number, term: string, options?: any | null): Promise<boolean>;
113
+ /**
114
+ * Each list the latest; its `pagination.count` counts all. `pruned`: the level a term under
115
+ * which for good leaves the sum, and each node cut, at the sample it is zero from.
104
116
  */
105
- replace(handle: number, term: string): Promise<boolean>;
106
117
  stats(): any;
107
118
  /**
108
119
  * `{ samples, priced_flops, waves }` since it opened.
@@ -159,23 +170,25 @@ export interface InitOutput {
159
170
  readonly rendering_stats: (a: number) => [number, number, number];
160
171
  readonly rendering_target: (a: number) => [number, number];
161
172
  readonly rendering_work: (a: number) => [number, number, number];
162
- readonly stream_add: (a: number, b: number, c: number) => any;
173
+ readonly stream_add: (a: number, b: number, c: number, d: number) => any;
163
174
  readonly stream_block: (a: number) => number;
164
175
  readonly stream_channels: (a: number) => number;
176
+ readonly stream_counts: (a: number) => [number, number, number];
165
177
  readonly stream_edit: (a: number, b: number, c: number) => any;
166
178
  readonly stream_end: (a: number) => [number, number];
167
179
  readonly stream_fetch: (a: number) => any;
168
180
  readonly stream_held_bytes: (a: number) => number;
181
+ readonly stream_landed: (a: number, b: number) => [number, number];
169
182
  readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
170
183
  readonly stream_position: (a: number) => number;
171
184
  readonly stream_remove: (a: number, b: number) => any;
172
- readonly stream_replace: (a: number, b: number, c: number, d: number) => any;
185
+ readonly stream_replace: (a: number, b: number, c: number, d: number, e: number) => any;
173
186
  readonly stream_sample_rate: (a: number) => number;
174
187
  readonly stream_stats: (a: number) => [number, number, number];
175
188
  readonly stream_work: (a: number) => [number, number, number];
176
189
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
177
190
  readonly wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150: (a: number, b: number, c: any) => [number, number];
178
- readonly wasm_bindgen__convert__closures_____invoke__hc194386506580090: (a: number, b: number) => any;
191
+ readonly wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3: (a: number, b: number) => any;
179
192
  readonly __wbindgen_malloc: (a: number, b: number) => number;
180
193
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
181
194
  readonly __wbindgen_exn_store: (a: number) => void;
package/sva_wasm.js CHANGED
@@ -323,8 +323,8 @@ if (Symbol.dispose) Rendering.prototype[Symbol.dispose] = Rendering.prototype.fr
323
323
  /**
324
324
  * A target block by block, reading `@notes` as the sum of its terms, as `@hall(t, x=@notes)`.
325
325
  * A key-up replaces a term with one whose release is a number. A term leaves with its handle
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.
326
+ * once the stream passes its support, bar the last. An edit lands at the first block boundary
327
+ * after the store answered it; `next` and every getter answer meanwhile.
328
328
  */
329
329
  export class Stream {
330
330
  static __wrap(ptr) {
@@ -344,14 +344,16 @@ export class Stream {
344
344
  wasm.__wbg_stream_free(ptr, 0);
345
345
  }
346
346
  /**
347
- * `term` summed into `@notes`.
347
+ * `term` summed into `@notes`. `options.at`: `"written"` (the stream's `t`) or
348
+ * `"landing"`, its sample 0 the sample it lands at.
348
349
  * @param {string} term
350
+ * @param {any | null} [options]
349
351
  * @returns {Promise<number>}
350
352
  */
351
- add(term) {
353
+ add(term, options) {
352
354
  const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
353
355
  const len0 = WASM_VECTOR_LEN;
354
- const ret = wasm.stream_add(this.__wbg_ptr, ptr0, len0);
356
+ const ret = wasm.stream_add(this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addToExternrefTable0(options));
355
357
  return ret;
356
358
  }
357
359
  /**
@@ -369,7 +371,19 @@ export class Stream {
369
371
  return ret >>> 0;
370
372
  }
371
373
  /**
372
- * `expr` in place of the target.
374
+ * `late`: edits landed past where issued.
375
+ * @returns {any}
376
+ */
377
+ counts() {
378
+ const ret = wasm.stream_counts(this.__wbg_ptr);
379
+ if (ret[2]) {
380
+ throw takeFromExternrefTable0(ret[1]);
381
+ }
382
+ return takeFromExternrefTable0(ret[0]);
383
+ }
384
+ /**
385
+ * `expr` in place of the target. Each edit's promise rejects as a `conflict` where the
386
+ * page frees the stream first.
373
387
  * @param {string} expr
374
388
  * @returns {Promise<void>}
375
389
  */
@@ -401,6 +415,14 @@ export class Stream {
401
415
  const ret = wasm.stream_held_bytes(this.__wbg_ptr);
402
416
  return ret;
403
417
  }
418
+ /**
419
+ * @param {number} handle
420
+ * @returns {number | undefined}
421
+ */
422
+ landed(handle) {
423
+ const ret = wasm.stream_landed(this.__wbg_ptr, handle);
424
+ return ret[0] === 0 ? undefined : ret[1];
425
+ }
404
426
  /**
405
427
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
406
428
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
@@ -432,15 +454,16 @@ export class Stream {
432
454
  return ret;
433
455
  }
434
456
  /**
435
- * False where the stream no longer holds `handle`.
457
+ * False where `handle` is gone. `"landing"`: where its add landed.
436
458
  * @param {number} handle
437
459
  * @param {string} term
460
+ * @param {any | null} [options]
438
461
  * @returns {Promise<boolean>}
439
462
  */
440
- replace(handle, term) {
463
+ replace(handle, term, options) {
441
464
  const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
465
  const len0 = WASM_VECTOR_LEN;
443
- const ret = wasm.stream_replace(this.__wbg_ptr, handle, ptr0, len0);
466
+ const ret = wasm.stream_replace(this.__wbg_ptr, handle, ptr0, len0, isLikeNone(options) ? 0 : addToExternrefTable0(options));
444
467
  return ret;
445
468
  }
446
469
  /**
@@ -451,6 +474,8 @@ export class Stream {
451
474
  return ret >>> 0;
452
475
  }
453
476
  /**
477
+ * Each list the latest; its `pagination.count` counts all. `pruned`: the level a term under
478
+ * which for good leaves the sum, and each node cut, at the sample it is zero from.
454
479
  * @returns {any}
455
480
  */
456
481
  stats() {
@@ -553,7 +578,7 @@ function __wbg_get_imports() {
553
578
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
554
579
  arg0._wbg_cb_unref();
555
580
  },
556
- __wbg_arrayBuffer_8fa1b62e3be35f83: function(arg0) {
581
+ __wbg_arrayBuffer_02aa4e2181f6c7ed: function(arg0) {
557
582
  const ret = arg0.arrayBuffer();
558
583
  return ret;
559
584
  },
@@ -565,7 +590,7 @@ function __wbg_get_imports() {
565
590
  const ret = arg0.call(arg1, arg2);
566
591
  return ret;
567
592
  }, arguments); },
568
- __wbg_close_431a12f30dd16967: function(arg0) {
593
+ __wbg_close_c9faf528adcf54fa: function(arg0) {
569
594
  const ret = arg0.close();
570
595
  return ret;
571
596
  },
@@ -573,7 +598,7 @@ function __wbg_get_imports() {
573
598
  const ret = Composition.__wrap(arg0);
574
599
  return ret;
575
600
  },
576
- __wbg_createWritable_39924c898fe58254: function(arg0) {
601
+ __wbg_createWritable_f0a5a98a99f1c04e: function(arg0) {
577
602
  const ret = arg0.createWritable();
578
603
  return ret;
579
604
  },
@@ -585,15 +610,15 @@ function __wbg_get_imports() {
585
610
  const ret = Array.from(arg0);
586
611
  return ret;
587
612
  },
588
- __wbg_getDirectoryHandle_a1f6c2ddc8e8180b: function(arg0, arg1, arg2, arg3) {
613
+ __wbg_getDirectoryHandle_d305b95848ed1223: function(arg0, arg1, arg2, arg3) {
589
614
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
590
615
  return ret;
591
616
  },
592
- __wbg_getFileHandle_81f015ebb1e92030: function(arg0, arg1, arg2, arg3) {
617
+ __wbg_getFileHandle_b5f945fc68734fc5: function(arg0, arg1, arg2, arg3) {
593
618
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
594
619
  return ret;
595
620
  },
596
- __wbg_getFile_553fb0f9fc58716e: function(arg0) {
621
+ __wbg_getFile_dabe5116756354b9: function(arg0) {
597
622
  const ret = arg0.getFile();
598
623
  return ret;
599
624
  },
@@ -623,7 +648,7 @@ function __wbg_get_imports() {
623
648
  const ret = Array.isArray(arg0);
624
649
  return ret;
625
650
  },
626
- __wbg_keys_18de252854592697: function(arg0) {
651
+ __wbg_keys_460b0697b08c92c0: function(arg0) {
627
652
  const ret = arg0.keys();
628
653
  return ret;
629
654
  },
@@ -635,21 +660,17 @@ function __wbg_get_imports() {
635
660
  const ret = arg0.length;
636
661
  return ret;
637
662
  },
638
- __wbg_move_9838343335ced49d: function(arg0, arg1, arg2, arg3) {
663
+ __wbg_move_824e3de963dcb59e: function(arg0, arg1, arg2, arg3) {
639
664
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
640
665
  return ret;
641
666
  },
642
- __wbg_name_1a1b7c43667f99f5: function(arg0, arg1) {
667
+ __wbg_name_d25ff35a3709031f: function(arg0, arg1) {
643
668
  const ret = arg1.name;
644
669
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
645
670
  const len1 = WASM_VECTOR_LEN;
646
671
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
647
672
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
648
673
  },
649
- __wbg_new_11a85008814947b0: function(arg0, arg1) {
650
- const ret = new Error(getStringFromWasm0(arg0, arg1));
651
- return ret;
652
- },
653
674
  __wbg_new_1da3429bc3c4541c: function(arg0) {
654
675
  const ret = new Uint8Array(arg0);
655
676
  return ret;
@@ -676,6 +697,10 @@ function __wbg_get_imports() {
676
697
  const ret = new Object();
677
698
  return ret;
678
699
  },
700
+ __wbg_new_de6ef68ed26ef76a: function(arg0, arg1) {
701
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
702
+ return ret;
703
+ },
679
704
  __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
680
705
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
681
706
  return ret;
@@ -698,18 +723,18 @@ function __wbg_get_imports() {
698
723
  state0.a = 0;
699
724
  }
700
725
  },
701
- __wbg_next_791a8d00715c4466: function(arg0) {
726
+ __wbg_next_4ececa9fa46caff7: function(arg0) {
702
727
  const ret = arg0.next();
703
728
  return ret;
704
729
  },
705
- __wbg_parse_13fc413f981d786c: function() { return handleError(function (arg0, arg1) {
730
+ __wbg_parse_4282218725f51d78: function() { return handleError(function (arg0, arg1) {
706
731
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
707
732
  return ret;
708
733
  }, arguments); },
709
734
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
710
735
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
711
736
  },
712
- __wbg_query_4f8c74fb7cf23e42: function(arg0) {
737
+ __wbg_query_2bab8ab6bd3c03ee: function(arg0) {
713
738
  const ret = arg0.query();
714
739
  return ret;
715
740
  },
@@ -724,19 +749,19 @@ function __wbg_get_imports() {
724
749
  const ret = Math.random();
725
750
  return ret;
726
751
  },
727
- __wbg_removeEntry_3abdf44a9a4738c8: function(arg0, arg1, arg2) {
728
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
752
+ __wbg_removeEntry_7faa28015ba45f4d: function(arg0, arg1, arg2, arg3) {
753
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
729
754
  return ret;
730
755
  },
731
- __wbg_removeEntry_7914045ff1a983a4: function(arg0, arg1, arg2, arg3) {
732
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
756
+ __wbg_removeEntry_c243351d137728ef: function(arg0, arg1, arg2) {
757
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
733
758
  return ret;
734
759
  },
735
760
  __wbg_rendering_new: function(arg0) {
736
761
  const ret = Rendering.__wrap(arg0);
737
762
  return ret;
738
763
  },
739
- __wbg_request_6030b3039b1ae0dc: function(arg0, arg1, arg2, arg3) {
764
+ __wbg_request_e5098c5a6c3a0def: function(arg0, arg1, arg2, arg3) {
740
765
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
741
766
  return ret;
742
767
  },
@@ -748,17 +773,17 @@ function __wbg_get_imports() {
748
773
  const ret = Reflect.set(arg0, arg1, arg2);
749
774
  return ret;
750
775
  }, arguments); },
751
- __wbg_set_name_93caa23cdf04a087: function(arg0, arg1, arg2) {
776
+ __wbg_set_name_0d2b021786d55b39: function(arg0, arg1, arg2) {
752
777
  arg0.name = getStringFromWasm0(arg1, arg2);
753
778
  },
754
- __wbg_set_refusal_280ba8e696e1aa4c: function(arg0, arg1) {
779
+ __wbg_set_refusal_877c7b5dad993d0f: function(arg0, arg1) {
755
780
  arg0.refusal = arg1;
756
781
  },
757
- __wbg_size_ce4c161c70d82206: function(arg0) {
782
+ __wbg_size_792e8a25bb0824cb: function(arg0) {
758
783
  const ret = arg0.size;
759
784
  return ret;
760
785
  },
761
- __wbg_slice_6f166d9c74deb2bb: function(arg0, arg1, arg2) {
786
+ __wbg_slice_a4e27652a4c64ce3: function(arg0, arg1, arg2) {
762
787
  const ret = arg0.slice(arg1, arg2);
763
788
  return ret;
764
789
  },
@@ -790,21 +815,21 @@ function __wbg_get_imports() {
790
815
  const ret = arg0.then(arg1);
791
816
  return ret;
792
817
  },
793
- __wbg_warn_6232f611e2e359d1: function(arg0, arg1) {
818
+ __wbg_warn_9656c2adf297a87c: function(arg0, arg1) {
794
819
  console.warn(getStringFromWasm0(arg0, arg1));
795
820
  },
796
- __wbg_write_c5dcd6f362f80fb4: function(arg0, arg1) {
821
+ __wbg_write_f437168441a656ec: function(arg0, arg1) {
797
822
  const ret = arg0.write(arg1);
798
823
  return ret;
799
824
  },
800
825
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
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`.
826
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 538, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
802
827
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
803
828
  return ret;
804
829
  },
805
830
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
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);
831
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 91, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
832
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3);
808
833
  return ret;
809
834
  },
810
835
  __wbindgen_generic_0000000000000003: function(arg0) {
@@ -833,8 +858,8 @@ function __wbg_get_imports() {
833
858
  };
834
859
  }
835
860
 
836
- function wasm_bindgen__convert__closures_____invoke__hc194386506580090(arg0, arg1) {
837
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc194386506580090(arg0, arg1);
861
+ function wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1) {
862
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1);
838
863
  return ret;
839
864
  }
840
865
 
package/sva_wasm_bg.wasm CHANGED
Binary file