spessasynth_core 3.26.3 → 3.26.4

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_core",
3
- "version": "3.26.3",
3
+ "version": "3.26.4",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -264,11 +264,20 @@ export function _playTo(time, ticks = undefined)
264
264
  });
265
265
  }
266
266
  // restore programs
267
- if (programs[channelNumber].program >= 0 && programs[channelNumber].actualBank >= 0)
267
+ if (programs[channelNumber].actualBank >= 0)
268
268
  {
269
- const bank = programs[channelNumber].actualBank;
270
- this.synth.controllerChange(channelNumber, midiControllers.bankSelect, bank);
271
- this.synth.programChange(channelNumber, programs[channelNumber].program);
269
+ const p = programs[channelNumber];
270
+ if (p.program !== -1)
271
+ {
272
+ // a program change has occurred, apply the actual bank when program change was executed
273
+ this.synth.controllerChange(channelNumber, midiControllers.bankSelect, p.actualBank);
274
+ this.synth.programChange(channelNumber, p.program);
275
+ }
276
+ else
277
+ {
278
+ // no program change, apply the current bank select
279
+ this.synth.controllerChange(channelNumber, midiControllers.bankSelect, p.bank);
280
+ }
272
281
  }
273
282
  }
274
283
  }
@@ -79,6 +79,11 @@ export class BasicPreset
79
79
  }
80
80
  }
81
81
 
82
+ clearCache()
83
+ {
84
+ this.foundSamplesAndGenerators = [];
85
+ }
86
+
82
87
  /**
83
88
  * @param allowXG {boolean}
84
89
  * @param allowSFX {boolean}
@@ -557,6 +557,15 @@ class BasicSoundBank
557
557
  delete this.instruments;
558
558
  delete this.samples;
559
559
  }
560
+
561
+ // noinspection JSUnusedGlobalSymbols
562
+ /**
563
+ * Clears the cache for all the presets
564
+ */
565
+ clearCache()
566
+ {
567
+ this.presets.forEach(p => p.clearCache());
568
+ }
560
569
  }
561
570
 
562
571
  BasicSoundBank.prototype.write = write;