DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 02216aba747685fe3d8c1e7b95d7fc008249fee2
parent 36efc2473f9023a7a0cc0ea1fddcf249847958d3
Author: falkTX <falktx@falktx.com>
Date:   Sat,  9 Jul 2022 22:35:31 +0100

Allow to redirect Runner emscript calls, needed for exceptions

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
MMakefile.base.mk | 1+
MMakefile.plugins.mk | 2+-
Mdistrho/extra/Runner.hpp | 15+++++++++++----
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Makefile.base.mk b/Makefile.base.mk @@ -269,6 +269,7 @@ endif ifeq ($(WASM_EXCEPTIONS),true) BUILD_CXX_FLAGS += -fexceptions +LINK_FLAGS += -fexceptions endif ifeq ($(WINDOWS),true) diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk @@ -64,7 +64,7 @@ ifeq ($(WASM),true) JACK_FLAGS += -sUSE_SDL=2 JACK_LIBS += -sUSE_SDL=2 -JACK_LIBS += -sMAIN_MODULE +JACK_LIBS += -sMAIN_MODULE -ldl ifneq ($(FILE_BROWSER_DISABLED),true) JACK_LIBS += -sEXPORTED_RUNTIME_METHODS=FS,cwrap diff --git a/distrho/extra/Runner.hpp b/distrho/extra/Runner.hpp @@ -28,6 +28,14 @@ START_NAMESPACE_DISTRHO +#ifdef DISTRHO_RUNNER_INDIRECT_WASM_CALLS +long d_emscripten_set_interval(void (*)(void*), double, void*); +void d_emscripten_clear_interval(long); +#else +# define d_emscripten_set_interval emscripten_set_interval +# define d_emscripten_clear_interval emscripten_clear_interval +#endif + // ------------------------------------------------------------------------------------------------------------------- // Runner class @@ -61,7 +69,6 @@ protected: { } - /* * Destructor. */ @@ -117,7 +124,7 @@ public: return fRunnerThread.startThread(); #else DISTRHO_SAFE_ASSERT_RETURN(fIntervalId == 0, false); - fIntervalId = emscripten_set_interval(_entryPoint, timeIntervalMilliseconds, this); + fIntervalId = d_emscripten_set_interval(_entryPoint, timeIntervalMilliseconds, this); return true; #endif } @@ -146,7 +153,7 @@ public: #else if (fIntervalId != 0) { - emscripten_clear_interval(fIntervalId); + d_emscripten_clear_interval(fIntervalId); fIntervalId = 0; } #endif @@ -223,7 +230,7 @@ private: if (fIntervalId != 0 && !stillRunning) { - emscripten_clear_interval(fIntervalId); + d_emscripten_clear_interval(fIntervalId); fIntervalId = 0; } }