summaryrefslogtreecommitdiff
path: root/platform/javascript/export
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-11-10 11:05:22 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-11-10 18:56:21 +0100
commit179ec3ca0ef909592eece8c907ec0cd855ef5b04 (patch)
treebea6987abee005a88b147997ce5259d48c668315 /platform/javascript/export
parente2083871eb57e56fe637c3d8f6647ddb4ff539e0 (diff)
[HTML5] AudioWorklet API 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 downloaded) in the thread build.
Diffstat (limited to 'platform/javascript/export')
-rw-r--r--platform/javascript/export/export.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index a83ff44d20..d520931067 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -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";
@@ -440,6 +443,9 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
} else if (file == "godot.worker.js") {
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";
}
@@ -566,6 +572,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");