spessasynth_lib 3.26.13 → 3.26.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.26.13",
3
+ "version": "3.26.15",
4
4
  "description": "MIDI and SoundFont2/DLS library for the browsers with no compromises",
5
5
  "browser": "index.js",
6
6
  "type": "module",
@@ -39,7 +39,7 @@ import { DEFAULT_SEQUENCER_OPTIONS } from "./default_sequencer_options.js";
39
39
  * @typedef {Object} SequencerOptions
40
40
  * @property {boolean|undefined} skipToFirstNoteOn - if true, the sequencer will skip to the first note
41
41
  * @property {boolean|undefined} autoPlay - if true, the sequencer will automatically start playing the MIDI
42
- * @property {boolean|unescape} preservePlaybackState - if true,
42
+ * @property {boolean|undefined} preservePlaybackState - if true,
43
43
  * the sequencer will stay paused when seeking or changing the playback rate
44
44
  * @property {number|undefined} initialPlaybackRate - the initial playback rate, defaults to 1.0 (normal speed)
45
45
  */
@@ -55,16 +55,19 @@ export class SoundfontManager
55
55
  */
56
56
  async addNewSoundFont(soundfontBuffer, id, bankOffset = 0)
57
57
  {
58
+ this._sendToWorklet(WorkletSoundfontManagerMessageType.addNewSoundFont, [soundfontBuffer, id, bankOffset]);
59
+ await new Promise(r => this.synth._resolveWhenReady = r);
58
60
  if (this.soundfontList.find(s => s.id === id) !== undefined)
59
61
  {
60
- throw new Error("Cannot overwrite the existing soundfont. Use soundfontManager.delete(id) instead.");
62
+ this.soundfontList.find(s => s.id === id).bankOffset = bankOffset;
63
+ }
64
+ else
65
+ {
66
+ this.soundfontList.push({
67
+ id: id,
68
+ bankOffset: bankOffset
69
+ });
61
70
  }
62
- this._sendToWorklet(WorkletSoundfontManagerMessageType.addNewSoundFont, [soundfontBuffer, id, bankOffset]);
63
- await new Promise(r => this.synth._resolveWhenReady = r);
64
- this.soundfontList.push({
65
- id: id,
66
- bankOffset: bankOffset
67
- });
68
71
  }
69
72
 
70
73
  // noinspection JSUnusedGlobalSymbols