wasm: Use default miniaudio buffer size.

Audio currently stutters on the wasm build.  It is much more severe
in Chrome than in Firefox (very rare/subtle in Firefox).  miniaudio
is currently using ScriptProcessorNode, which is deprecated because
it processes audio on the main thread.  There's a new API that lets
you programmatically process audio on a thread called AudioWorklet,
but it's hella complicated.  miniaudio doesn't want to support this
because it's complicated and requires a separate JavaScript request
but it seems like it would be possible to work around using a Blob.
In the meantime, miniaudio bumps up the buffer size on WebAudio, so
let's just use that in hope that it helps.
This commit is contained in:
bjorn 2021-04-03 17:59:51 -06:00
parent 7bc3bc232e
commit 19620c7682
1 changed files with 2 additions and 0 deletions

View File

@ -348,7 +348,9 @@ bool lovrAudioSetDevice(AudioType type, void* id, size_t size, Sound* sink, Audi
config.sampleRate = lovrSoundGetSampleRate(sink);
}
#ifndef EMSCRIPTEN // Web needs to use the default bigger buffer size to prevent stutters
config.periodSizeInFrames = BUFFER_SIZE;
#endif
config.dataCallback = callbacks[type];
ma_result result = ma_device_init(&state.context, &config, &state.devices[type]);