spessasynth_lib 3.10.0 → 3.11.0

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.
@@ -24,7 +24,8 @@ export function programChange(channel, programNumber, userChange=false)
24
24
  return;
25
25
  }
26
26
  // always 128 for percussion
27
- const bank = channelObject.drumChannel ? 128 : channelObject.midiControllers[midiControllers.bankSelect] - this.soundfontBankOffset;
27
+ const bankWithOffset = Math.max(0, channelObject.midiControllers[midiControllers.bankSelect] - this.soundfontBankOffset);
28
+ const bank = channelObject.drumChannel ? 128 : bankWithOffset;
28
29
  const preset = this.soundfont.getPreset(bank, programNumber);
29
30
  this.setPreset(channel, preset);
30
31
  this.callEvent("programchange",{
@@ -68,6 +69,10 @@ export function setDrums(channel, isDrum)
68
69
  {
69
70
  return;
70
71
  }
72
+ if(channelObject.drumChannel === isDrum)
73
+ {
74
+ return;
75
+ }
71
76
  if(isDrum)
72
77
  {
73
78
  // clear transpose
@@ -128,7 +133,8 @@ export function reloadSoundFont(buffer)
128
133
  {
129
134
  const channelObject = this.workletProcessorChannels[i];
130
135
  channelObject.cachedVoices = [];
131
- for (let j = 0; j < 128; j++) {
136
+ for (let j = 0; j < 128; j++)
137
+ {
132
138
  channelObject.cachedVoices.push([]);
133
139
  }
134
140
  channelObject.lockPreset = false;
@@ -318,7 +318,7 @@ export function systemExclusive(messageData, channelOffset = 0)
318
318
  return;
319
319
  }
320
320
  const channel = messageData[4] + channelOffset;
321
- const value = messageData[6]
321
+ const value = messageData[6];
322
322
  switch (messageData[5])
323
323
  {
324
324
  // bank select