spessasynth_core 4.3.1 → 4.3.3

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
@@ -2952,10 +2952,12 @@ declare abstract class WavetableOscillator {
2952
2952
  playbackStep: number;
2953
2953
  /**
2954
2954
  * Start position of the loop.
2955
+ * Inclusive.
2955
2956
  */
2956
2957
  loopStart: number;
2957
2958
  /**
2958
2959
  * End position of the loop.
2960
+ * Exclusive.
2959
2961
  */
2960
2962
  loopEnd: number;
2961
2963
  /**
@@ -2965,6 +2967,7 @@ declare abstract class WavetableOscillator {
2965
2967
  loopLength: number;
2966
2968
  /**
2967
2969
  * End position of the sample.
2970
+ * Exclusive
2968
2971
  */
2969
2972
  end: number;
2970
2973
  /**
package/dist/index.js CHANGED
@@ -7150,10 +7150,12 @@ var WavetableOscillator = class {
7150
7150
  playbackStep = 0;
7151
7151
  /**
7152
7152
  * Start position of the loop.
7153
+ * Inclusive.
7153
7154
  */
7154
7155
  loopStart = 0;
7155
7156
  /**
7156
7157
  * End position of the loop.
7158
+ * Exclusive.
7157
7159
  */
7158
7160
  loopEnd = 0;
7159
7161
  /**
@@ -7163,6 +7165,7 @@ var WavetableOscillator = class {
7163
7165
  loopLength = 0;
7164
7166
  /**
7165
7167
  * End position of the sample.
7168
+ * Exclusive
7166
7169
  */
7167
7170
  end = 0;
7168
7171
  /**
@@ -7174,10 +7177,10 @@ var LinearOscillator = class extends WavetableOscillator {
7174
7177
  process(sampleCount, tuningRatio, outputBuffer) {
7175
7178
  const step = tuningRatio * this.playbackStep;
7176
7179
  const data = this.sampleData;
7177
- const { loopEnd, loopLength, loopStart, end } = this;
7180
+ const { loopEnd, loopLength, end } = this;
7178
7181
  let cursor = this.cursor;
7179
7182
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7180
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7183
+ while (cursor >= loopEnd) cursor -= loopLength;
7181
7184
  const floor = cursor | 0;
7182
7185
  let ceil = floor + 1;
7183
7186
  if (ceil >= loopEnd) ceil -= loopLength;
@@ -7208,10 +7211,10 @@ var NearestOscillator = class extends WavetableOscillator {
7208
7211
  process(sampleCount, tuningRatio, outputBuffer) {
7209
7212
  const step = tuningRatio * this.playbackStep;
7210
7213
  const sampleData = this.sampleData;
7211
- const { loopLength, loopStart, end } = this;
7214
+ const { loopEnd, loopLength, end } = this;
7212
7215
  let cursor = this.cursor;
7213
7216
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7214
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7217
+ while (cursor >= loopEnd) cursor -= loopLength;
7215
7218
  outputBuffer[i] = sampleData[cursor | 0];
7216
7219
  cursor += step;
7217
7220
  }
@@ -7231,10 +7234,10 @@ var HermiteOscillator = class extends WavetableOscillator {
7231
7234
  process(sampleCount, tuningRatio, outputBuffer) {
7232
7235
  const step = tuningRatio * this.playbackStep;
7233
7236
  const sampleData = this.sampleData;
7234
- const { loopEnd, loopLength, loopStart, end } = this;
7237
+ const { loopEnd, loopLength, end } = this;
7235
7238
  let cursor = this.cursor;
7236
7239
  if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
7237
- if (cursor > loopStart) cursor = loopStart + (cursor - loopStart) % loopLength;
7240
+ while (cursor >= loopEnd) cursor -= loopLength;
7238
7241
  const y0 = cursor | 0;
7239
7242
  let y1 = y0 + 1;
7240
7243
  let y2 = y0 + 2;
@@ -12677,11 +12680,11 @@ function noteOn(midiNote, velocity) {
12677
12680
  const endOffset = voice.modulatedGenerators[GeneratorTypes.endAddrOffset] + voice.modulatedGenerators[GeneratorTypes.endAddrsCoarseOffset] * 32768;
12678
12681
  const loopStartOffset = voice.modulatedGenerators[GeneratorTypes.startloopAddrsOffset] + voice.modulatedGenerators[GeneratorTypes.startloopAddrsCoarseOffset] * 32768;
12679
12682
  const loopEndOffset = voice.modulatedGenerators[GeneratorTypes.endloopAddrsOffset] + voice.modulatedGenerators[GeneratorTypes.endloopAddrsCoarseOffset] * 32768;
12680
- const lastSample = cached.sampleData.length - 1;
12681
- voice.wavetable.cursor = clamp(cursorStartOffset, 0, lastSample);
12682
- voice.wavetable.end = clamp(lastSample + endOffset, 0, lastSample);
12683
- voice.wavetable.loopStart = clamp(cached.loopStart + loopStartOffset, 0, lastSample);
12684
- voice.wavetable.loopEnd = clamp(cached.loopEnd + loopEndOffset, 0, lastSample);
12683
+ const endExclusive = cached.sampleData.length;
12684
+ voice.wavetable.cursor = clamp(cursorStartOffset, 0, endExclusive - 1);
12685
+ voice.wavetable.end = clamp(endExclusive + endOffset, 0, endExclusive);
12686
+ voice.wavetable.loopStart = clamp(cached.loopStart + loopStartOffset, 0, endExclusive);
12687
+ voice.wavetable.loopEnd = clamp(cached.loopEnd + loopEndOffset, 0, endExclusive);
12685
12688
  if (voice.wavetable.loopEnd < voice.wavetable.loopStart) {
12686
12689
  const temp = voice.wavetable.loopStart;
12687
12690
  voice.wavetable.loopStart = voice.wavetable.loopEnd;
@@ -13042,6 +13045,8 @@ function applySnapshot(snapshot) {
13042
13045
  this.perNotePitch = snapshot.perNotePitch;
13043
13046
  this.generators.offsets.set(snapshot.generators.offsets);
13044
13047
  this.generators.overrides.set(snapshot.generators.overrides);
13048
+ this.generators.offsetsEnabled = snapshot.generators.offsetsEnabled;
13049
+ this.generators.overridesEnabled = snapshot.generators.overridesEnabled;
13045
13050
  for (let i = 0; i < 128; i++) this.drumParams[i] = DrumParameters.copyFrom(snapshot.drumParams[i]);
13046
13051
  this.setSystemParameter("presetLock", false);
13047
13052
  if (snapshot.patch) this.setPatch(snapshot.patch);
@@ -19811,10 +19816,10 @@ var SynthesizerCore = class {
19811
19816
  this.insertionActive = false;
19812
19817
  this.insertionProcessor = this.insertionFallback;
19813
19818
  this.insertionProcessor.reset();
19819
+ this.resetInsertionParams();
19814
19820
  this.insertionProcessor.sendLevelToReverb = 40 / 127 * EFX_SENDS_GAIN_CORRECTION;
19815
19821
  this.insertionProcessor.sendLevelToChorus = 0;
19816
19822
  this.insertionProcessor.sendLevelToDelay = 0;
19817
- this.resetInsertionParams();
19818
19823
  this.callEvent("effectChange", {
19819
19824
  effect: "insertion",
19820
19825
  parameter: 0,