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

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.0",
5
+ "version": "0.7.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -32,9 +32,9 @@ 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`.
35
+ * `live`. Opening and every edit look the store on disk up, so each is awaited.
36
36
  */
37
- stream(target: string, block: number, options: any): Stream;
37
+ stream(target: string, block: number, options: any): Promise<Stream>;
38
38
  readonly cache_bytes: number;
39
39
  readonly cache_entries: number;
40
40
  readonly cache_evictions: number;
@@ -77,21 +77,21 @@ export class Stream {
77
77
  /**
78
78
  * `term` summed into `@notes`.
79
79
  */
80
- add(term: string): number;
80
+ add(term: string): Promise<number>;
81
81
  /**
82
82
  * `expr` in place of the target.
83
83
  */
84
- edit(expr: string): void;
84
+ edit(expr: string): Promise<void>;
85
85
  /**
86
86
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
87
87
  * samples each component took: `block`, fewer where silence ends inside it, `0` after.
88
88
  */
89
89
  next(out: Float32Array): number;
90
- remove(handle: number): boolean;
90
+ remove(handle: number): Promise<boolean>;
91
91
  /**
92
92
  * False where the stream no longer holds `handle`.
93
93
  */
94
- replace(handle: number, term: string): boolean;
94
+ replace(handle: number, term: string): Promise<boolean>;
95
95
  stats(): any;
96
96
  /**
97
97
  * `{ samples, priced_flops, waves }` since it opened.
@@ -136,7 +136,7 @@ export interface InitOutput {
136
136
  readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
137
137
  readonly composition_set_cache_policy: (a: number, b: number, c: number) => [number, number];
138
138
  readonly composition_set_prune_policy: (a: number, b: number, c: number) => [number, number];
139
- readonly composition_stream: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
139
+ readonly composition_stream: (a: number, b: number, c: number, d: number, e: any) => any;
140
140
  readonly outline: (a: number, b: number) => [number, number, number];
141
141
  readonly rendering_channels: (a: number) => number;
142
142
  readonly rendering_duration_secs: (a: number) => number;
@@ -147,22 +147,22 @@ export interface InitOutput {
147
147
  readonly rendering_stats: (a: number) => [number, number, number];
148
148
  readonly rendering_target: (a: number) => [number, number];
149
149
  readonly rendering_work: (a: number) => [number, number, number];
150
- readonly stream_add: (a: number, b: number, c: number) => [number, number, number];
151
- readonly stream_block: (a: number) => number;
152
- readonly stream_channels: (a: number) => number;
153
- readonly stream_edit: (a: number, b: number, c: number) => [number, number];
154
- readonly stream_end: (a: number) => [number, number];
155
- readonly stream_held_bytes: (a: number) => number;
150
+ 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];
153
+ 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];
156
156
  readonly stream_next: (a: number, b: number, c: number, d: any) => [number, number, number];
157
- readonly stream_position: (a: number) => number;
158
- readonly stream_remove: (a: number, b: number) => [number, number, number];
159
- readonly stream_replace: (a: number, b: number, c: number, d: number) => [number, number, number];
160
- readonly stream_sample_rate: (a: number) => number;
157
+ readonly stream_position: (a: number) => [number, number, number];
158
+ readonly stream_remove: (a: number, b: number) => any;
159
+ readonly stream_replace: (a: number, b: number, c: number, d: number) => any;
160
+ readonly stream_sample_rate: (a: number) => [number, number, number];
161
161
  readonly stream_stats: (a: number) => [number, number, number];
162
162
  readonly stream_work: (a: number) => [number, number, number];
163
163
  readonly wasm_bindgen__convert__closures_____invoke__h76bd71bceeca2b95: (a: number, b: number, c: any, d: any) => void;
164
164
  readonly wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150: (a: number, b: number, c: any) => [number, number];
165
- readonly wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385: (a: number, b: number) => any;
165
+ readonly wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585: (a: number, b: number) => any;
166
166
  readonly __wbindgen_malloc: (a: number, b: number) => number;
167
167
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
168
168
  readonly __wbindgen_exn_store: (a: number) => void;
package/sva_wasm.js CHANGED
@@ -182,20 +182,17 @@ export class Composition {
182
182
  }
183
183
  /**
184
184
  * `target` block by block, through this store. `options`: `rate`, `bits`, `until`, `cache`,
185
- * `live`.
185
+ * `live`. Opening and every edit look the store on disk up, so each is awaited.
186
186
  * @param {string} target
187
187
  * @param {number} block
188
188
  * @param {any} options
189
- * @returns {Stream}
189
+ * @returns {Promise<Stream>}
190
190
  */
191
191
  stream(target, block, options) {
192
192
  const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
193
193
  const len0 = WASM_VECTOR_LEN;
194
194
  const ret = wasm.composition_stream(this.__wbg_ptr, ptr0, len0, block, options);
195
- if (ret[2]) {
196
- throw takeFromExternrefTable0(ret[1]);
197
- }
198
- return Stream.__wrap(ret[0]);
195
+ return ret;
199
196
  }
200
197
  }
