spessasynth_core 4.3.1 → 4.3.2

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
@@ -2956,6 +2956,7 @@ declare abstract class WavetableOscillator {
2956
2956
  loopStart: number;
2957
2957
  /**
2958
2958
  * End position of the loop.
2959
+ * INCLUSIVE!!
2959
2960
  */
2960
2961
  loopEnd: number;
2961
2962
  /**
package/dist/index.js CHANGED
@@ -7154,6 +7154,7 @@ var WavetableOscillator = class {
7154
7154
  loopStart = 0;
7155
7155
  /**
7156
7156
  * End position of the loop.
7157
+ * INCLUSIVE!!
7157
7158
  */
7158
7159
  loopEnd = 0;
7159
7160
  /**
@@ -7174,13 +7175,13 @@ var LinearOscillator = class extends WavetableOscillator {
7174
7175
  process(sampleCount, tuningRatio, outputBuffer) {
7175
7176
  const step = tuningRatio * this.playbackStep;
7176
7177
  const data = this.sampleData;
7177
- const { loopEnd, loopLength, loopStart, end } = this;
7178
+ const { loopEnd, loopLength, end } = this;
7178
7179
  let cursor = this.cursor;
7179
7180
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7180
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7181
+ if (cursor > loopEnd) cursor -= loopLength;
7181
7182
  const floor = cursor | 0;
7182
7183
  let ceil = floor + 1;
7183
- if (ceil >= loopEnd) ceil -= loopLength;
7184
+ if (ceil > loopEnd) ceil -= loopLength;
7184
7185
  const fraction = cursor - floor;
7185
7186
  const upper = data[ceil];
7186
7187
  const lower = data[floor];
@@ -7208,10 +7209,10 @@ var NearestOscillator = class extends WavetableOscillator {
7208
7209
  process(sampleCount, tuningRatio, outputBuffer) {
7209
7210
  const step = tuningRatio * this.playbackStep;
7210
7211
  const sampleData = this.sampleData;
7211
- const { loopLength, loopStart, end } = this;
7212
+ const { loopEnd, loopLength, end } = this;
7212
7213
  let cursor = this.cursor;
7213
7214
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7214
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7215
+ if (cursor > loopEnd) cursor -= loopLength;
7215
7216
  outputBuffer[i] = sampleData[cursor | 0];
7216
7217
  cursor += step;
7217
7218
  }
@@ -7231,18 +7232,18 @@ var HermiteOscillator = class extends WavetableOscillator {
7231
7232
  process(sampleCount, tuningRatio, outputBuffer) {
7232
7233
  const step = tuningRatio * this.playbackStep;
7233
7234
  const sampleData = this.sampleData;
7234
- const { loopEnd, loopLength, loopStart, end } = this;
7235
+ const { loopEnd, loopLength, end } = this;
7235
7236
  let cursor = this.cursor;
7236
7237
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7237
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7238
+ if (cursor > loopEnd) cursor -= loopLength;
7238
7239
  const y0 = cursor | 0;
7239
7240
  let y1 = y0 + 1;
7240
7241
  let y2 = y0 + 2;
7241
7242
  let y3 = y0 + 3;
7242
7243
  const t = cursor - y0;
7243
- if (y1 >= loopEnd) y1 -= loopLength;
7244
- if (y2 >= loopEnd) y2 -= loopLength;
7245
- if (y3 >= loopEnd) y3 -= loopLength;
7244
+ if (y1 > loopEnd) y1 -= loopLength;
7245
+ if (y2 > loopEnd) y2 -= loopLength;
7246
+ if (y3 > loopEnd) y3 -= loopLength;
7246
7247
  const xm1 = sampleData[y0];
7247
7248
  const x0 = sampleData[y1];
7248
7249
  const x1 = sampleData[y2];
@@ -12688,7 +12689,7 @@ function noteOn(midiNote, velocity) {
12688
12689
  voice.wavetable.loopEnd = temp;
12689
12690
  }
12690
12691
  if (voice.wavetable.loopEnd - voice.wavetable.loopStart < 1 && (voice.loopingMode === 1 || voice.loopingMode === 3)) voice.loopingMode = 0;
12691
- voice.wavetable.loopLength = voice.wavetable.loopEnd - voice.wavetable.loopStart;
12692
+ voice.wavetable.loopLength = voice.wavetable.loopEnd - voice.wavetable.loopStart + 1;
12692
12693
  voice.wavetable.isLooping = voice.loopingMode === 1 || voice.loopingMode === 3;
12693
12694
  voice.portamentoFromKey = portaFromKey;
12694
12695
  voice.portamentoDuration = portaTime;
@@ -13042,6 +13043,8 @@ function applySnapshot(snapshot) {
13042
13043
  this.perNotePitch = snapshot.perNotePitch;
13043
13044
  this.generators.offsets.set(snapshot.generators.offsets);
13044
13045
  this.generators.overrides.set(snapshot.generators.overrides);
13046
+ this.generators.offsetsEnabled = snapshot.generators.offsetsEnabled;
13047
+ this.generators.overridesEnabled = snapshot.generators.overridesEnabled;
13045
13048
  for (let i = 0; i < 128; i++) this.drumParams[i] = DrumParameters.copyFrom(snapshot.drumParams[i]);
13046
13049
  this.setSystemParameter("presetLock", false);
13047
13050
  if (snapshot.patch) this.setPatch(snapshot.patch);
@@ -19811,10 +19814,10 @@ var SynthesizerCore = class {
19811
19814
  this.insertionActive = false;
19812
19815
  this.insertionProcessor = this.insertionFallback;
19813
19816
  this.insertionProcessor.reset();
19817
+ this.resetInsertionParams();
19814
19818
  this.insertionProcessor.sendLevelToReverb = 40 / 127 * EFX_SENDS_GAIN_CORRECTION;
19815
19819
  this.insertionProcessor.sendLevelToChorus = 0;
19816
19820
  this.insertionProcessor.sendLevelToDelay = 0;
19817
- this.resetInsertionParams();
19818
19821
  this.callEvent("effectChange", {
19819
19822
  effect: "insertion",
19820
19823
  parameter: 0,