kordweb 0.5.4 → 0.5.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.
Files changed (4) hide show
  1. package/klib.d.ts +82 -20
  2. package/klib.js +226 -48
  3. package/klib_bg.wasm +0 -0
  4. package/package.json +1 -1
package/klib.d.ts CHANGED
@@ -19,13 +19,13 @@ export class KordChord {
19
19
  * @param {string} notes
20
20
  * @returns {KordChords}
21
21
  */
22
- static from_notes_string(notes: string): KordChords;
22
+ static fromNotesString(notes: string): KordChords;
23
23
  /**
24
24
  * Creates a new [`Chord`] from a set of [`Note`]s.
25
25
  * @param {KordNotes} notes
26
26
  * @returns {KordChords}
27
27
  */
28
- static from_notes(notes: KordNotes): KordChords;
28
+ static fromNotes(notes: KordNotes): KordChords;
29
29
  /**
30
30
  * Returns the [`Chord`]'s friendly name.
31
31
  * @returns {string}
@@ -35,7 +35,12 @@ export class KordChord {
35
35
  * Returns the [`Chord`]'s precise name.
36
36
  * @returns {string}
37
37
  */
38
- precise_name(): string;
38
+ preciseName(): string;
39
+ /**
40
+ * Returns the [`Chord`] as a string (same as `precise_name`).
41
+ * @returns {string}
42
+ */
43
+ toString(): string;
39
44
  /**
40
45
  * Returns the [`Chord`]'s description.
41
46
  * @returns {string}
@@ -65,7 +70,7 @@ export class KordChord {
65
70
  * Returns whether or not the [`Chord`] is "crunchy".
66
71
  * @returns {boolean}
67
72
  */
68
- is_crunchy(): boolean;
73
+ isCrunchy(): boolean;
69
74
  /**
70
75
  * Returns the [`Chord`]'s chord tones.
71
76
  * @returns {KordNotes}
@@ -75,7 +80,7 @@ export class KordChord {
75
80
  * Returns the [`Chord`]'s chord tones as a string.
76
81
  * @returns {string}
77
82
  */
78
- chord_string(): string;
83
+ chordString(): string;
79
84
  /**
80
85
  * Returns the [`Chord`]'s scale tones.
81
86
  * @returns {KordNotes}
@@ -85,7 +90,7 @@ export class KordChord {
85
90
  * Returns the [`Chord`]'s scale tones as a string.
86
91
  * @returns {string}
87
92
  */
88
- scale_string(): string;
93
+ scaleString(): string;
89
94
  /**
90
95
  * Plays the [`Chord`].
91
96
  * @param {number} delay
@@ -110,13 +115,34 @@ export class KordChords {
110
115
  * Returns the [`Chord`]s as a space-separated string.
111
116
  * @returns {string}
112
117
  */
113
- to_string(): string;
118
+ toString(): string;
119
+ /**
120
+ * Returns the [`Chord`]s as an iterator.
121
+ * @returns {KordChordsIterator}
122
+ */
123
+ iterator(): KordChordsIterator;
124
+ /**
125
+ * Returns the [`Chord`]s as an array.
126
+ * @returns {Array<any>}
127
+ */
128
+ toArray(): Array<any>;
114
129
  /**
115
130
  * Returns the number of items in the collection.
116
131
  */
117
132
  readonly length: number;
118
133
  }
119
134
  /**
135
+ * The [`Chord`]s iterator.
136
+ */
137
+ export class KordChordsIterator {
138
+ free(): void;
139
+ /**
140
+ * Gets the next item in the collection.
141
+ * @returns {any}
142
+ */
143
+ next(): any;
144
+ }
145
+ /**
120
146
  * The [`Note`] wrapper.
121
147
  */
