Skip to content
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] Fix audio buffer size and latency hint. #43358

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platform/javascript/audio_driver_javascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Error AudioDriverJavaScript::init() {
int latency = GLOBAL_GET("audio/output_latency");

channel_count = godot_audio_init(mix_rate, latency);
buffer_length = closest_power_of_2((latency * mix_rate / 1000) * channel_count);
buffer_length = closest_power_of_2(latency * mix_rate / 1000);
buffer_length = godot_audio_create_processor(buffer_length, channel_count);
if (!buffer_length) {
return FAILED;
Expand Down
2 changes: 1 addition & 1 deletion platform/javascript/native/library_godot_audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var GodotAudio = {
godot_audio_init: function(mix_rate, latency) {
GodotAudio.ctx = new (window.AudioContext || window.webkitAudioContext)({
sampleRate: mix_rate,
latencyHint: latency
// latencyHint: latency / 1000 // Do not specify, leave 'interactive' for good performance.
});
return GodotAudio.ctx.destination.channelCount;
},
Expand Down