1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Merge pull request #39037 from Faless/js/audio_latency

Fix JS audioContext parameters.
This commit is contained in:
Rémi Verschelde
2020-05-25 15:51:42 +02:00
committed by GitHub

View File

@@ -70,14 +70,14 @@ Error AudioDriverJavaScript::init() {
/* clang-format off */ /* clang-format off */
_driver_id = EM_ASM_INT({ _driver_id = EM_ASM_INT({
const MIX_RATE = $0; const MIX_RATE = $0;
const LATENCY = $1; const LATENCY = $1 / 1000;
return Module.IDHandler.add({ return Module.IDHandler.add({
'context': new (window.AudioContext || window.webkitAudioContext)({ sampleRate: MIX_RATE, latencyHint: LATENCY}), 'context': new (window.AudioContext || window.webkitAudioContext)({ sampleRate: MIX_RATE, latencyHint: LATENCY}),
'input': null, 'input': null,
'stream': null, 'stream': null,
'script': null 'script': null
}); });
}); }, mix_rate, latency);
/* clang-format on */ /* clang-format on */
int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode()); int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode());