servo/media

AudioBufferSourceNode: Adjust buffer_pos when loop endpoints change

Opened this issue · 1 comments

See

// XXX(collares): To fully support dynamically updating loop bounds,

The spec doesn't clarify how the adjustment should be made. There's one thing to keep in mind: Even for fixed loop endpoints, self.buffer_pos can be slightly outside the loop bounds when process() starts; this is because we increment buffer_pos right after outputting a sample, but only loop right before outputting a sample. Any implementation must behave the same as this, because the playback algorithm (https://webaudio.github.io/web-audio-api/#playback-AudioBufferSourceNode) is normative.