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.06k stars 168 forks source link

The spec isn't clear about the initial currentTime of the AudioWorketGlobalScope. #2608

Open sunggook opened 1 month ago

sunggook commented 1 month ago

Describe the issue The spec is not clear about the currentTime of the initial AudioWorketGlobalScope. The spec said about currentTime, "By definition this will be equal to the value of BaseAudioContext's currentTime attribute that was most recently observable in the control thread."

But the questions are what happen if not observed yet, and when does the initial observation happens?

Where Is It https://webaudio.github.io/web-audio-api/#dom-audioworkletglobalscope-currentframe

Additional Information

padenot commented 1 week ago

An AudioWorkletGlobalScope lifetime is strictly smaller than the AudioContext's lifetime.

The AudioContext's currentTime starts at 0, and is then incremented periodically, on the control thread. The value of the currentTime is that value.

There is no act of observation, this is a standard, not code. At any point you need this value, you take it from the value it has on the control thread.

mjwilson-google commented 1 week ago

Sorry to reopen; this was a confusion in the Chromium implementation.

Is it necessary to mention the control thread at all? That is, could we reword the spec to something like the following instead?

The context time of the block of audio being processed. This must be equal to the value of BaseAudioContext's currentTime attribute.