-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HTML5] Port inline JS code to libraries, AudioWorklet support. #43443
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The API is implemented in javascript, and generates C functions that can be called from godot. This allows much cleaner code replacing all `EM_ASM` calls in our C++ code with plain C function calls. This also gets rid of few hacks and comes with few optimizations (e.g. custom cursor shapes should be much faster now).
Rewrote AudioDriverJavaScript to support multiple processor nodes. The old (and deprecated) ScriptProcessorNode when threads are not available, and the new AudioWorklet API when threads are enabled. The new implementation uses two ring buffers and a shared state to communicated with the AudioWorklet thread. The audio.worklet.js JavaScript file is always added to the export template, but only really used (and downloaded) in the thread build.
akien-mga
reviewed
Nov 11, 2020
} | ||
|
||
void WebRTCDataChannelJS::close() { | ||
in_buffer.resize(0); | ||
queue_count = 0; | ||
_was_string = false; | ||
/* clang-format off */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, begone /* clang-format off */
hacks around all EM_ASM
calls :D
akien-mga
approved these changes
Nov 11, 2020
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In this PR:
RasterizerDummy
lto=thin
lto=full
etc, but keep it short for now).The API is implemented in JavaScript, and generates C functions that can be called from Godot.
This allows much cleaner code replacing all
EM_ASM
calls in our C++ code with plain C function calls.This also gets rid of few hacks and comes with few optimizations (e.g. custom cursor shapes should be much faster now).
Rewrote AudioDriverJavaScript to support multiple processor nodes.
The old (and deprecated)
ScriptProcessorNode
when threads are not available, and the newAudioWorklet
API when threads are enabled.The new implementation uses two ring buffers and a shared state to communicated with the
AudioWorklet
thread.The
audio.worklet.js
JavaScript file is always added to the export template, but only really used (and downloaded) in the thread build.Fixes #40891 (on thread builds, which is the only build that can be fixed).
Potentially others, which I will review.
There is a 3.x version here: https://github.com/Faless/godot/tree/js/3.x_audio_worklet