1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

[HTML5] AudioWorkletAPI implementation.

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 download) in the thread build.
This commit is contained in:
Fabio Alessandrelli
2020-11-03 17:18:02 +01:00
parent e52ed6d89e
commit 6d939b72f0
8 changed files with 722 additions and 220 deletions

View File

@@ -94,6 +94,9 @@ public:
} else if (req[1] == basereq + ".js") {
filepath += ".js";
ctype = "application/javascript";
} else if (req[1] == basereq + ".audio.worklet.js") {
filepath += ".audio.worklet.js";
ctype = "application/javascript";
} else if (req[1] == basereq + ".worker.js") {
filepath += ".worker.js";
ctype = "application/javascript";
@@ -447,6 +450,10 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
file = p_path.get_file().get_basename() + ".worker.js";
} else if (file == "godot.audio.worklet.js") {
file = p_path.get_file().get_basename() + ".audio.worklet.js";
} else if (file == "godot.wasm") {
file = p_path.get_file().get_basename() + ".wasm";
@@ -581,6 +588,7 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
DirAccess::remove_file_or_error(basepath + ".html");
DirAccess::remove_file_or_error(basepath + ".js");
DirAccess::remove_file_or_error(basepath + ".worker.js");
DirAccess::remove_file_or_error(basepath + ".audio.worklet.js");
DirAccess::remove_file_or_error(basepath + ".pck");
DirAccess::remove_file_or_error(basepath + ".png");
DirAccess::remove_file_or_error(basepath + ".wasm");