spessasynth_lib 3.20.40 → 3.20.41

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.
@@ -57,6 +57,10 @@ export function getSampleLinear(voice, outputBuffer)
57
57
  }
58
58
  else
59
59
  {
60
+ if(sample.loopingMode === 2 && !voice.isInRelease)
61
+ {
62
+ return;
63
+ }
60
64
  for (let i = 0; i < outputBuffer.length; i++)
61
65
  {
62
66
 
@@ -119,6 +123,10 @@ export function getSampleNearest(voice, outputBuffer)
119
123
  }
120
124
  else
121
125
  {
126
+ if(sample.loopingMode === 2 && !voice.isInRelease)
127
+ {
128
+ return;
129
+ }
122
130
  for (let i = 0; i < outputBuffer.length; i++)
123
131
  {
124
132
 
@@ -198,6 +206,10 @@ export function getSampleCubic(voice, outputBuffer)
198
206
  }
199
207
  else
200
208
  {
209
+ if(sample.loopingMode === 2 && !voice.isInRelease)
210
+ {
211
+ return;
212
+ }
201
213
  for (let i = 0; i < outputBuffer.length; i++)
202
214
  {
203
215
 
@@ -87,8 +87,9 @@ class WorkletSample
87
87
  * Looping mode of the sample:
88
88
  * 0 - no loop
89
89
  * 1 - loop
90
- * 2 - loop then play when released
91
- * @type {0|1|2}
90
+ * 2 - UNOFFICIAL: polyphone 2.4 added start on release
91
+ * 3 - loop then play when released
92
+ * @type {0|1|2|3}
92
93
  */
93
94
  loopingMode = 0;
94
95
 
@@ -372,15 +373,6 @@ export function getWorkletVoices(channel,
372
373
  let loopStart = (sampleAndGenerators.sample.sampleLoopStartIndex / 2);
373
374
  let loopEnd = (sampleAndGenerators.sample.sampleLoopEndIndex / 2);
374
375
  let loopingMode = generators[generatorTypes.sampleModes];
375
- const sampleLength = sampleAndGenerators.sample.getAudioData().length;
376
- // clamp loop
377
- loopStart = Math.min(Math.max(0, loopStart), sampleLength);
378
- // clamp loop
379
- loopEnd = Math.min(Math.max(0, loopEnd), sampleLength);
380
- if (loopEnd - loopStart < 1)
381
- {
382
- loopingMode = 0;
383
- }
384
376
  /**
385
377
  * create the worklet sample
386
378
  * offsets are calculated at note on time (to allow for modulation of them)