122
148
  export class KordNote {
@@ -133,20 +159,25 @@ export class KordNote {
133
159
  * @param {number} length_in_seconds
134
160
  * @returns {KordNotes}
135
161
  */
136
- static from_audio(data: Float32Array, length_in_seconds: number): KordNotes;
162
+ static fromAudio(data: Float32Array, length_in_seconds: number): KordNotes;
137
163
  /**
138
164
  * Returns [`Note`]s from audio data using the ML inference algorithm.
139
165
  * @param {Float32Array} data
140
166
  * @param {number} length_in_seconds
141
167
  * @returns {KordNotes}
142
168
  */
143
- static from_audio_ml(data: Float32Array, length_in_seconds: number): KordNotes;
169
+ static fromAudioMl(data: Float32Array, length_in_seconds: number): KordNotes;
144
170
  /**
145
171
  * Returns the [`Note`]'s friendly name.
146
172
  * @returns {string}
147
173
  */
148
174
  name(): string;
149
175
  /**
176
+ * Returns the [`Note`] represented as a string (same as `name`).
177
+ * @returns {string}
178
+ */
179
+ toString(): string;
180
+ /**
150
181
  * Returns the [`Note`]'s [`NamedPitch`].
151
182
  * @returns {string}
152
183
  */
@@ -177,12 +208,33 @@ export class KordNotes {
177
208
  * Returns the [`Note`]s as a space-separated string.
178
209
  * @returns {string}
179
210
  */
180
- to_string(): string;
211
+ toString(): string;
212
+ /**
213
+ * Returns the [`Note`]s as an iterator.
214
+ * @returns {KordNotesIterator}
215
+ */
216
+ iterator(): KordNotesIterator;
217
+ /**
218
+ * Returns the [`Note`]s as an array.
219
+ * @returns {Array<any>}
220
+ */
221
+ toArray(): Array<any>;
181
222
  /**
182
223
  * Returns the number of items in the collection.
183
224
  */
184
225
  readonly length: number;
185
226
  }
227
+ /**
228
+ * The [`Note`]s iterator.
229
+ */
230
+ export class KordNotesIterator {
231
+ free(): void;
232
+ /**
233
+ * Gets the next item in the collection.
234
+ * @returns {any}
235
+ */
236
+ next(): any;
237
+ }
186
238
 
187
239
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
188
240
 
@@ -190,37 +242,47 @@ export interface InitOutput {
190
242
  readonly memory: WebAssembly.Memory;
191
243
  readonly __wbg_kordnote_free: (a: number) => void;
192
244
  readonly kordnote_parse: (a: number, b: number, c: number) => void;
193
- readonly kordnote_from_audio: (a: number, b: number, c: number, d: number) => void;
194
- readonly kordnote_from_audio_ml: (a: number, b: number, c: number, d: number) => void;
245
+ readonly kordnote_fromAudio: (a: number, b: number, c: number, d: number) => void;
246
+ readonly kordnote_fromAudioMl: (a: number, b: number, c: number, d: number) => void;
195
247
  readonly kordnote_name: (a: number, b: number) => void;
248
+ readonly kordnote_toString: (a: number, b: number) => void;
196
249
  readonly kordnote_pitch: (a: number, b: number) => void;
197
250
  readonly kordnote_octave: (a: number) => number;
198
251
  readonly kordnote_frequency: (a: number) => number;
199
252
  readonly __wbg_kordnotes_free: (a: number) => void;
200
253
  readonly kordnotes_get: (a: number, b: number) => number;
201
- readonly kordnotes_to_string: (a: number, b: number) => void;
254
+ readonly kordnotes_toString: (a: number, b: number) => void;
255
+ readonly kordnotes_iterator: (a: number) => number;
256
+ readonly kordnotes_toArray: (a: number) => number;
257
+ readonly __wbg_kordnotesiterator_free: (a: number) => void;
258
+ readonly kordnotesiterator_next: (a: number, b: number) => void;
202
259
  readonly __wbg_kordchord_free: (a: number) => void;
203
260
  readonly kordchord_parse: (a: number, b: number, c: number) => void;
204
- readonly kordchord_from_notes_string: (a: number, b: number, c: number) => void;
205
- readonly kordchord_from_notes: (a: number, b: number) => void;
261
+ readonly kordchord_fromNotesString: (a: number, b: number, c: number) => void;
262
+ readonly kordchord_fromNotes: (a: number, b: number) => void;
206
263
  readonly kordchord_name: (a: number, b: number) => void;
207
- readonly kordchord_precise_name: (a: number, b: number) => void;
264
+ readonly kordchord_preciseName: (a: number, b: number) => void;
208
265
  readonly kordchord_description: (a: number, b: number) => void;
209
266
  readonly kordchord_display: (a: number, b: number) => void;
210
267
  readonly kordchord_root: (a: number, b: number) => void;
211
268
  readonly kordchord_slash: (a: number, b: number) => void;
212
269
  readonly kordchord_inversion: (a: number) => number;
213
- readonly kordchord_is_crunchy: (a: number) => number;
270
+ readonly kordchord_isCrunchy: (a: number) => number;
214
271
  readonly kordchord_chord: (a: number) => number;
215
- readonly kordchord_chord_string: (a: number, b: number) => void;
272
+ readonly kordchord_chordString: (a: number, b: number) => void;
216
273
  readonly kordchord_scale: (a: number) => number;
217
- readonly kordchord_scale_string: (a: number, b: number) => void;
274
+ readonly kordchord_scaleString: (a: number, b: number) => void;
218
275
  readonly kordchord_play: (a: number, b: number, c: number, d: number) => number;
219
276
  readonly __wbg_kordchords_free: (a: number) => void;
220
277
  readonly kordchords_get: (a: number, b: number) => number;
221
278
  readonly kordchords_length: (a: number) => number;
222
- readonly kordchords_to_string: (a: number, b: number) => void;
279
+ readonly kordchords_toString: (a: number, b: number) => void;
280
+ readonly kordchords_iterator: (a: number) => number;
281
+ readonly kordchords_toArray: (a: number) => number;
282
+ readonly __wbg_kordchordsiterator_free: (a: number) => void;
283
+ readonly kordchordsiterator_next: (a: number, b: number) => void;
223
284
  readonly kordnotes_length: (a: number) => number;
285
+ readonly kordchord_toString: (a: number, b: number) => void;
224
286
  readonly __wbindgen_malloc: (a: number) => number;
225
287
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
226
288
  readonly __wbindgen_export_2: WebAssembly.Table;
package/klib.js CHANGED
@@ -1,26 +1,6 @@
1
1
  const lAudioContext = (typeof AudioContext !== 'undefined' ? AudioContext : (typeof webkitAudioContext !== 'undefined' ? webkitAudioContext : undefined));
2
2
  let wasm;
3
3
 
4
- const heap = new Array(128).fill(undefined);
5
-
6
- heap.push(undefined, null, true, false);
7
-
8
- function getObject(idx) { return heap[idx]; }
9
-
10
- let heap_next = heap.length;
11
-
12
- function dropObject(idx) {
13
- if (idx < 132) return;
14
- heap[idx] = heap_next;
15
- heap_next = idx;
16
- }
17
-
18
- function takeObject(idx) {
19
- const ret = getObject(idx);
20
- dropObject(idx);
21
- return ret;
22
- }
23
-
24
4
  const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25
5
 
26
6
  cachedTextDecoder.decode();
@@ -38,6 +18,12 @@ function getStringFromWasm0(ptr, len) {
38
18
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
39
19
  }
40
20
 
21
+ const heap = new Array(128).fill(undefined);
22
+
23
+ heap.push(undefined, null, true, false);
24
+
25
+ let heap_next = heap.length;
26
+
41
27
  function addHeapObject(obj) {
42
28
  if (heap_next === heap.length) heap.push(heap.length + 1);
43
29
  const idx = heap_next;
@@ -47,6 +33,20 @@ function addHeapObject(obj) {
47
33
  return idx;
48
34
  }
49
35
 
36
+ function getObject(idx) { return heap[idx]; }
37
+
38
+ function dropObject(idx) {
39
+ if (idx < 132) return;
40
+ heap[idx] = heap_next;
41
+ heap_next = idx;
42
+ }
43
+
44
+ function takeObject(idx) {
45
+ const ret = getObject(idx);
46
+ dropObject(idx);
47
+ return ret;
48
+ }
49
+
50
50
  function debugString(val) {
51
51
  // primitive types
52
52
  const type = typeof val;
@@ -246,7 +246,7 @@ function handleError(f, args) {
246
246
  function getArrayF32FromWasm0(ptr, len) {
247
247
  return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
248
248
  }
249
- function __wbg_adapter_91(arg0, arg1, arg2, arg3) {
249
+ function __wbg_adapter_111(arg0, arg1, arg2, arg3) {
250
250
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h768f6593dd414d73(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
251
251
  }
252
252
 
@@ -304,12 +304,12 @@ export class KordChord {
304
304
  * @param {string} notes
305
305
  * @returns {KordChords}
306
306
  */
307
- static from_notes_string(notes) {
307
+ static fromNotesString(notes) {
308
308
  try {
309
309
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
310
310
  const ptr0 = passStringToWasm0(notes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
311
  const len0 = WASM_VECTOR_LEN;
312
- wasm.kordchord_from_notes_string(retptr, ptr0, len0);
312
+ wasm.kordchord_fromNotesString(retptr, ptr0, len0);
313
313
  var r0 = getInt32Memory0()[retptr / 4 + 0];
314
314
  var r1 = getInt32Memory0()[retptr / 4 + 1];
315
315
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -326,12 +326,12 @@ export class KordChord {
326
326
  * @param {KordNotes} notes
327
327
  * @returns {KordChords}
328
328
  */
329
- static from_notes(notes) {
329
+ static fromNotes(notes) {
330
330
  try {
331
331
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
332
332
  _assertClass(notes, KordNotes);
333
333
  var ptr0 = notes.__destroy_into_raw();
334
- wasm.kordchord_from_notes(retptr, ptr0);
334
+ wasm.kordchord_fromNotes(retptr, ptr0);
335
335
  var r0 = getInt32Memory0()[retptr / 4 + 0];
336
336
  var r1 = getInt32Memory0()[retptr / 4 + 1];
337
337
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -363,10 +363,26 @@ export class KordChord {
363
363
  * Returns the [`Chord`]'s precise name.
364
364
  * @returns {string}
365
365
  */
366
- precise_name() {
366
+ preciseName() {
367
367
  try {
368
368
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
369
- wasm.kordchord_precise_name(retptr, this.ptr);
369
+ wasm.kordchord_preciseName(retptr, this.ptr);
370
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
371
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
372
+ return getStringFromWasm0(r0, r1);
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ wasm.__wbindgen_free(r0, r1);
376
+ }
377
+ }
378
+ /**
379
+ * Returns the [`Chord`] as a string (same as `precise_name`).
380
+ * @returns {string}
381
+ */
382
+ toString() {
383
+ try {
384
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
385
+ wasm.kordchord_preciseName(retptr, this.ptr);
370
386
  var r0 = getInt32Memory0()[retptr / 4 + 0];
371
387
  var r1 = getInt32Memory0()[retptr / 4 + 1];
372
388
  return getStringFromWasm0(r0, r1);
@@ -451,8 +467,8 @@ export class KordChord {
451
467
  * Returns whether or not the [`Chord`] is "crunchy".
452
468
  * @returns {boolean}
453
469
  */
454
- is_crunchy() {
455
- const ret = wasm.kordchord_is_crunchy(this.ptr);
470
+ isCrunchy() {
471
+ const ret = wasm.kordchord_isCrunchy(this.ptr);
456
472
  return ret !== 0;
457
473
  }
458
474
  /**
@@ -467,10 +483,10 @@ export class KordChord {
467
483
  * Returns the [`Chord`]'s chord tones as a string.
468
484
  * @returns {string}
469
485
  */
470
- chord_string() {
486
+ chordString() {
471
487
  try {
472
488
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
473
- wasm.kordchord_chord_string(retptr, this.ptr);
489
+ wasm.kordchord_chordString(retptr, this.ptr);
474
490
  var r0 = getInt32Memory0()[retptr / 4 + 0];
475
491
  var r1 = getInt32Memory0()[retptr / 4 + 1];
476
492
  return getStringFromWasm0(r0, r1);
@@ -491,10 +507,10 @@ export class KordChord {
491
507
  * Returns the [`Chord`]'s scale tones as a string.
492
508
  * @returns {string}
493
509
  */
494
- scale_string() {
510
+ scaleString() {
495
511
  try {
496
512
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
497
- wasm.kordchord_scale_string(retptr, this.ptr);
513
+ wasm.kordchord_scaleString(retptr, this.ptr);
498
514
  var r0 = getInt32Memory0()[retptr / 4 + 0];
499
515
  var r1 = getInt32Memory0()[retptr / 4 + 1];
500
516
  return getStringFromWasm0(r0, r1);
@@ -561,10 +577,10 @@ export class KordChords {
561
577
  * Returns the [`Chord`]s as a space-separated string.
562
578
  * @returns {string}
563
579
  */
564
- to_string() {
580
+ toString() {
565
581
  try {
566
582
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
567
- wasm.kordchords_to_string(retptr, this.ptr);
583
+ wasm.kordchords_toString(retptr, this.ptr);
568
584
  var r0 = getInt32Memory0()[retptr / 4 + 0];
569
585
  var r1 = getInt32Memory0()[retptr / 4 + 1];
570
586
  return getStringFromWasm0(r0, r1);
@@ -573,6 +589,67 @@ export class KordChords {
573
589
  wasm.__wbindgen_free(r0, r1);
574
590
  }
575
591
  }
592
+ /**
593
+ * Returns the [`Chord`]s as an iterator.
594
+ * @returns {KordChordsIterator}
595
+ */
596
+ iterator() {
597
+ const ret = wasm.kordchords_iterator(this.ptr);
598
+ return KordChordsIterator.__wrap(ret);
599
+ }
600
+ /**
601
+ * Returns the [`Chord`]s as an array.
602
+ * @returns {Array<any>}
603
+ */
604
+ toArray() {
605
+ const ret = wasm.kordchords_toArray(this.ptr);
606
+ return takeObject(ret);
607
+ }
608
+ }
609
+
610
+ const KordChordsIteratorFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordchordsiterator_free(ptr));
611
+ /**
612
+ * The [`Chord`]s iterator.
613
+ */
614
+ export class KordChordsIterator {
615
+
616
+ static __wrap(ptr) {
617
+ const obj = Object.create(KordChordsIterator.prototype);
618
+ obj.ptr = ptr;
619
+ KordChordsIteratorFinalization.register(obj, obj.ptr, obj);
620
+ return obj;
621
+ }
622
+
623
+ __destroy_into_raw() {
624
+ const ptr = this.ptr;
625
+ this.ptr = 0;
626
+ KordChordsIteratorFinalization.unregister(this);
627
+ return ptr;
628
+ }
629
+
630
+ free() {
631
+ const ptr = this.__destroy_into_raw();
632
+ wasm.__wbg_kordchordsiterator_free(ptr);
633
+ }
634
+ /**
635
+ * Gets the next item in the collection.
636
+ * @returns {any}
637
+ */
638
+ next() {
639
+ try {
640
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
641
+ wasm.kordchordsiterator_next(retptr, this.ptr);
642
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
643
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
644
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
645
+ if (r2) {
646
+ throw takeObject(r1);
647
+ }
648
+ return takeObject(r0);
649
+ } finally {
650
+ wasm.__wbindgen_add_to_stack_pointer(16);
651
+ }
652
+ }
576
653
  }
577
654
 
578
655
  const KordNoteFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnote_free(ptr));
@@ -627,12 +704,12 @@ export class KordNote {
627
704
  * @param {number} length_in_seconds
628
705
  * @returns {KordNotes}
629
706
  */
630
- static from_audio(data, length_in_seconds) {
707
+ static fromAudio(data, length_in_seconds) {
631
708
  try {
632
709
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
633
710
  const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
634
711
  const len0 = WASM_VECTOR_LEN;
635
- wasm.kordnote_from_audio(retptr, ptr0, len0, length_in_seconds);
712
+ wasm.kordnote_fromAudio(retptr, ptr0, len0, length_in_seconds);
636
713
  var r0 = getInt32Memory0()[retptr / 4 + 0];
637
714
  var r1 = getInt32Memory0()[retptr / 4 + 1];
638
715
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -650,12 +727,12 @@ export class KordNote {
650
727
  * @param {number} length_in_seconds
651
728
  * @returns {KordNotes}
652
729
  */
653
- static from_audio_ml(data, length_in_seconds) {
730
+ static fromAudioMl(data, length_in_seconds) {
654
731
  try {
655
732
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
656
733
  const ptr0 = passArrayF32ToWasm0(data, wasm.__wbindgen_malloc);
657
734
  const len0 = WASM_VECTOR_LEN;
658
- wasm.kordnote_from_audio_ml(retptr, ptr0, len0, length_in_seconds);
735
+ wasm.kordnote_fromAudioMl(retptr, ptr0, len0, length_in_seconds);
659
736
  var r0 = getInt32Memory0()[retptr / 4 + 0];
660
737
  var r1 = getInt32Memory0()[retptr / 4 + 1];
661
738
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -684,6 +761,22 @@ export class KordNote {
684
761
  }
685
762
  }
686
763
  /**
764
+ * Returns the [`Note`] represented as a string (same as `name`).
765
+ * @returns {string}
766
+ */
767
+ toString() {
768
+ try {
769
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
770
+ wasm.kordnote_toString(retptr, this.ptr);
771
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
772
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
773
+ return getStringFromWasm0(r0, r1);
774
+ } finally {
775
+ wasm.__wbindgen_add_to_stack_pointer(16);
776
+ wasm.__wbindgen_free(r0, r1);
777
+ }
778
+ }
779
+ /**
687
780
  * Returns the [`Note`]'s [`NamedPitch`].
688
781
  * @returns {string}
689
782
  */
@@ -762,10 +855,10 @@ export class KordNotes {
762
855
  * Returns the [`Note`]s as a space-separated string.
763
856
  * @returns {string}
764
857
  */
765
- to_string() {
858
+ toString() {
766
859
  try {
767
860
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
768
- wasm.kordnotes_to_string(retptr, this.ptr);
861
+ wasm.kordnotes_toString(retptr, this.ptr);
769
862
  var r0 = getInt32Memory0()[retptr / 4 + 0];
770
863
  var r1 = getInt32Memory0()[retptr / 4 + 1];
771
864
  return getStringFromWasm0(r0, r1);
@@ -774,6 +867,67 @@ export class KordNotes {
774
867
  wasm.__wbindgen_free(r0, r1);
775
868
  }
776
869
  }
870
+ /**
871
+ * Returns the [`Note`]s as an iterator.
872
+ * @returns {KordNotesIterator}
873
+ */
874
+ iterator() {
875
+ const ret = wasm.kordnotes_iterator(this.ptr);
876
+ return KordNotesIterator.__wrap(ret);
877
+ }
878
+ /**
879
+ * Returns the [`Note`]s as an array.
880
+ * @returns {Array<any>}
881
+ */
882
+ toArray() {
883
+ const ret = wasm.kordnotes_toArray(this.ptr);
884
+ return takeObject(ret);
885
+ }
886
+ }
887
+
888
+ const KordNotesIteratorFinalization = new FinalizationRegistry(ptr => wasm.__wbg_kordnotesiterator_free(ptr));
889
+ /**
890
+ * The [`Note`]s iterator.
891
+ */
892
+ export class KordNotesIterator {
893
+
894
+ static __wrap(ptr) {
895
+ const obj = Object.create(KordNotesIterator.prototype);
896
+ obj.ptr = ptr;
897
+ KordNotesIteratorFinalization.register(obj, obj.ptr, obj);
898
+ return obj;
899
+ }
900
+
901
+ __destroy_into_raw() {
902
+ const ptr = this.ptr;
903
+ this.ptr = 0;
904
+ KordNotesIteratorFinalization.unregister(this);
905
+ return ptr;
906
+ }
907
+
908
+ free() {
909
+ const ptr = this.__destroy_into_raw();
910
+ wasm.__wbg_kordnotesiterator_free(ptr);
911
+ }
912
+ /**
913
+ * Gets the next item in the collection.
914
+ * @returns {any}
915
+ */
916
+ next() {
917
+ try {
918
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
919
+ wasm.kordnotesiterator_next(retptr, this.ptr);
920
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
921
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
922
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
923
+ if (r2) {
924
+ throw takeObject(r1);
925
+ }
926
+ return takeObject(r0);
927
+ } finally {
928
+ wasm.__wbindgen_add_to_stack_pointer(16);
929
+ }
930
+ }
777
931
  }
778
932
 
779
933
  async function load(module, imports) {
@@ -810,9 +964,21 @@ async function load(module, imports) {
810
964
  function getImports() {
811
965
  const imports = {};
812
966
  imports.wbg = {};
967
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
968
+ const ret = getStringFromWasm0(arg0, arg1);
969
+ return addHeapObject(ret);
970
+ };
813
971
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
814
972
  takeObject(arg0);
815
973
  };
974
+ imports.wbg.__wbg_kordnote_new = function(arg0) {
975
+ const ret = KordNote.__wrap(arg0);
976
+ return addHeapObject(ret);
977
+ };
978
+ imports.wbg.__wbg_kordchord_new = function(arg0) {
979
+ const ret = KordChord.__wrap(arg0);
980
+ return addHeapObject(ret);
981
+ };
816
982
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
817
983
  const obj = takeObject(arg0).original;
818
984
  if (obj.cnt-- == 1) {
@@ -822,10 +988,6 @@ function getImports() {
822
988
  const ret = false;
823
989
  return ret;
824
990
  };
825
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
826
- const ret = getStringFromWasm0(arg0, arg1);
827
- return addHeapObject(ret);
828
- };
829
991
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
830
992
  const v = getObject(arg0);
831
993
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
@@ -893,6 +1055,10 @@ function getImports() {
893
1055
  imports.wbg.__wbg_copyToChannel_9babe9bf308bffc3 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
894
1056
  getObject(arg0).copyToChannel(getArrayF32FromWasm0(arg1, arg2), arg3);
895
1057
  }, arguments) };
1058
+ imports.wbg.__wbg_new_b525de17f44a8943 = function() {
1059
+ const ret = new Array();
1060
+ return addHeapObject(ret);
1061
+ };
896
1062
  imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
897
1063
  const ret = new Function(getStringFromWasm0(arg0, arg1));
898
1064
  return addHeapObject(ret);
@@ -933,10 +1099,22 @@ function getImports() {
933
1099
  const ret = eval(getStringFromWasm0(arg0, arg1));
934
1100
  return addHeapObject(ret);
935
1101
  }, arguments) };
1102
+ imports.wbg.__wbg_of_defbc28e6c20f48f = function(arg0, arg1) {
1103
+ const ret = Array.of(getObject(arg0), getObject(arg1));
1104
+ return addHeapObject(ret);
1105
+ };
1106
+ imports.wbg.__wbg_push_49c286f04dd3bf59 = function(arg0, arg1) {
1107
+ const ret = getObject(arg0).push(getObject(arg1));
1108
+ return ret;
1109
+ };
936
1110
  imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
937
1111
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
938
1112
  return addHeapObject(ret);
939
1113
  }, arguments) };
1114
+ imports.wbg.__wbg_fromEntries_47a432d7604fc06a = function() { return handleError(function (arg0) {
1115
+ const ret = Object.fromEntries(getObject(arg0));
1116
+ return addHeapObject(ret);
1117
+ }, arguments) };
940
1118
  imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function(arg0, arg1) {
941
1119
  try {
942
1120
  var state0 = {a: arg0, b: arg1};
@@ -944,7 +1122,7 @@ function getImports() {
944
1122
  const a = state0.a;
945
1123
  state0.a = 0;
946
1124
  try {
947
- return __wbg_adapter_91(a, state0.b, arg0, arg1);
1125
+ return __wbg_adapter_111(a, state0.b, arg0, arg1);
948
1126
  } finally {
949
1127
  state0.a = a;
950
1128
  }
@@ -977,11 +1155,11 @@ function getImports() {
977
1155
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
978
1156
  throw new Error(getStringFromWasm0(arg0, arg1));
979
1157
  };
980
- imports.wbg.__wbindgen_closure_wrapper1008 = function(arg0, arg1, arg2) {
1158
+ imports.wbg.__wbindgen_closure_wrapper1037 = function(arg0, arg1, arg2) {
981
1159
  const ret = makeMutClosure(arg0, arg1, 468, __wbg_adapter_20);
982
1160
  return addHeapObject(ret);
983
1161
  };
984
- imports.wbg.__wbindgen_closure_wrapper1308 = function(arg0, arg1, arg2) {
1162
+ imports.wbg.__wbindgen_closure_wrapper1337 = function(arg0, arg1, arg2) {
985
1163
  const ret = makeMutClosure(arg0, arg1, 588, __wbg_adapter_23);
986
1164
  return addHeapObject(ret);
987
1165
  };
package/klib_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Aaron Roney <twitchax@gmail.com>"
5
5
  ],
6
6
  "description": "A tool to easily explore music theory principles.",
7
- "version": "0.5.4",
7
+ "version": "0.5.5",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",