@scalable-vector-audio/sva-wasm 0.7.4 → 0.7.5

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.4",
5
+ "version": "0.7.5",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -74,8 +74,8 @@ 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 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.
77
+ * once the stream passes its support. An edit lands at the first block boundary
78
+ * after the store answered it; `read` and every getter answer meanwhile.
79
79
  */
80
80
  export class Stream {
81
81
  private constructor();
@@ -101,10 +101,11 @@ export class Stream {
101
101
  fetch(): Promise<void>;
102
102
  landed(handle: number): number | undefined;
103
103
  /**
104
- * Writes the next block into `out`, component `c` from `c * block`, and returns the
105
- * samples each component took: `block`, fewer where silence ends inside it, `0` after.
104
+ * Writes frames from sample `at` into `out` (a SharedArrayBuffer view too) interleaved,
105
+ * `out[i * channels + c]`, and returns how many: `out.length / channels`, fewer at the end.
106
+ * A later `at` skips; live, what needed the span starts silent, in `stats().dropped`.
106
107
  */
107
- next(out: Float32Array): number;
108
+ read(at: number, out: Float32Array): number;
108
109
  remove(handle: number): Promise<boolean>;
109
110
  /**
110
111
  * False where `handle` is gone. `"landing"`: where its add landed.
@@ -179,8 +180,8 @@ export interface InitOutput {
179
180
  readonly stream_fetch: (a: number) => any;
180
181
  readonly stream_held_bytes: (a: number) => number;
181
182
  readonly stream_landed: (a: number, b: number) => [number, number];
182
- readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
183
183
  readonly stream_position: (a: number) => number;
184
+ readonly stream_read: (a: number, b: number, c: any) => [number, number, number];
184
185
  readonly stream_remove: (a: number, b: number) => any;
185
186
  readonly stream_replace: (a: number, b: number, c: number, d: number, e: number) => any;
186
187
  readonly stream_sample_rate: (a: number) => number;
@@ -188,7 +189,7 @@ export interface InitOutput {
188
189
  readonly stream_work: (a: number) => [number, number, number];
189
190
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
190
191
  readonly wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150: (a: number, b: number, c: any) => [number, number];
191
- readonly wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3: (a: number, b: number) => any;
192
+ readonly wasm_bindgen__convert__closures_____invoke__hdbc466ca7f9f0a3d: (a: number, b: number) => any;
192
193
  readonly __wbindgen_malloc: (a: number, b: number) => number;
193
194
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
194
195
  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 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.
326
+ * once the stream passes its support. An edit lands at the first block boundary
327
+ * after the store answered it; `read` and every getter answer meanwhile.
328
328
  */
329
329
  export class Stream {
330
330
  static __wrap(ptr) {
@@ -424,27 +424,27 @@ export class Stream {
424
424
  return ret[0] === 0 ? undefined : ret[1];
425
425
  }
426
426
  /**
427
- * Writes the next block into `out`, component `c` from `c * block`, and returns the
428
- * samples each component took: `block`, fewer where silence ends inside it, `0` after.
427
+ * @returns {number}
428
+ */
429
+ get position() {
430
+ const ret = wasm.stream_position(this.__wbg_ptr);
431
+ return ret;
432
+ }
433
+ /**
434
+ * Writes frames from sample `at` into `out` (a SharedArrayBuffer view too) interleaved,
435
+ * `out[i * channels + c]`, and returns how many: `out.length / channels`, fewer at the end.
436
+ * A later `at` skips; live, what needed the span starts silent, in `stats().dropped`.
437
+ * @param {number} at
429
438
  * @param {Float32Array} out
430
439
  * @returns {number}
431
440
  */
432
- next(out) {
433
- var ptr0 = passArrayF32ToWasm0(out, wasm.__wbindgen_malloc);
434
- var len0 = WASM_VECTOR_LEN;
435
- const ret = wasm.stream_next(this.__wbg_ptr, ptr0, len0, out);
441
+ read(at, out) {
442
+ const ret = wasm.stream_read(this.__wbg_ptr, at, out);
436
443
  if (ret[2]) {
437
444
  throw takeFromExternrefTable0(ret[1]);
438
445
  }
439
446
  return ret[0] >>> 0;
440
447
  }
441
- /**
442
- * @returns {number}
443
- */
444
- get position() {
445
- const ret = wasm.stream_position(this.__wbg_ptr);
446
- return ret;
447
- }
448
448
  /**
449
449
  * @param {number} handle
450
450
  * @returns {Promise<boolean>}
@@ -532,9 +532,6 @@ function __wbg_get_imports() {
532
532
  const ret = typeof(v) === 'boolean' ? v : undefined;
533
533
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
534
534
  },
535
- __wbg___wbindgen_copy_to_typed_array_cccd104be8cf0b8d: function(arg0, arg1, arg2) {
536
- new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
537
- },
538
535
  __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
539
536
  const ret = debugString(arg1);
540
537
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -578,7 +575,7 @@ function __wbg_get_imports() {
578
575
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
579
576
  arg0._wbg_cb_unref();
580
577
  },
581
- __wbg_arrayBuffer_02aa4e2181f6c7ed: function(arg0) {
578
+ __wbg_arrayBuffer_365a1d1685a4dba2: function(arg0) {
582
579
  const ret = arg0.arrayBuffer();
583
580
  return ret;
584
581
  },
@@ -590,7 +587,7 @@ function __wbg_get_imports() {
590
587
  const ret = arg0.call(arg1, arg2);
591
588
  return ret;
592
589
  }, arguments); },
593
- __wbg_close_c9faf528adcf54fa: function(arg0) {
590
+ __wbg_close_3b77a51c1dcac752: function(arg0) {
594
591
  const ret = arg0.close();
595
592
  return ret;
596
593
  },
@@ -598,7 +595,7 @@ function __wbg_get_imports() {
598
595
  const ret = Composition.__wrap(arg0);
599
596
  return ret;
600
597
  },
601
- __wbg_createWritable_f0a5a98a99f1c04e: function(arg0) {
598
+ __wbg_createWritable_bae1c9fdac782d30: function(arg0) {
602
599
  const ret = arg0.createWritable();
603
600
  return ret;
604
601
  },
@@ -610,15 +607,15 @@ function __wbg_get_imports() {
610
607
  const ret = Array.from(arg0);
611
608
  return ret;
612
609
  },
613
- __wbg_getDirectoryHandle_d305b95848ed1223: function(arg0, arg1, arg2, arg3) {
610
+ __wbg_getDirectoryHandle_473d1681af2be45f: function(arg0, arg1, arg2, arg3) {
614
611
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
615
612
  return ret;
616
613
  },
617
- __wbg_getFileHandle_b5f945fc68734fc5: function(arg0, arg1, arg2, arg3) {
614
+ __wbg_getFileHandle_99897b6c3d5e9074: function(arg0, arg1, arg2, arg3) {
618
615
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
619
616
  return ret;
620
617
  },
621
- __wbg_getFile_dabe5116756354b9: function(arg0) {
618
+ __wbg_getFile_88cdc01f283a7055: function(arg0) {
622
619
  const ret = arg0.getFile();
623
620
  return ret;
624
621
  },
@@ -648,7 +645,7 @@ function __wbg_get_imports() {
648
645
  const ret = Array.isArray(arg0);
649
646
  return ret;
650
647
  },
651
- __wbg_keys_460b0697b08c92c0: function(arg0) {
648
+ __wbg_keys_362be373e394df7e: function(arg0) {
652
649
  const ret = arg0.keys();
653
650
  return ret;
654
651
  },
@@ -660,11 +657,15 @@ function __wbg_get_imports() {
660
657
  const ret = arg0.length;
661
658
  return ret;
662
659
  },
663
- __wbg_move_824e3de963dcb59e: function(arg0, arg1, arg2, arg3) {
660
+ __wbg_length_8768c6f6941913e3: function(arg0) {
661
+ const ret = arg0.length;
662
+ return ret;
663
+ },
664
+ __wbg_move_edc33b4719da771c: function(arg0, arg1, arg2, arg3) {
664
665
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
665
666
  return ret;
666
667
  },
667
- __wbg_name_d25ff35a3709031f: function(arg0, arg1) {
668
+ __wbg_name_6e7852ee6f2b7a8b: function(arg0, arg1) {
668
669
  const ret = arg1.name;
669
670
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
670
671
  const len1 = WASM_VECTOR_LEN;
@@ -675,6 +676,10 @@ function __wbg_get_imports() {
675
676
  const ret = new Uint8Array(arg0);
676
677
  return ret;
677
678
  },
679
+ __wbg_new_7a48d37babf8cc55: function(arg0, arg1) {
680
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
681
+ return ret;
682
+ },
678
683
  __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
679
684
  try {
680
685
  var state0 = {a: arg0, b: arg1};
@@ -697,10 +702,6 @@ function __wbg_get_imports() {
697
702
  const ret = new Object();
698
703
  return ret;
699
704
  },
700
- __wbg_new_de6ef68ed26ef76a: function(arg0, arg1) {
701
- const ret = new Error(getStringFromWasm0(arg0, arg1));
702
- return ret;
703
- },
704
705
  __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
705
706
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
706
707
  return ret;
@@ -723,18 +724,18 @@ function __wbg_get_imports() {
723
724
  state0.a = 0;
724
725
  }
725
726
  },
726
- __wbg_next_4ececa9fa46caff7: function(arg0) {
727
+ __wbg_next_f2c96167b8bb87b6: function(arg0) {
727
728
  const ret = arg0.next();
728
729
  return ret;
729
730
  },
730
- __wbg_parse_4282218725f51d78: function() { return handleError(function (arg0, arg1) {
731
+ __wbg_parse_08ae2a4e53713e2e: function() { return handleError(function (arg0, arg1) {
731
732
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
732
733
  return ret;
733
734
  }, arguments); },
734
735
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
735
736
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
736
737
  },
737
- __wbg_query_2bab8ab6bd3c03ee: function(arg0) {
738
+ __wbg_query_d9edccbfa6c0e728: function(arg0) {
738
739
  const ret = arg0.query();
739
740
  return ret;
740
741
  },
@@ -749,19 +750,19 @@ function __wbg_get_imports() {
749
750
  const ret = Math.random();
750
751
  return ret;
751
752
  },
752
- __wbg_removeEntry_7faa28015ba45f4d: function(arg0, arg1, arg2, arg3) {
753
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
753
+ __wbg_removeEntry_18600e5dff7f249d: function(arg0, arg1, arg2) {
754
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
754
755
  return ret;
755
756
  },
756
- __wbg_removeEntry_c243351d137728ef: function(arg0, arg1, arg2) {
757
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
757
+ __wbg_removeEntry_a339692b1dfb71b1: function(arg0, arg1, arg2, arg3) {
758
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
758
759
  return ret;
759
760
  },
760
761
  __wbg_rendering_new: function(arg0) {
761
762
  const ret = Rendering.__wrap(arg0);
762
763
  return ret;
763
764
  },
764
- __wbg_request_e5098c5a6c3a0def: function(arg0, arg1, arg2, arg3) {
765
+ __wbg_request_6a40511b9f0e2911: function(arg0, arg1, arg2, arg3) {
765
766
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
766
767
  return ret;
767
768
  },
@@ -773,17 +774,20 @@ function __wbg_get_imports() {
773
774
  const ret = Reflect.set(arg0, arg1, arg2);
774
775
  return ret;
775
776
  }, arguments); },
776
- __wbg_set_name_0d2b021786d55b39: function(arg0, arg1, arg2) {
777
+ __wbg_set_c41f8dbc07a2190f: function(arg0, arg1, arg2) {
778
+ arg0.set(getArrayF32FromWasm0(arg1, arg2));
779
+ },
780
+ __wbg_set_name_4b9dcf4c83c869ae: function(arg0, arg1, arg2) {
777
781
  arg0.name = getStringFromWasm0(arg1, arg2);
778
782
  },
779
- __wbg_set_refusal_877c7b5dad993d0f: function(arg0, arg1) {
783
+ __wbg_set_refusal_a7ebf7dd502b61d1: function(arg0, arg1) {
780
784
  arg0.refusal = arg1;
781
785
  },
782
- __wbg_size_792e8a25bb0824cb: function(arg0) {
786
+ __wbg_size_d020191da61b5cb0: function(arg0) {
783
787
  const ret = arg0.size;
784
788
  return ret;
785
789
  },
786
- __wbg_slice_a4e27652a4c64ce3: function(arg0, arg1, arg2) {
790
+ __wbg_slice_434fd5f1e8c04836: function(arg0, arg1, arg2) {
787
791
  const ret = arg0.slice(arg1, arg2);
788
792
  return ret;
789
793
  },
@@ -807,6 +811,10 @@ function __wbg_get_imports() {
807
811
  const ret = Stream.__wrap(arg0);
808
812
  return ret;
809
813
  },
814
+ __wbg_subarray_03833f2a8828b0c8: function(arg0, arg1, arg2) {
815
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
816
+ return ret;
817
+ },
810
818
  __wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
811
819
  const ret = arg0.then(arg1, arg2);
812
820
  return ret;
@@ -815,10 +823,10 @@ function __wbg_get_imports() {
815
823
  const ret = arg0.then(arg1);
816
824
  return ret;
817
825
  },
818
- __wbg_warn_9656c2adf297a87c: function(arg0, arg1) {
826
+ __wbg_warn_b627ad1e6b70ad0c: function(arg0, arg1) {
819
827
  console.warn(getStringFromWasm0(arg0, arg1));
820
828
  },
821
- __wbg_write_f437168441a656ec: function(arg0, arg1) {
829
+ __wbg_write_13ecd27d53c671a8: function(arg0, arg1) {
822
830
  const ret = arg0.write(arg1);
823
831
  return ret;
824
832
  },
@@ -828,8 +836,8 @@ function __wbg_get_imports() {
828
836
  return ret;
829
837
  },
830
838
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
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);
839
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 92, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
840
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hdbc466ca7f9f0a3d);
833
841
  return ret;
834
842
  },
835
843
  __wbindgen_generic_0000000000000003: function(arg0) {
@@ -858,8 +866,8 @@ function __wbg_get_imports() {
858
866
  };
859
867
  }
860
868
 
861
- function wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1) {
862
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1);
869
+ function wasm_bindgen__convert__closures_____invoke__hdbc466ca7f9f0a3d(arg0, arg1) {
870
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hdbc466ca7f9f0a3d(arg0, arg1);
863
871
  return ret;
864
872
  }
865
873
 
@@ -1038,13 +1046,6 @@ function makeMutClosure(arg0, arg1, f) {
1038
1046
  return real;
1039
1047
  }
1040
1048
 
1041
- function passArrayF32ToWasm0(arg, malloc) {
1042
- const ptr = malloc(arg.length * 4, 4) >>> 0;
1043
- getFloat32ArrayMemory0().set(arg, ptr / 4);
1044
- WASM_VECTOR_LEN = arg.length;
1045
- return ptr;
1046
- }
1047
-
1048
1049
  function passArrayJsValueToWasm0(array, malloc) {
1049
1050
  const ptr = malloc(array.length * 4, 4) >>> 0;
1050
1051
  for (let i = 0; i < array.length; i++) {
package/sva_wasm_bg.wasm CHANGED
Binary file