WebAudio / web-audio-api

The Web Audio API v1.0, developed by the W3C Audio WG
https://webaudio.github.io/web-audio-api/
Other
1.04k stars 165 forks source link

Calling AudioRenderCapacity.start multiple times #2526

Open orottier opened 1 year ago

orottier commented 1 year ago

Describe the issue

Reading the AudioRenderCapacity spec, it is unclear to me what the behaviour should be when calling start repeatedly. Should it:

Where Is It

https://webaudio.github.io/web-audio-api/#ref-for-dom-audiorendercapacity-start

Starts metric collection and analysis. This will repeatedly fire an event named update at AudioRenderCapacity, using AudioRenderCapacityEvent, with the given update interval in AudioRenderCapacityOptions.

Additional Information

None

hoch commented 1 year ago

The second option looks reasonable. I'll work on PR for the updated spec text.

mdjp commented 1 year ago

Proposal, reset clock and apply new options with subsequent calls. (option 2)

hoch commented 1 year ago

Teleconference 4/20: We had a bit more discussion on this, but there still are issues to resolve.

For example, when calling start() with the same interval value, we cannot distinguish if the next callback is from the previous onset or the latest one. We should look at the requestAnimationFrame algorithm or setTimeout for a solution: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-animationframeprovider-requestanimationframe