spessasynth_lib 4.2.3 → 4.2.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/dist/index.d.ts CHANGED
@@ -254,6 +254,7 @@ declare abstract class BasicSynthesizerCore {
254
254
  * @protected
255
255
  */
256
256
  protected alive: boolean;
257
+ protected readonly enableEventSystem: boolean;
257
258
  protected constructor(sampleRate: number, options: Omit<SynthProcessorOptions, "reverbProcessor" | "chorusProcessor" | "delayProcessor">, postMessage: PostMessageSynthCore);
258
259
  protected createNewSequencer(): void;
259
260
  protected postReady<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K], transferable?: Transferable[]): void;
package/dist/index.js CHANGED
@@ -994,7 +994,7 @@ var BasicSynthesizer = class {
994
994
  break;
995
995
  }
996
996
  case "sequencerReturn": {
997
- this.sequencers[m.data.id](m.data);
997
+ this.sequencers[m.data.id]?.(m.data);
998
998
  break;
999
999
  }
1000
1000
  case "isFullyInitialized": {
@@ -1681,8 +1681,10 @@ var BasicSynthesizerCore = class {
1681
1681
  * @protected
1682
1682
  */
1683
1683
  alive = false;
1684
+ enableEventSystem;
1684
1685
  constructor(sampleRate, options, postMessage) {
1685
1686
  this.synthesizer = new SpessaSynthProcessor2(sampleRate, options);
1687
+ this.enableEventSystem = options.enableEventSystem;
1686
1688
  this.post = postMessage;
1687
1689
  this.synthesizer.onEventCall = (event) => {
1688
1690
  this.post({
@@ -1697,6 +1699,7 @@ var BasicSynthesizerCore = class {
1697
1699
  const sequencerID = this.sequencers.length;
1698
1700
  this.sequencers.push(sequencer);
1699
1701
  sequencer.onEventCall = (e) => {
1702
+ if (!this.enableEventSystem) return;
1700
1703
  if (e.type === "songListChange") {
1701
1704
  const songs = e.data.newSongList;
1702
1705
  const midiDatas = songs.map((s) => {
@@ -2293,7 +2296,7 @@ var WorkerSynthesizerCore = class extends BasicSynthesizerCore {
2293
2296
  this.synthesizer.processSplit(dry, wetL, wetR);
2294
2297
  this.workletMessagePort.postMessage(data, [data.buffer]);
2295
2298
  const t = this.synthesizer.currentSynthTime;
2296
- if (t - this.lastSequencerSync > SEQUENCER_SYNC_INTERVAL) {
2299
+ if (this.enableEventSystem && t - this.lastSequencerSync > SEQUENCER_SYNC_INTERVAL) {
2297
2300
  for (let id = 0; id < this.sequencers.length; id++) {
2298
2301
  this.post({
2299
2302
  type: "sequencerReturn",