201
198
  if (Symbol.dispose) Composition.prototype[Symbol.dispose] = Composition.prototype.free;
@@ -334,48 +331,53 @@ export class Stream {
334
331
  /**
335
332
  * `term` summed into `@notes`.
336
333
  * @param {string} term
337
- * @returns {number}
334
+ * @returns {Promise<number>}
338
335
  */
339
336
  add(term) {
340
337
  const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
338
  const len0 = WASM_VECTOR_LEN;
342
339
  const ret = wasm.stream_add(this.__wbg_ptr, ptr0, len0);
343
- if (ret[2]) {
344
- throw takeFromExternrefTable0(ret[1]);
345
- }
346
- return ret[0] >>> 0;
340
+ return ret;
347
341
  }
348
342
  /**
349
343
  * @returns {number}
350
344
  */
351
345
  get block() {
352
346
  const ret = wasm.stream_block(this.__wbg_ptr);
353
- return ret >>> 0;
347
+ if (ret[2]) {
348
+ throw takeFromExternrefTable0(ret[1]);
349
+ }
350
+ return ret[0] >>> 0;
354
351
  }
355
352
  /**
356
353
  * @returns {number}
357
354
  */
358
355
  get channels() {
359
356
  const ret = wasm.stream_channels(this.__wbg_ptr);
360
- return ret >>> 0;
357
+ if (ret[2]) {
358
+ throw takeFromExternrefTable0(ret[1]);
359
+ }
360
+ return ret[0] >>> 0;
361
361
  }
362
362
  /**
363
363
  * `expr` in place of the target.
364
364
  * @param {string} expr
365
+ * @returns {Promise<void>}
365
366
  */
366
367
  edit(expr) {
367
368
  const ptr0 = passStringToWasm0(expr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
369
  const len0 = WASM_VECTOR_LEN;
369
370
  const ret = wasm.stream_edit(this.__wbg_ptr, ptr0, len0);
370
- if (ret[1]) {
371
- throw takeFromExternrefTable0(ret[0]);
372
- }
371
+ return ret;
373
372
  }
374
373
  /**
375
374
  * @returns {number | undefined}
376
375
  */
377
376
  get end() {
378
377
  const ret = wasm.stream_end(this.__wbg_ptr);
378
+ if (ret[3]) {
379
+ throw takeFromExternrefTable0(ret[2]);
380
+ }
379
381
  return ret[0] === 0 ? undefined : ret[1];
380
382
  }
381
383
  /**
@@ -383,7 +385,10 @@ export class Stream {
383
385
  */
384
386
  get held_bytes() {
385
387
  const ret = wasm.stream_held_bytes(this.__wbg_ptr);
386
- return ret;
388
+ if (ret[2]) {
389
+ throw takeFromExternrefTable0(ret[1]);
390
+ }
391
+ return ret[0];
387
392
  }
388
393
  /**
389
394
  * Writes the next block into `out`, component `c` from `c * block`, and returns the
@@ -405,40 +410,40 @@ export class Stream {
405
410
  */
406
411
  get position() {
407
412
  const ret = wasm.stream_position(this.__wbg_ptr);
408
- return ret;
413
+ if (ret[2]) {
414
+ throw takeFromExternrefTable0(ret[1]);
415
+ }
416
+ return ret[0];
409
417
  }
410
418
  /**
411
419
  * @param {number} handle
412
- * @returns {boolean}
420
+ * @returns {Promise<boolean>}
413
421
  */
414
422
  remove(handle) {
415
423
  const ret = wasm.stream_remove(this.__wbg_ptr, handle);
416
- if (ret[2]) {
417
- throw takeFromExternrefTable0(ret[1]);
418
- }
419
- return ret[0] !== 0;
424
+ return ret;
420
425
  }
421
426
  /**
422
427
  * False where the stream no longer holds `handle`.
423
428
  * @param {number} handle
424
429
  * @param {string} term
425
- * @returns {boolean}
430
+ * @returns {Promise<boolean>}
426
431
  */
427
432
  replace(handle, term) {
428
433
  const ptr0 = passStringToWasm0(term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
434
  const len0 = WASM_VECTOR_LEN;
430
435
  const ret = wasm.stream_replace(this.__wbg_ptr, handle, ptr0, len0);
431
- if (ret[2]) {
432
- throw takeFromExternrefTable0(ret[1]);
433
- }
434
- return ret[0] !== 0;
436
+ return ret;
435
437
  }
436
438
  /**
437
439
  * @returns {number}
438
440
  */
439
441
  get sample_rate() {
440
442
  const ret = wasm.stream_sample_rate(this.__wbg_ptr);
441
- return ret >>> 0;
443
+ if (ret[2]) {
444
+ throw takeFromExternrefTable0(ret[1]);
445
+ }
446
+ return ret[0] >>> 0;
442
447
  }
443
448
  /**
444
449
  * @returns {any}
@@ -543,7 +548,7 @@ function __wbg_get_imports() {
543
548
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
544
549
  arg0._wbg_cb_unref();
545
550
  },
546
- __wbg_arrayBuffer_303605bfdb02dbaa: function(arg0) {
551
+ __wbg_arrayBuffer_be9196be466b026c: function(arg0) {
547
552
  const ret = arg0.arrayBuffer();
548
553
  return ret;
549
554
  },
@@ -555,7 +560,7 @@ function __wbg_get_imports() {
555
560
  const ret = arg0.call(arg1, arg2);
556
561
  return ret;
557
562
  }, arguments); },
558
- __wbg_close_c91cbb2cddb6f7aa: function(arg0) {
563
+ __wbg_close_3a3da2c0b5950d54: function(arg0) {
559
564
  const ret = arg0.close();
560
565
  return ret;
561
566
  },
@@ -563,7 +568,7 @@ function __wbg_get_imports() {
563
568
  const ret = Composition.__wrap(arg0);
564
569
  return ret;
565
570
  },
566
- __wbg_createWritable_dcac2d262cf50ae7: function(arg0) {
571
+ __wbg_createWritable_7eba132720802ecc: function(arg0) {
567
572
  const ret = arg0.createWritable();
568
573
  return ret;
569
574
  },
@@ -575,15 +580,15 @@ function __wbg_get_imports() {
575
580
  const ret = Array.from(arg0);
576
581
  return ret;
577
582
  },
578
- __wbg_getDirectoryHandle_6ba4491be2862323: function(arg0, arg1, arg2, arg3) {
583
+ __wbg_getDirectoryHandle_638d1a5c4bf1966d: function(arg0, arg1, arg2, arg3) {
579
584
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
580
585
  return ret;
581
586
  },
582
- __wbg_getFileHandle_9709cc764716faf0: function(arg0, arg1, arg2, arg3) {
587
+ __wbg_getFileHandle_98d7c52e03604ca5: function(arg0, arg1, arg2, arg3) {
583
588
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
584
589
  return ret;
585
590
  },
586
- __wbg_getFile_514e6ad2d0b16f74: function(arg0) {
591
+ __wbg_getFile_84e299f9ca29fcea: function(arg0) {
587
592
  const ret = arg0.getFile();
588
593
  return ret;
589
594
  },
@@ -613,7 +618,7 @@ function __wbg_get_imports() {
613
618
  const ret = Array.isArray(arg0);
614
619
  return ret;
615
620
  },
616
- __wbg_keys_23712aa1a6f4aa5d: function(arg0) {
621
+ __wbg_keys_c94929b6f83bc1b9: function(arg0) {
617
622
  const ret = arg0.keys();
618
623
  return ret;
619
624
  },
@@ -625,7 +630,7 @@ function __wbg_get_imports() {
625
630
  const ret = arg0.length;
626
631
  return ret;
627
632
  },
628
- __wbg_move_2019b378ef90cf6c: function(arg0, arg1, arg2, arg3) {
633
+ __wbg_move_8bee0fab8a394cb5: function(arg0, arg1, arg2, arg3) {
629
634
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
630
635
  return ret;
631
636
  },
@@ -633,10 +638,6 @@ function __wbg_get_imports() {
633
638
  const ret = new Uint8Array(arg0);
634
639
  return ret;
635
640
  },
636
- __wbg_new_30145d082ba9492c: function(arg0, arg1) {
637
- const ret = new Error(getStringFromWasm0(arg0, arg1));
638
- return ret;
639
- },
640
641
  __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
641
642
  try {
642
643
  var state0 = {a: arg0, b: arg1};
@@ -659,6 +660,10 @@ function __wbg_get_imports() {
659
660
  const ret = new Object();
660
661
  return ret;
661
662
  },
663
+ __wbg_new_c76aa635a13cdc59: function(arg0, arg1) {
664
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
665
+ return ret;
666
+ },
662
667
  __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
663
668
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
664
669
  return ret;
@@ -681,18 +686,18 @@ function __wbg_get_imports() {
681
686
  state0.a = 0;
682
687
  }
683
688
  },
684
- __wbg_next_30e6632b4218cb09: function(arg0) {
689
+ __wbg_next_3e3ca2daea5cd939: function(arg0) {
685
690
  const ret = arg0.next();
686
691
  return ret;
687
692
  },
688
- __wbg_parse_a1c86daae8e336bd: function() { return handleError(function (arg0, arg1) {
693
+ __wbg_parse_27e7dc84974fe18b: function() { return handleError(function (arg0, arg1) {
689
694
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
690
695
  return ret;
691
696
  }, arguments); },
692
697
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
693
698
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
694
699
  },
695
- __wbg_query_259d928d723fff72: function(arg0) {
700
+ __wbg_query_e8d4a4541f8a732e: function(arg0) {
696
701
  const ret = arg0.query();
697
702
  return ret;
698
703
  },
@@ -707,19 +712,19 @@ function __wbg_get_imports() {
707
712
  const ret = Math.random();
708
713
  return ret;
709
714
  },
710
- __wbg_removeEntry_526b61f67204248f: function(arg0, arg1, arg2) {
711
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
715
+ __wbg_removeEntry_31eaa4b3d8f57600: function(arg0, arg1, arg2, arg3) {
716
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
712
717
  return ret;
713
718
  },
714
- __wbg_removeEntry_73524952fdb64743: function(arg0, arg1, arg2, arg3) {
715
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
719
+ __wbg_removeEntry_c2d36332ccabb790: function(arg0, arg1, arg2) {
720
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
716
721
  return ret;
717
722
  },
718
723
  __wbg_rendering_new: function(arg0) {
719
724
  const ret = Rendering.__wrap(arg0);
720
725
  return ret;
721
726
  },
722
- __wbg_request_eda21e880c785d71: function(arg0, arg1, arg2, arg3) {
727
+ __wbg_request_d9d81a79185ecd35: function(arg0, arg1, arg2, arg3) {
723
728
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
724
729
  return ret;
725
730
  },
@@ -731,13 +736,13 @@ function __wbg_get_imports() {
731
736
  const ret = Reflect.set(arg0, arg1, arg2);
732
737
  return ret;
733
738
  }, arguments); },
734
- __wbg_set_name_67f69e636c52b8b8: function(arg0, arg1, arg2) {
739
+ __wbg_set_name_eefc31a33db38edb: function(arg0, arg1, arg2) {
735
740
  arg0.name = getStringFromWasm0(arg1, arg2);
736
741
  },
737
- __wbg_set_refusal_67dcb641bf92d6bd: function(arg0, arg1) {
742
+ __wbg_set_refusal_b8f13d05e8212be6: function(arg0, arg1) {
738
743
  arg0.refusal = arg1;
739
744
  },
740
- __wbg_size_a827722774ab6a64: function(arg0) {
745
+ __wbg_size_a1ed0c98f6f32013: function(arg0) {
741
746
  const ret = arg0.size;
742
747
  return ret;
743
748
  },
@@ -757,6 +762,10 @@ function __wbg_get_imports() {
757
762
  const ret = typeof window === 'undefined' ? null : window;
758
763
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
759
764
  },
765
+ __wbg_stream_new: function(arg0) {
766
+ const ret = Stream.__wrap(arg0);
767
+ return ret;
768
+ },
760
769
  __wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
761
770
  const ret = arg0.then(arg1, arg2);
762
771
  return ret;
@@ -765,18 +774,18 @@ function __wbg_get_imports() {
765
774
  const ret = arg0.then(arg1);
766
775
  return ret;
767
776
  },
768
- __wbg_write_b2d191debe961263: function(arg0, arg1) {
777
+ __wbg_write_d29f03282c34951b: function(arg0, arg1) {
769
778
  const ret = arg0.write(arg1);
770
779
  return ret;
771
780
  },
772
781
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
773
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 491, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
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`.
774
783
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd55bb211d6a08150);
775
784
  return ret;
776
785
  },
777
786
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
778
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 38, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
779
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385);
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);
780
789
  return ret;
781
790
  },
782
791
  __wbindgen_generic_0000000000000003: function(arg0) {
@@ -805,8 +814,8 @@ function __wbg_get_imports() {
805
814
  };
806
815
  }
807
816
 
808
- function wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385(arg0, arg1) {
809
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2cf8ee606c8af385(arg0, arg1);
817
+ function wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1) {
818
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h3f8776df83dbd585(arg0, arg1);
810
819
  return ret;
811
820
  }
812
821
 
package/sva_wasm_bg.wasm CHANGED
Binary file