spessasynth_core 4.3.2 → 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 +3 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2952,11 +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.
|
|
2959
|
-
*
|
|
2960
|
+
* Exclusive.
|
|
2960
2961
|
*/
|
|
2961
2962
|
loopEnd: number;
|
|
2962
2963
|
/**
|
|
@@ -2966,6 +2967,7 @@ declare abstract class WavetableOscillator {
|
|
|
2966
2967
|
loopLength: number;
|
|
2967
2968
|
/**
|
|
2968
2969
|
* End position of the sample.
|
|
2970
|
+
* Exclusive
|
|
2969
2971
|
*/
|
|
2970
2972
|
end: number;
|
|
2971
2973
|
/**
|
package/dist/index.js
CHANGED
|
@@ -7150,11 +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.
|
|
7157
|
-
*
|
|
7158
|
+
* Exclusive.
|
|
7158
7159
|
*/
|
|
7159
7160
|
loopEnd = 0;
|
|
7160
7161
|
/**
|
|
@@ -7164,6 +7165,7 @@ var WavetableOscillator = class {
|
|
|
7164
7165
|
loopLength = 0;
|
|
7165
7166
|
/**
|
|
7166
7167
|
* End position of the sample.
|
|
7168
|
+
* Exclusive
|
|
7167
7169
|
*/
|
|
7168
7170
|
end = 0;
|
|
7169
7171
|
/**
|
|
@@ -7178,10 +7180,10 @@ var LinearOscillator = class extends WavetableOscillator {
|
|
|
7178
7180
|
const { loopEnd, loopLength, end } = this;
|
|
7179
7181
|
let cursor = this.cursor;
|
|
7180
7182
|
if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
|
|
7181
|
-
|
|
7183
|
+
while (cursor >= loopEnd) cursor -= loopLength;
|
|
7182
7184
|
const floor = cursor | 0;
|
|
7183
7185
|
let ceil = floor + 1;
|
|
7184
|
-
if (ceil
|
|
7186
|
+
if (ceil >= loopEnd) ceil -= loopLength;
|
|
7185
7187
|
const fraction = cursor - floor;
|
|
7186
7188
|
const upper = data[ceil];
|
|
7187
7189
|
const lower = data[floor];
|
|
@@ -7212,7 +7214,7 @@ var NearestOscillator = class extends WavetableOscillator {
|
|
|
7212
7214
|
const { loopEnd, loopLength, end } = this;
|
|
7213
7215
|
let cursor = this.cursor;
|
|
7214
7216
|
if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
|
|
7215
|
-
|
|
7217
|
+
while (cursor >= loopEnd) cursor -= loopLength;
|
|
7216
7218
|
outputBuffer[i] = sampleData[cursor | 0];
|
|
7217
7219
|
cursor += step;
|
|
7218
7220
|
}
|
|
@@ -7235,15 +7237,15 @@ var HermiteOscillator = class extends WavetableOscillator {
|
|
|
7235
7237
|
const { loopEnd, loopLength, end } = this;
|
|
7236
7238
|
let cursor = this.cursor;
|
|
7237
7239
|
if (this.isLooping) for (let i = 0; i < sampleCount; i++) {
|
|
7238
|
-
|
|
7240
|
+
while (cursor >= loopEnd) cursor -= loopLength;
|
|
7239
7241
|
const y0 = cursor | 0;
|
|
7240
7242
|
let y1 = y0 + 1;
|
|
7241
7243
|
let y2 = y0 + 2;
|
|
7242
7244
|
let y3 = y0 + 3;
|
|
7243
7245
|
const t = cursor - y0;
|
|
7244
|
-
if (y1
|
|
7245
|
-
if (y2
|
|
7246
|
-
if (y3
|
|
7246
|
+
if (y1 >= loopEnd) y1 -= loopLength;
|
|
7247
|
+
if (y2 >= loopEnd) y2 -= loopLength;
|
|
7248
|
+
if (y3 >= loopEnd) y3 -= loopLength;
|
|
7247
7249
|
const xm1 = sampleData[y0];
|
|
7248
7250
|
const x0 = sampleData[y1];
|
|
7249
7251
|
const x1 = sampleData[y2];
|
|
@@ -12678,18 +12680,18 @@ function noteOn(midiNote, velocity) {
|
|
|
12678
12680
|
const endOffset = voice.modulatedGenerators[GeneratorTypes.endAddrOffset] + voice.modulatedGenerators[GeneratorTypes.endAddrsCoarseOffset] * 32768;
|
|
12679
12681
|
const loopStartOffset = voice.modulatedGenerators[GeneratorTypes.startloopAddrsOffset] + voice.modulatedGenerators[GeneratorTypes.startloopAddrsCoarseOffset] * 32768;
|
|
12680
12682
|
const loopEndOffset = voice.modulatedGenerators[GeneratorTypes.endloopAddrsOffset] + voice.modulatedGenerators[GeneratorTypes.endloopAddrsCoarseOffset] * 32768;
|
|
12681
|
-
const
|
|
12682
|
-
voice.wavetable.cursor = clamp(cursorStartOffset, 0,
|
|
12683
|
-
voice.wavetable.end = clamp(
|
|
12684
|
-
voice.wavetable.loopStart = clamp(cached.loopStart + loopStartOffset, 0,
|
|
12685
|
-
voice.wavetable.loopEnd = clamp(cached.loopEnd + loopEndOffset, 0,
|
|
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);
|
|
12686
12688
|
if (voice.wavetable.loopEnd < voice.wavetable.loopStart) {
|
|
12687
12689
|
const temp = voice.wavetable.loopStart;
|
|
12688
12690
|
voice.wavetable.loopStart = voice.wavetable.loopEnd;
|
|
12689
12691
|
voice.wavetable.loopEnd = temp;
|
|
12690
12692
|
}
|
|
12691
12693
|
if (voice.wavetable.loopEnd - voice.wavetable.loopStart < 1 && (voice.loopingMode === 1 || voice.loopingMode === 3)) voice.loopingMode = 0;
|
|
12692
|
-
voice.wavetable.loopLength = voice.wavetable.loopEnd - voice.wavetable.loopStart
|
|
12694
|
+
voice.wavetable.loopLength = voice.wavetable.loopEnd - voice.wavetable.loopStart;
|
|
12693
12695
|
voice.wavetable.isLooping = voice.loopingMode === 1 || voice.loopingMode === 3;
|
|
12694
12696
|
voice.portamentoFromKey = portaFromKey;
|
|
12695
12697
|
voice.portamentoDuration = portaTime;
|