spessasynth_core 4.3.4 → 4.3.5

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.js CHANGED
@@ -4490,20 +4490,31 @@ function processEventInternal(event, trackIndex) {
4490
4490
  channel += offset;
4491
4491
  switch (status) {
4492
4492
  case MIDIMessageTypes.noteOn: {
4493
+ let playingNotes = this.playingNotes[channel];
4494
+ if (!playingNotes) {
4495
+ while (this.playingNotes.length <= channel) this.playingNotes.push(/* @__PURE__ */ new Map());
4496
+ playingNotes = this.playingNotes[channel];
4497
+ }
4493
4498
  const velocity = event.data[1];
4494
4499
  if (velocity > 0) {
4495
4500
  this.synth.noteOn(channel, event.data[0], velocity);
4496
- this.playingNotes[channel].set(event.data[0], velocity);
4501
+ playingNotes.set(event.data[0], velocity);
4497
4502
  } else {
4498
4503
  this.synth.noteOff(channel, event.data[0]);
4499
- this.playingNotes[channel].delete(event.data[0]);
4504
+ playingNotes.delete(event.data[0]);
4500
4505
  }
4501
4506
  break;
4502
4507
  }
4503
- case MIDIMessageTypes.noteOff:
4508
+ case MIDIMessageTypes.noteOff: {
4509
+ let playingNotes = this.playingNotes[channel];
4510
+ if (!playingNotes) {
4511
+ while (this.playingNotes.length <= channel) this.playingNotes.push(/* @__PURE__ */ new Map());
4512
+ playingNotes = this.playingNotes[channel];
4513
+ }
4504
4514
  this.synth.noteOff(channel, event.data[0]);
4505
- this.playingNotes[channel].delete(event.data[0]);
4515
+ playingNotes.delete(event.data[0]);
4506
4516
  break;
4517
+ }
4507
4518
  case MIDIMessageTypes.pitchWheel:
4508
4519
  this.synth.pitchWheel(channel, event.data[1] << 7 | event.data[0]);
4509
4520
  break;
@@ -5041,7 +5052,7 @@ var SpessaSynthSequencer = class {
5041
5052
  constructor(spessasynthProcessor) {
5042
5053
  this.synth = spessasynthProcessor;
5043
5054
  this.absoluteStartTime = this.synth.currentTime;
5044
- for (let i = 0; i < 16; i++) this.playingNotes.push(/* @__PURE__ */ new Map());
5055
+ this.playingNotes = this.synth.midiChannels.map(() => /* @__PURE__ */ new Map());
5045
5056
  }
5046
5057
  _midiData;
5047
5058
  /**
@@ -20467,7 +20478,6 @@ var SpessaSynthProcessor = class {
20467
20478
  applySnapshot(snapshot) {
20468
20479
  this.savedSnapshot = snapshot;
20469
20480
  applySnapshot$1.call(this.synthCore, snapshot);
20470
- this.reset();
20471
20481
  }
20472
20482
  /**
20473
20483
  * Gets a synthesizer snapshot from this processor instance.