From 3fea9f0ed7be44e26470b518b00c48ba07a8e07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sat, 18 Jul 2026 22:47:57 -0400 Subject: [PATCH 1/2] audio: defer the first wasm engine start out of document loading On WASM the miniaudio WebAudio backend blocks (emscripten_sleep / ASYNCIFY) while waiting for the AudioWorklet to come up. Starting it synchronously from restart_engine() while nested inside document loading (loadFile -> on_documentChanged) deadlocks the async worklet init. Defer the first start_engine() to the event loop so it runs at a clean stack depth. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_019oPj1zRcxSQX7FNni7EHM6 --- .../score-plugin-audio/Audio/AudioApplicationPlugin.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/score-plugin-audio/Audio/AudioApplicationPlugin.cpp b/src/plugins/score-plugin-audio/Audio/AudioApplicationPlugin.cpp index 335b54d889..5c3c404e96 100644 --- a/src/plugins/score-plugin-audio/Audio/AudioApplicationPlugin.cpp +++ b/src/plugins/score-plugin-audio/Audio/AudioApplicationPlugin.cpp @@ -23,6 +23,7 @@ #include #include +#include #include SCORE_DECLARE_ACTION(RestartAudio, "Restart Audio", Common, QKeySequence::UnknownKey) @@ -160,7 +161,12 @@ try if(!init) { init = true; - start_engine(); + // The miniaudio WebAudio backend blocks (emscripten_sleep / ASYNCIFY) while + // waiting for the AudioWorklet to come up. Running that synchronously while + // nested deep inside document loading (loadFile -> on_documentChanged) + // deadlocks the async worklet init. Defer the first engine start to the + // event loop so it runs at a clean stack depth. + QTimer::singleShot(0, this, [this] { start_engine(); }); } #else stop_engine(); From 7bcf0169236b5b788f94bf8befadec849f406354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sat, 18 Jul 2026 22:47:57 -0400 Subject: [PATCH 2/2] media: use OSSIA_SDK for the wasm ffmpeg lib paths The include dir already used ${OSSIA_SDK}/ffmpeg, but the static libs were hardcoded to /opt/ossia-sdk-wasm, so the build broke against any SDK placed elsewhere. Point them at ${OSSIA_SDK} too. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_019oPj1zRcxSQX7FNni7EHM6 --- src/plugins/score-plugin-media/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/score-plugin-media/CMakeLists.txt b/src/plugins/score-plugin-media/CMakeLists.txt index 65f304f9f3..9019a0113b 100644 --- a/src/plugins/score-plugin-media/CMakeLists.txt +++ b/src/plugins/score-plugin-media/CMakeLists.txt @@ -163,13 +163,13 @@ if(EMSCRIPTEN) target_include_directories(${PROJECT_NAME} PUBLIC ${OSSIA_SDK}/ffmpeg/include) target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--start-group - /opt/ossia-sdk-wasm/ffmpeg/lib/libavcodec.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libavdevice.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libavfilter.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libavformat.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libavutil.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libswscale.a - /opt/ossia-sdk-wasm/ffmpeg/lib/libswresample.a + ${OSSIA_SDK}/ffmpeg/lib/libavcodec.a + ${OSSIA_SDK}/ffmpeg/lib/libavdevice.a + ${OSSIA_SDK}/ffmpeg/lib/libavfilter.a + ${OSSIA_SDK}/ffmpeg/lib/libavformat.a + ${OSSIA_SDK}/ffmpeg/lib/libavutil.a + ${OSSIA_SDK}/ffmpeg/lib/libswscale.a + ${OSSIA_SDK}/ffmpeg/lib/libswresample.a -Wl,--end-group ) elseif(TARGET avcodec)