Use dummy driver when JS AudioContext is unavailable.

This commit is contained in:
Fabio Alessandrelli 2020-06-29 18:51:53 +02:00
parent 1a637b07b1
commit 7a5e10b8a9
5 changed files with 40 additions and 15 deletions

View file

@ -63,10 +63,17 @@ void main_loop_callback() {
}
if (os->main_loop_iterate()) {
emscripten_cancel_main_loop(); // Cancel current loop and wait for finalize_async.
/* clang-format off */
EM_ASM({
// This will contain the list of operations that need to complete before cleanup.
Module.async_finish = [];
Module.async_finish = [
// Always contains at least one async promise, to avoid firing immediately if nothing is added.
new Promise(function(accept, reject) {
setTimeout(accept, 0);
})
];
});
/* clang-format on */
os->get_main_loop()->finish();
os->finalize_async(); // Will add all the async finish functions.
EM_ASM({