AudioWorklet based Host for web when Wasm atomics are enabled #958
+710
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds an optional feature-flagged
Host
that uses AudioWorklet on web when theatomics
feature is enabled. When theweb_audio_worklet
andwasm-bindgen
features are enabled and nightly Rust is compiled with theatomics
flag enabled the WebAudioWorklet Host is available.AudioWorklet
should be lower latency, lower overhead, and less prone to jank. This implementations works pretty much the same as a native audio thread, allowing the implementation to be simpler than the existing WebAudio Host implementation.To used shared memory it's also required (for security reasons) that the server hosting the Wasm to be configured with the correct CORS headers. I've added an example that shows how to build with the correct Rust flags and how to set the Cors headers in a test environment.
So far I've tested this in Chrome, Safari, and Firefox with the beep example and it seems to be working fine.
Edit: I'm not sure why a past merged PR shows up in Github's listed commits, but it seems to have no impact on this PR.