@scalable-vector-audio/sva-wasm 0.14.18 → 0.14.20

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.14.18",
5
+ "version": "0.14.20",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -166,6 +166,10 @@ export class Composition {
166
166
  * Memory's disk traffic since it opened.
167
167
  */
168
168
  counters(): any;
169
+ /**
170
+ * What `sample("<path>")` reads: one decoded Float32Array per channel, at `rate`.
171
+ */
172
+ insertRecording(path: string, rate: number, channels: Array<any>): void;
169
173
  insert(path: string, text: string): void;
170
174
  constructor(name?: string | null);
171
175
  /**
@@ -185,6 +189,10 @@ export class Composition {
185
189
  * `AbortError` before its next block.
186
190
  */
187
191
  render(target: string, representations: string[] | null | undefined, options: any): Promise<Rendering>;
192
+ /**
193
+ * `sva-cli solve`'s envelope; `options` as its flags, `signal` and `progress(line)`.
194
+ */
195
+ solve(cost: string, vary: string[], options: any): Promise<any>;
188
196
  /**
189
197
  * `target`'s placed notes as `sva-cli outline @score/song` lists them, under
190
198
  * `options.set` as `render` takes it: `{ song, events }`, each with `at`, `sounds`,
@@ -222,9 +230,9 @@ export class Rendering {
222
230
  [Symbol.dispose](): void;
223
231
  /**
224
232
  * The object `sva-cli render` puts under `data`, one reading per representation asked,
225
- * arrays capped as it caps.
233
+ * arrays capped as it caps unless `options.limit` says otherwise.
226
234
  */
227
- representations(): any;
235
+ representations(options: any): any;
228
236
  samples(channel: number): Float32Array;
229
237
  /**
230
238
  * Every lookup this render made of memory, and what each came to.
@@ -298,9 +306,10 @@ export class Stream {
298
306
 
299
307
  /**
300
308
  * The object `sva-cli analyze` puts under `data` for these channels at `rate`, refusing as
301
- * it refuses.
309
+ * it refuses. `options.limit`: how many values each array holds, or `null` for every
310
+ * value, as a reading `sva-cli` writes to a file.
302
311
  */
303
- export function analyze(target: string, rate: number, channels: Array<any>, representations: string[]): any;
312
+ export function analyze(target: string, rate: number, channels: Array<any>, representations: string[], options: any): any;
304
313
 
305
314
  export function initThreadPool(num_threads: number): Promise<any>;
306
315
 
@@ -339,18 +348,20 @@ export interface InitOutput {
339
348
  readonly __wbg_rendering_free: (a: number, b: number) => void;
340
349
  readonly __wbg_stream_free: (a: number, b: number) => void;
341
350
  readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
342
- readonly analyze: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
351
+ readonly analyze: (a: number, b: number, c: number, d: any, e: number, f: number, g: any) => [number, number, number];
343
352
  readonly composition_cache_bytes: (a: number) => number;
344
353
  readonly composition_cache_entries: (a: number) => number;
345
354
  readonly composition_cache_evictions: (a: number) => number;
346
355
  readonly composition_cache_max_bytes: (a: number) => number;
347
356
  readonly composition_counters: (a: number) => [number, number, number];
348
357
  readonly composition_insert: (a: number, b: number, c: number, d: number, e: number) => void;
358
+ readonly composition_insertRecording: (a: number, b: number, c: number, d: number, e: any) => [number, number];
349
359
  readonly composition_new: (a: number, b: number) => number;
350
360
  readonly composition_open: (a: number, b: number, c: number, d: any) => any;
351
361
  readonly composition_persist: (a: number) => any;
352
362
  readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
353
363
  readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
364
+ readonly composition_solve: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
354
365
  readonly composition_song: (a: number, b: number, c: number, d: any) => [number, number, number];
355
366
  readonly composition_store_bytes: (a: number) => [number, number];
356
367
  readonly composition_store_max_bytes: (a: number) => [number, number];
@@ -362,7 +373,7 @@ export interface InitOutput {
362
373
  readonly readings: () => [number, number, number];
363
374
  readonly rendering_channels: (a: number) => number;
364
375
  readonly rendering_duration_secs: (a: number) => number;
365
- readonly rendering_representations: (a: number) => [number, number, number];
376
+ readonly rendering_representations: (a: number, b: any) => [number, number, number];
366
377
  readonly rendering_sample_rate: (a: number) => number;
367
378
  readonly rendering_samples: (a: number, b: number) => [number, number, number, number];
368
379
  readonly rendering_stats: (a: number) => [number, number, number];
package/sva_wasm.js CHANGED
@@ -58,6 +58,20 @@ export class Composition {
58
58
  }
59
59
  return takeFromExternrefTable0(ret[0]);
60
60
  }
61
+ /**
62
+ * What `sample("<path>")` reads: one decoded Float32Array per channel, at `rate`.
63
+ * @param {string} path
64
+ * @param {number} rate
65
+ * @param {Array<any>} channels
66
+ */
67
+ insertRecording(path, rate, channels) {
68
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
69
+ const len0 = WASM_VECTOR_LEN;
70
+ const ret = wasm.composition_insertRecording(this.__wbg_ptr, ptr0, len0, rate, channels);
71
+ if (ret[1]) {
72
+ throw takeFromExternrefTable0(ret[0]);
73
+ }
74
+ }
61
75
  /**
62
76
  * @param {string} path
63
77
  * @param {string} text
@@ -127,6 +141,21 @@ export class Composition {
127
141
  set cache_max_bytes(max_bytes) {
128
142
  wasm.composition_set_cache_max_bytes(this.__wbg_ptr, max_bytes);
129
143
  }
144
+ /**
145
+ * `sva-cli solve`'s envelope; `options` as its flags, `signal` and `progress(line)`.
146
+ * @param {string} cost
147
+ * @param {string[]} vary
148
+ * @param {any} options
149
+ * @returns {Promise<any>}
150
+ */
151
+ solve(cost, vary, options) {
152
+ const ptr0 = passStringToWasm0(cost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
153
+ const len0 = WASM_VECTOR_LEN;
154
+ const ptr1 = passArrayJsValueToWasm0(vary, wasm.__wbindgen_malloc);
155
+ const len1 = WASM_VECTOR_LEN;
156
+ const ret = wasm.composition_solve(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
157
+ return ret;
158
+ }
130
159
  /**
131
160
  * `target`'s placed notes as `sva-cli outline @score/song` lists them, under
132
161
  * `options.set` as `render` takes it: `{ song, events }`, each with `at`, `sounds`,
@@ -223,11 +252,12 @@ export class Rendering {
223
252
  }
224
253
  /**
225
254
  * The object `sva-cli render` puts under `data`, one reading per representation asked,
226
- * arrays capped as it caps.
255
+ * arrays capped as it caps unless `options.limit` says otherwise.
256
+ * @param {any} options
227
257
  * @returns {any}
228
258
  */
229
- representations() {
230
- const ret = wasm.rendering_representations(this.__wbg_ptr);
259
+ representations(options) {
260
+ const ret = wasm.rendering_representations(this.__wbg_ptr, options);
231
261
  if (ret[2]) {
232
262
  throw takeFromExternrefTable0(ret[1]);
233
263
  }
@@ -461,19 +491,21 @@ if (Symbol.dispose) Stream.prototype[Symbol.dispose] = Stream.prototype.free;
461
491
 
462
492
  /**
463
493
  * The object `sva-cli analyze` puts under `data` for these channels at `rate`, refusing as
464
- * it refuses.
494
+ * it refuses. `options.limit`: how many values each array holds, or `null` for every
495
+ * value, as a reading `sva-cli` writes to a file.
465
496
  * @param {string} target
466
497
  * @param {number} rate
467
498
  * @param {Array<any>} channels
468
499
  * @param {string[]} representations
500
+ * @param {any} options
469
501
  * @returns {any}
470
502
  */
471
- export function analyze(target, rate, channels, representations) {
503
+ export function analyze(target, rate, channels, representations, options) {
472
504
  const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
505
  const len0 = WASM_VECTOR_LEN;
474
506
  const ptr1 = passArrayJsValueToWasm0(representations, wasm.__wbindgen_malloc);
475
507
  const len1 = WASM_VECTOR_LEN;
476
- const ret = wasm.analyze(ptr0, len0, rate, channels, ptr1, len1);
508
+ const ret = wasm.analyze(ptr0, len0, rate, channels, ptr1, len1, options);
477
509
  if (ret[2]) {
478
510
  throw takeFromExternrefTable0(ret[1]);
479
511
  }
@@ -650,7 +682,7 @@ function __wbg_get_imports(memory) {
650
682
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
651
683
  arg0._wbg_cb_unref();
652
684
  },
653
- __wbg_arrayBuffer_68f4dd127df03a92: function(arg0) {
685
+ __wbg_arrayBuffer_e29603fbb7413792: function(arg0) {
654
686
  const ret = arg0.arrayBuffer();
655
687
  return ret;
656
688
  },
@@ -670,18 +702,18 @@ function __wbg_get_imports(memory) {
670
702
  const ret = arg0.call(arg1, arg2);
671
703
  return ret;
672
704
  }, arguments); },
673
- __wbg_close_34b7f70d9e521b69: function(arg0) {
705
+ __wbg_close_0058ba3abbb2e948: function(arg0) {
706
+ arg0.close();
707
+ },
708
+ __wbg_close_4d96984e1092a65a: function(arg0) {
674
709
  const ret = arg0.close();
675
710
  return ret;
676
711
  },
677
- __wbg_close_6de49a18ae4c51b5: function(arg0) {
678
- arg0.close();
679
- },
680
712
  __wbg_composition_new: function(arg0) {
681
713
  const ret = Composition.__wrap(arg0);
682
714
  return ret;
683
715
  },
684
- __wbg_createWritable_dab9eae3645dfb89: function(arg0) {
716
+ __wbg_createWritable_db9efbff89d31a22: function(arg0) {
685
717
  const ret = arg0.createWritable();
686
718
  return ret;
687
719
  },
@@ -697,15 +729,15 @@ function __wbg_get_imports(memory) {
697
729
  const ret = Array.from(arg0);
698
730
  return ret;
699
731
  },
700
- __wbg_getDirectoryHandle_606756f9e63fd85c: function(arg0, arg1, arg2, arg3) {
732
+ __wbg_getDirectoryHandle_65154acb323edb5a: function(arg0, arg1, arg2, arg3) {
701
733
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
702
734
  return ret;
703
735
  },
704
- __wbg_getFileHandle_1e738052919cdc0f: function(arg0, arg1, arg2, arg3) {
736
+ __wbg_getFileHandle_ac6d479cbce76278: function(arg0, arg1, arg2, arg3) {
705
737
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
706
738
  return ret;
707
739
  },
708
- __wbg_getFile_511199f873928693: function(arg0) {
740
+ __wbg_getFile_fc773e65f7a96603: function(arg0) {
709
741
  const ret = arg0.getFile();
710
742
  return ret;
711
743
  },
@@ -759,7 +791,7 @@ function __wbg_get_imports(memory) {
759
791
  const ret = Array.isArray(arg0);
760
792
  return ret;
761
793
  },
762
- __wbg_keys_8d144bacbe748de5: function(arg0) {
794
+ __wbg_keys_b3b8cf7df8baa503: function(arg0) {
763
795
  const ret = arg0.keys();
764
796
  return ret;
765
797
  },
@@ -775,11 +807,11 @@ function __wbg_get_imports(memory) {
775
807
  const ret = arg0.length;
776
808
  return ret;
777
809
  },
778
- __wbg_move_14431b26910da2c7: function(arg0, arg1, arg2, arg3) {
810
+ __wbg_move_9f7a9e1981813461: function(arg0, arg1, arg2, arg3) {
779
811
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
780
812
  return ret;
781
813
  },
782
- __wbg_name_9b769fc96e76aee1: function(arg0, arg1) {
814
+ __wbg_name_629e048da2876a10: function(arg0, arg1) {
783
815
  const ret = arg1.name;
784
816
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
785
817
  const len1 = WASM_VECTOR_LEN;
@@ -790,10 +822,18 @@ function __wbg_get_imports(memory) {
790
822
  const ret = new Int32Array(arg0);
791
823
  return ret;
792
824
  },
825
+ __wbg_new_0d715b19bdf9498c: function() {
826
+ const ret = new MessageChannel();
827
+ return ret;
828
+ },
793
829
  __wbg_new_1da3429bc3c4541c: function(arg0) {
794
830
  const ret = new Uint8Array(arg0);
795
831
  return ret;
796
832
  },
833
+ __wbg_new_7c7f106d53cf296c: function(arg0, arg1) {
834
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
835
+ return ret;
836
+ },
797
837
  __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
798
838
  try {
799
839
  var state0 = {a: arg0, b: arg1};
@@ -812,18 +852,10 @@ function __wbg_get_imports(memory) {
812
852
  state0.a = 0;
813
853
  }
814
854
  },
815
- __wbg_new_b195bf62472c2f6d: function(arg0, arg1) {
816
- const ret = new Error(getStringFromWasm0(arg0, arg1));
817
- return ret;
818
- },
819
855
  __wbg_new_bebc3f4757acf305: function() {
820
856
  const ret = new Object();
821
857
  return ret;
822
858
  },
823
- __wbg_new_eb4d3578e49e9724: function() {
824
- const ret = new MessageChannel();
825
- return ret;
826
- },
827
859
  __wbg_new_ffa92086ea89f79c: function() {
828
860
  const ret = new Array();
829
861
  return ret;
@@ -854,7 +886,7 @@ function __wbg_get_imports(memory) {
854
886
  const ret = new Worker(getStringFromWasm0(arg0, arg1));
855
887
  return ret;
856
888
  },
857
- __wbg_next_e56a711e6a1c9a4f: function(arg0) {
889
+ __wbg_next_9176f5a2a54ca305: function(arg0) {
858
890
  const ret = arg0.next();
859
891
  return ret;
860
892
  },
@@ -862,24 +894,24 @@ function __wbg_get_imports(memory) {
862
894
  const ret = Array.of(arg0, arg1, arg2);
863
895
  return ret;
864
896
  },
865
- __wbg_parse_5ed75c6fddc2f508: function() { return handleError(function (arg0, arg1) {
897
+ __wbg_parse_e3be4b13e18b6b18: function() { return handleError(function (arg0, arg1) {
866
898
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
867
899
  return ret;
868
900
  }, arguments); },
869
- __wbg_port1_aaad21730e7482a3: function(arg0) {
901
+ __wbg_port1_a98064467b620bec: function(arg0) {
870
902
  const ret = arg0.port1;
871
903
  return ret;
872
904
  },
873
- __wbg_port2_c5c203aaa9319736: function(arg0) {
905
+ __wbg_port2_33b8daafa45e2100: function(arg0) {
874
906
  const ret = arg0.port2;
875
907
  return ret;
876
908
  },
909
+ __wbg_postMessage_4e60d208733dd268: function(arg0, arg1) {
910
+ arg0.postMessage(arg1);
911
+ },
877
912
  __wbg_postMessage_8105a302ed002474: function() { return handleError(function (arg0, arg1) {
878
913
  arg0.postMessage(arg1);
879
914
  }, arguments); },
880
- __wbg_postMessage_d8c8253ecbb41e69: function(arg0, arg1) {
881
- arg0.postMessage(arg1);
882
- },
883
915
  __wbg_prototypesetcall_804a1eb1b047ccb9: function(arg0, arg1, arg2) {
884
916
  Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
885
917
  },
@@ -890,7 +922,7 @@ function __wbg_get_imports(memory) {
890
922
  const ret = arg0.push(arg1);
891
923
  return ret;
892
924
  },
893
- __wbg_query_684a3bdc4da5c52d: function(arg0) {
925
+ __wbg_query_51024f18d035960d: function(arg0) {
894
926
  const ret = arg0.query();
895
927
  return ret;
896
928
  },
@@ -905,11 +937,11 @@ function __wbg_get_imports(memory) {
905
937
  const ret = Math.random();
906
938
  return ret;
907
939
  },
908
- __wbg_removeEntry_2aebc9204f2fc350: function(arg0, arg1, arg2, arg3) {
940
+ __wbg_removeEntry_e4d944c91e6cf2f6: function(arg0, arg1, arg2, arg3) {
909
941
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
910
942
  return ret;
911
943
  },
912
- __wbg_removeEntry_544cda30b424d2fb: function(arg0, arg1, arg2) {
944
+ __wbg_removeEntry_e5b8506039a55bdb: function(arg0, arg1, arg2) {
913
945
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
914
946
  return ret;
915
947
  },
@@ -917,7 +949,7 @@ function __wbg_get_imports(memory) {
917
949
  const ret = Rendering.__wrap(arg0);
918
950
  return ret;
919
951
  },
920
- __wbg_request_fb9739366b229fe6: function(arg0, arg1, arg2, arg3) {
952
+ __wbg_request_1ac049ca0cd0b19a: function(arg0, arg1, arg2, arg3) {
921
953
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
922
954
  return ret;
923
955
  },
@@ -932,23 +964,23 @@ function __wbg_get_imports(memory) {
932
964
  __wbg_set_c41f8dbc07a2190f: function(arg0, arg1, arg2) {
933
965
  arg0.set(getArrayF32FromWasm0(arg1, arg2));
934
966
  },
935
- __wbg_set_name_bf708f7a3979d8f8: function(arg0, arg1, arg2) {
967
+ __wbg_set_name_bc9162a3ae0bc5eb: function(arg0, arg1, arg2) {
936
968
  arg0.name = getStringFromWasm0(arg1, arg2);
937
969
  },
938
- __wbg_set_onmessage_125b81d7dfe471ea: function(arg0, arg1) {
970
+ __wbg_set_onmessage_2244c2525c4e0c38: function(arg0, arg1) {
939
971
  arg0.onmessage = arg1;
940
972
  },
941
- __wbg_set_onmessage_2244c2525c4e0c38: function(arg0, arg1) {
973
+ __wbg_set_onmessage_d5536090d1c54a1f: function(arg0, arg1) {
942
974
  arg0.onmessage = arg1;
943
975
  },
944
- __wbg_set_refusal_b22fd2609f5162e0: function(arg0, arg1) {
976
+ __wbg_set_refusal_02cb46b24b0c05ca: function(arg0, arg1) {
945
977
  arg0.refusal = arg1;
946
978
  },
947
- __wbg_size_c4cc97a3744e8c75: function(arg0) {
979
+ __wbg_size_12001a980cb86c23: function(arg0) {
948
980
  const ret = arg0.size;
949
981
  return ret;
950
982
  },
951
- __wbg_slice_e18f06100b9ceffd: function(arg0, arg1, arg2) {
983
+ __wbg_slice_92746a756d29cf21: function(arg0, arg1, arg2) {
952
984
  const ret = arg0.slice(arg1, arg2);
953
985
  return ret;
954
986
  },
@@ -1008,10 +1040,10 @@ function __wbg_get_imports(memory) {
1008
1040
  const ret = Atomics.waitAsync;
1009
1041
  return ret;
1010
1042
  },
1011
- __wbg_warn_40ee899af419dde6: function(arg0, arg1) {
1043
+ __wbg_warn_fe0e62581cc260ab: function(arg0, arg1) {
1012
1044
  console.warn(getStringFromWasm0(arg0, arg1));
1013
1045
  },
1014
- __wbg_write_7084e3105800159d: function(arg0, arg1) {
1046
+ __wbg_write_6325ef1ba9abab0d: function(arg0, arg1) {
1015
1047
  const ret = arg0.write(arg1);
1016
1048
  return ret;
1017
1049
  },
@@ -1021,12 +1053,12 @@ function __wbg_get_imports(memory) {
1021
1053
  return ret;
1022
1054
  },
1023
1055
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1024
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 558, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1056
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 582, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1025
1057
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___wasm_bindgen_d3a5247b0aa3f0ac___JsValue__core_ea519e494776717c___result__Result_____wasm_bindgen_d3a5247b0aa3f0ac___JsError___true_);
1026
1058
  return ret;
1027
1059
  },
1028
1060
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1029
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 560, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1061
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 584, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1030
1062
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___js_sys_2b088e2931f41c5___futures__task__wait_async_polyfill__MessageEvent______true_);
1031
1063
  return ret;
1032
1064
  },
package/sva_wasm_bg.wasm CHANGED
Binary file