From 4d23c1c5abbbbbec04d5e1d37035256f8c52b8a4 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 5 Aug 2023 17:53:58 +1000 Subject: [PATCH] Update build instructions for Emscripten. --- miniaudio.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index 7e5fd02e..4de9f2fb 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -538,6 +538,20 @@ you'll need to disable run-time linking with `MA_NO_RUNTIME_LINKING` and link wi The Emscripten build emits Web Audio JavaScript directly and should compile cleanly out of the box. You cannot use `-std=c*` compiler flags, nor `-ansi`. +You can enable the use of AudioWorkets by defining `MA_ENABLE_AUDIO_WORKLETS` and then compiling +with the following options: + + -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY + +An example for compiling with AudioWorklet support might look like this: + + emcc program.c -o bin/program.html -DMA_ENABLE_AUDIO_WORKLETS -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY + +To run locally, you'll need to use emrun: + + emrun bin/program.html + + 2.7. Build Options ------------------