fix: use end

This commit is contained in:
Felix Roos 2024-01-10 14:28:38 +01:00
parent f99557cc05
commit c68dba8c21

View File

@ -302,11 +302,11 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) {
bufferSource.start(time, offset);
const envGain = ac.createGain();
const node = bufferSource.connect(envGain);
let holdEnd = t + duration;
if (clip == null && loop == null && value.release == null) {
const bufferDuration = bufferSource.buffer.duration / bufferSource.playbackRate.value;
holdEnd = t + bufferDuration;
duration = (end - begin) * bufferDuration;
}
let holdEnd = t + duration;
getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear');