spessasynth_lib 3.12.2 → 3.12.3

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.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @param mid {MIDI}
3
3
  * @param soundfont {SoundFont2}
4
+ * @returns {Object<string, Set<string>>}
4
5
  */
5
6
  export function getUsedProgramsAndKeys(mid: MIDI, soundfont: SoundFont2): {
6
7
  [x: string]: Set<string>;
@@ -15,6 +15,7 @@
15
15
  *
16
16
  * @property {Preset} preset - the channel's preset
17
17
  * @property {boolean} lockPreset - indicates whether the program on the channel is locked
18
+ * @property {boolean} presetUsesOverride - indcates if the channel uses a preset from the override soundfont.
18
19
  *
19
20
  * @property {boolean} lockVibrato - indicates whether the custom vibrato is locked
20
21
  * @property {Object} channelVibrato - vibrato settings for the channel
@@ -103,6 +104,10 @@ export type WorkletProcessorChannel = {
103
104
  * - indicates whether the program on the channel is locked
104
105
  */
105
106
  lockPreset: boolean;
107
+ /**
108
+ * - indcates if the channel uses a preset from the override soundfont.
109
+ */
110
+ presetUsesOverride: boolean;
106
111
  /**
107
112
  * - indicates whether the custom vibrato is locked
108
113
  */
@@ -6,6 +6,7 @@ import { messageTypes, midiControllers } from './midi_message.js'
6
6
  /**
7
7
  * @param mid {MIDI}
8
8
  * @param soundfont {SoundFont2}
9
+ * @returns {Object<string, Set<string>>}
9
10
  */
10
11
  export function getUsedProgramsAndKeys(mid, soundfont)
11
12
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.12.2",
3
+ "version": "3.12.3",
4
4
  "description": "No compromise MIDI and SoundFont2 Synthesizer library",
5
5
  "browser": "index.js",
6
6
  "types": "@types/index.d.ts",
@@ -57,14 +57,19 @@ export function loadNewSequence(parsedMidi)
57
57
  if(this.midiData.embeddedSoundFont !== undefined)
58
58
  {
59
59
  SpessaSynthInfo("%cEmbedded soundfont detected! Using it.", consoleColors.recognized);
60
- this.synth.reloadSoundFont(this.midiData.embeddedSoundFont);
61
60
  // set offet
62
61
  this.synth.soundfontBankOffset = this.midiData.bankOffset;
62
+ this.synth.reloadSoundFont(this.midiData.embeddedSoundFont, true);
63
63
  // preload all samples
64
- this.synth.soundfont.samples.forEach(s => s.getAudioData());
64
+ this.synth.overrideSoundfont.samples.forEach(s => s.getAudioData());
65
65
  }
66
66
  else
67
67
  {
68
+ if(this.synth.overrideSoundfont)
69
+ {
70
+ // clean up the emdeeded soundfont
71
+ this.synth.clearSoundFont();
72
+ }
68
73
  SpessaSynthGroupCollapsed("%cPreloading samples...", consoleColors.info);
69
74
  // smart preloading: load only samples used in the midi!
70
75
  const used = getUsedProgramsAndKeys(this.midiData, this.synth.soundfont);
@@ -72,7 +77,7 @@ export function loadNewSequence(parsedMidi)
72
77
  {
73
78
  const bank = parseInt(programBank.split(":")[0]);
74
79
  const program = parseInt(programBank.split(":")[1]);
75
- const preset = this.synth.soundfont.getPreset(bank, program);
80
+ const preset = this.synth.getPreset(bank, program);
76
81
  SpessaSynthInfo(`%cPreloading used samples on %c${preset.presetName}%c...`,
77
82
  consoleColors.info,
78
83
  consoleColors.recognized,