Wrap properly when phase === 1

This commit is contained in:
Aria 2025-10-02 01:06:29 -05:00
parent 3a7ec18d46
commit ac582b4d40

View file

@ -1234,7 +1234,8 @@ class WavetableOscillatorProcessor extends AudioWorkletProcessor {
_sampleFrame(frame, phase) {
const len = frame.length;
const pos = phase * len;
const i = pos | 0;
let i = pos | 0;
if (i >= len) i = 0;
const frac = pos - i;
const a = frame[i];
const i1 = i + 1 < len ? i + 1 : 0; // fast wrap