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

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.6",
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
+ * once the store answered it; `read` and getters answer meanwhile.
79
79
  */
80
80
  export class Stream {
81
81
  private constructor();
@@ -101,10 +101,12 @@ 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`; only
107
+ * `until` ends it.
106
108
  */
107
- next(out: Float32Array): number;
109
+ read(at: number, out: Float32Array): number;
108
110
  remove(handle: number): Promise<boolean>;
109
111
  /**
110
112
  * False where `handle` is gone. `"landing"`: where its add landed.
@@ -179,8 +181,8 @@ export interface InitOutput {
179
181
  readonly stream_fetch: (a: number) => any;
180
182
  readonly stream_held_bytes: (a: number) => number;
181
183
  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
184
  readonly stream_position: (a: number) => number;
185
+ readonly stream_read: (a: number, b: number, c: any) => [number, number, number];
184
186
  readonly stream_remove: (a: number, b: number) => any;
185
187
  readonly stream_replace: (a: number, b: number, c: number, d: number, e: number) => any;
186
188
  readonly stream_sample_rate: (a: number) => number;
@@ -188,7 +190,7 @@ export interface InitOutput {
188
190
  readonly stream_work: (a: number) => [number, number, number];
189
191
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
190
192
  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;
193
+ readonly wasm_bindgen__convert__closures_____invoke__h54b0491e342de8d6: (a: number, b: number) => any;
192
194
  readonly __wbindgen_malloc: (a: number, b: number) => number;
193
195
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
194
196
  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
+ * once the store answered it; `read` and getters answer meanwhile.
328
328
  */
329
329
  export class Stream {
330
330
  static __wrap(ptr) {
@@ -424,27 +424,28 @@ 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`; only
437
+ * `until` ends it.
438
+ * @param {number} at
429
439
  * @param {Float32Array} out
430
440
  * @returns {number}
431
441
  */
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);
442
+ read(at, out) {
443
+ const ret = wasm.stream_read(this.__wbg_ptr, at, out);
436
444
  if (ret[2]) {
437
445
  throw takeFromExternrefTable0(ret[1]);
438
446
  }
439
447
  return ret[0] >>> 0;
440
448
  }
441
- /**
442
- * @returns {number}
443
- */
444
- get position() {
445
- const ret = wasm.stream_position(this.__wbg_ptr);
446
- return ret;
447
- }
448
449
  /**
449
450
  * @param {number} handle
450
451
  * @returns {Promise<boolean>}
@@ -532,9 +533,6 @@ function __wbg_get_imports() {
532
533
  const ret = typeof(v) === 'boolean' ? v : undefined;
533
534
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
534
535
  },
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
536
  __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
539
537
  const ret = debugString(arg1);
540
538
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -578,7 +576,7 @@ function __wbg_get_imports() {
578
576
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
579
577
  arg0._wbg_cb_unref();
580
578
  },
581
- __wbg_arrayBuffer_02aa4e2181f6c7ed: function(arg0) {
579
+ __wbg_arrayBuffer_2f1c765e36c9fb62: function(arg0) {
582
580
  const ret = arg0.arrayBuffer();
583
581
  return ret;
584
582
  },
@@ -590,7 +588,7 @@ function __wbg_get_imports() {
590
588
  const ret = arg0.call(arg1, arg2);
591
589
  return ret;
592
590
  }, arguments); },
593
- __wbg_close_c9faf528adcf54fa: function(arg0) {
591
+ __wbg_close_533a7c36218f5d58: function(arg0) {
594
592
  const ret = arg0.close();
595
593
  return ret;
596
594
  },
@@ -598,7 +596,7 @@ function __wbg_get_imports() {
598
596
  const ret = Composition.__wrap(arg0);
599
597
  return ret;
600
598
  },
601
- __wbg_createWritable_f0a5a98a99f1c04e: function(arg0) {
599
+ __wbg_createWritable_182bdbcca544b24d: function(arg0) {
602
600
  const ret = arg0.createWritable();
603
601
  return ret;
604
602
  },
@@ -610,15 +608,15 @@ function __wbg_get_imports() {
610
608
  const ret = Array.from(arg0);
611
609
  return ret;
612
610
  },
613
- __wbg_getDirectoryHandle_d305b95848ed1223: function(arg0, arg1, arg2, arg3) {
611
+ __wbg_getDirectoryHandle_e281c6755fe12d56: function(arg0, arg1, arg2, arg3) {
614
612
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
615
613
  return ret;
616
614
  },
617
- __wbg_getFileHandle_b5f945fc68734fc5: function(arg0, arg1, arg2, arg3) {
615
+ __wbg_getFileHandle_b403a34ad14e9653: function(arg0, arg1, arg2, arg3) {
618
616
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
619
617
  return ret;
620
618
  },
621
- __wbg_getFile_dabe5116756354b9: function(arg0) {
619
+ __wbg_getFile_d1f96537d20037ad: function(arg0) {
622
620
  const ret = arg0.getFile();
623
621
  return ret;
624
622
  },
@@ -648,7 +646,7 @@ function __wbg_get_imports() {
648
646
  const ret = Array.isArray(arg0);
649
647
  return ret;
650
648
  },
651
- __wbg_keys_460b0697b08c92c0: function(arg0) {
649
+ __wbg_keys_2087ac2edc496ab7: function(arg0) {
652
650
  const ret = arg0.keys();
653
651
  return ret;
654
652
  },
@@ -660,11 +658,15 @@ function __wbg_get_imports() {
660
658
  const ret = arg0.length;
661
659
  return ret;
662
660
  },
663
- __wbg_move_824e3de963dcb59e: function(arg0, arg1, arg2, arg3) {
661
+ __wbg_length_8768c6f6941913e3: function(arg0) {
662
+ const ret = arg0.length;
663
+ return ret;
664
+ },
665
+ __wbg_move_305d522843677ecd: function(arg0, arg1, arg2, arg3) {
664
666
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
665
667
  return ret;
666
668
  },
667
- __wbg_name_d25ff35a3709031f: function(arg0, arg1) {
669
+ __wbg_name_89cdbabf7a0d4448: function(arg0, arg1) {
668
670
  const ret = arg1.name;
669
671
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
670
672
  const len1 = WASM_VECTOR_LEN;
@@ -693,12 +695,12 @@ function __wbg_get_imports() {
693
695
  state0.a = 0;
694
696
  }
695
697
  },
696
- __wbg_new_bebc3f4757acf305: function() {
697
- const ret = new Object();
698
+ __wbg_new_a8497237be663bd1: function(arg0, arg1) {
699
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
698
700
  return ret;
699
701
  },
700
- __wbg_new_de6ef68ed26ef76a: function(arg0, arg1) {
701
- const ret = new Error(getStringFromWasm0(arg0, arg1));
702
+ __wbg_new_bebc3f4757acf305: function() {
703
+ const ret = new Object();
702
704
  return ret;
703
705
  },
704
706
  __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
@@ -723,18 +725,18 @@ function __wbg_get_imports() {
723
725
  state0.a = 0;
724
726
  }
725
727
  },
726
- __wbg_next_4ececa9fa46caff7: function(arg0) {
728
+ __wbg_next_8769a138432a19ff: function(arg0) {
727
729
  const ret = arg0.next();
728
730
  return ret;
729
731
  },
730
- __wbg_parse_4282218725f51d78: function() { return handleError(function (arg0, arg1) {
732
+ __wbg_parse_e931d70e3b6666a4: function() { return handleError(function (arg0, arg1) {
731
733
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
732
734
  return ret;
733
735
  }, arguments); },
734
736
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
735
737
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
736
738
  },
737
- __wbg_query_2bab8ab6bd3c03ee: function(arg0) {
739
+ __wbg_query_8311389820363f4d: function(arg0) {
738
740
  const ret = arg0.query();
739
741
  return ret;
740
742
  },
@@ -749,19 +751,19 @@ function __wbg_get_imports() {
749
751
  const ret = Math.random();
750
752
  return ret;
751
753
  },
752
- __wbg_removeEntry_7faa28015ba45f4d: function(arg0, arg1, arg2, arg3) {
753
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
754
+ __wbg_removeEntry_29f56e7b79a90200: function(arg0, arg1, arg2) {
755
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
754
756
  return ret;
755
757
  },
756
- __wbg_removeEntry_c243351d137728ef: function(arg0, arg1, arg2) {
757
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
758
+ __wbg_removeEntry_a46d84b0db3c65eb: function(arg0, arg1, arg2, arg3) {
759
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
758
760
  return ret;
759
761
  },
760
762
  __wbg_rendering_new: function(arg0) {
761
763
  const ret = Rendering.__wrap(arg0);
762
764
  return ret;
763
765
  },
764
- __wbg_request_e5098c5a6c3a0def: function(arg0, arg1, arg2, arg3) {
766
+ __wbg_request_f6c3675f57e6c128: function(arg0, arg1, arg2, arg3) {
765
767
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
766
768
  return ret;
767
769
  },
@@ -773,17 +775,20 @@ function __wbg_get_imports() {
773
775
  const ret = Reflect.set(arg0, arg1, arg2);
774
776
  return ret;
775
777
  }, arguments); },
776
- __wbg_set_name_0d2b021786d55b39: function(arg0, arg1, arg2) {
778
+ __wbg_set_c41f8dbc07a2190f: function(arg0, arg1, arg2) {
779
+ arg0.set(getArrayF32FromWasm0(arg1, arg2));
780
+ },
781
+ __wbg_set_name_edda9269740941d8: function(arg0, arg1, arg2) {
777
782
  arg0.name = getStringFromWasm0(arg1, arg2);
778
783
  },
779
- __wbg_set_refusal_877c7b5dad993d0f: function(arg0, arg1) {
784
+ __wbg_set_refusal_3f42f102a36cdc30: function(arg0, arg1) {
780
785
  arg0.refusal = arg1;
781
786
  },
782
- __wbg_size_792e8a25bb0824cb: function(arg0) {
787
+ __wbg_size_3a618cb3a6c66229: function(arg0) {
783
788
  const ret = arg0.size;
784
789
  return ret;
785
790
  },
786
- __wbg_slice_a4e27652a4c64ce3: function(arg0, arg1, arg2) {
791
+ __wbg_slice_18093a1ce98b1818: function(arg0, arg1, arg2) {
787
792
  const ret = arg0.slice(arg1, arg2);
788
793
  return ret;
789
794
  },
@@ -807,6 +812,10 @@ function __wbg_get_imports() {
807
812
  const ret = Stream.__wrap(arg0);
808
813
  return ret;
809
814
  },
815
+ __wbg_subarray_03833f2a8828b0c8: function(arg0, arg1, arg2) {
816
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
817
+ return ret;
818
+ },
810
819
  __wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
811
820
  const ret = arg0.then(arg1, arg2);
812
821
  return ret;
@@ -815,10 +824,10 @@ function __wbg_get_imports() {
815
824
  const ret = arg0.then(arg1);
816
825
  return ret;
817
826
  },
818
- __wbg_warn_9656c2adf297a87c: function(arg0, arg1) {
827
+ __wbg_warn_914828cbf578a41c: function(arg0, arg1) {
819
828
  console.warn(getStringFromWasm0(arg0, arg1));
820
829
  },
821
- __wbg_write_f437168441a656ec: function(arg0, arg1) {
830
+ __wbg_write_1a1656923ae0d6b5: function(arg0, arg1) {
822
831
  const ret = arg0.write(arg1);
823
832
  return ret;
824
833
  },
@@ -828,8 +837,8 @@ function __wbg_get_imports() {
828
837
  return ret;
829
838
  },
830
839
  __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);
840
+ // 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`.
841
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h54b0491e342de8d6);
833
842
  return ret;
834
843
  },
835
844
  __wbindgen_generic_0000000000000003: function(arg0) {
@@ -858,8 +867,8 @@ function __wbg_get_imports() {
858
867
  };
859
868
  }
860
869
 
861
- function wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1) {
862
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h99c3d187ea7e66d3(arg0, arg1);
870
+ function wasm_bindgen__convert__closures_____invoke__h54b0491e342de8d6(arg0, arg1) {
871
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h54b0491e342de8d6(arg0, arg1);
863
872
  return ret;
864
873
  }
865
874
 
@@ -1038,13 +1047,6 @@ function makeMutClosure(arg0, arg1, f) {
1038
1047
  return real;
1039
1048
  }
1040
1049
 
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
1050
  function passArrayJsValueToWasm0(array, malloc) {
1049
1051
  const ptr = malloc(array.length * 4, 4) >>> 0;
1050
1052
  for (let i = 0; i < array.length; i++) {
package/sva_wasm_bg.wasm CHANGED
Binary file