Open fwcd opened 9 months ago
This is awesome! I suggested/requested a web version of MIxxx a couple years ago so its great to see it in progress! I see there are still a couple tasks needed to get it fully operational?
Yes, the UI mostly works (you can try it online), the biggest missing piece is currently the Web Audio backend. Mixing that, Qt and Asyncify seems to be a lot more complicated than I had hoped for, so I've put this project on hold until Qt/Emscripten hopefully work out these interactions.
Wow yes it looks like its all working pretty smoothly otherwise. Hopefully they can solve this soon as I know a lot of users including me will have a great use case for Mixxx in the browser
Status
The
wasm
branch contains experimental forks ofmixxx
andvcpkg
for targetingwasm32-emscripten
.You can try it out, there is a GitHub Pages-hosted build at https://fwcd.github.io/m1xxx, but be warned: It may take a while to load (the Wasm binary is ~300 MB, the assets are ~90 MB) and there is no audio (the experimental "Web Audio" backend is not functional yet, hence why it is disabled by default).
On the technical side, there are still some major roadblocks to be resolved:
-sASSERTIONS
, see-sASSERTIONS
, any multiple in-flight async operations are effectively undefined behavior and manifest themselves in hard-to-debug failures at runtime (e.g. "unreachable" errors in the console, freezes, etc.)Something to investigate would be whether we could replace
-sASYNCIFY
entirely with-sPROXY_TO_PTHREAD
, i.e. move the "main" thread to a Web Worker where we can block synchronously. Unfortunately, there seem to be some complexities involved in making this work with Qt:We may have to check whether setting
USE_PTHREADS=1
for Qt would help here (or whether that would be redundant because our vcpkg triplet already sets-pthread
).Another option would be the recently-added C++20
co_await
integration, which uses native LLVM coroutines and thus hopefully shouldn't be bound to the same limitations as Asyncify: https://github.com/emscripten-core/emscripten/issues/20413Given that PortAudio exposes a C interface, I am not sure how well we could integrate C++ coroutines there, however.
Motivation
Being able to run Mixxx on the web would be pretty cool. Qt supports WebAssembly, we would however also have to compile all of the other dependencies. This would probably take some work, but should not be impossible.
We take a similar approach to the iOS port (#16) and use custom WASM branches for
mixxx
andvcpkg
, along with an integration branch inm1xxx
, then gradually upstream the required changes.Porting the dependencies to WebAssembly
dbus
libflac
,libmad
andlibmodplug
sleef
build by usingfftw
as an alternative FFT backendqttools
build (or figure out how to remove non-hostqttools
dependency fromqttranslations
)qttools
_qt_test_emscripten_version
inQt6WasmMacros.cmake
during Mixxx configurePorting Mixxx to WebAssembly
WrapRt
cannot be found when configuring Mixxx:Digging into
FindWrapRt.cmake
shows that thecheck_cxx_source_compiles
failed, which (asbuild/CMakeFiles/CMakeConfigureLog.yaml
revealed), failed due a missingclang-scan-deps
binary:Presumably we hit https://github.com/emscripten-core/emscripten/issues/21042, possibly because Mixxx uses C++20 (this would also explain why vcpkg builds of Qt passed, despite running the same
FindWrapRt
check).The issue is likely that we have to compile (all?) our dependencies with
-pthread
(as per this discussion). This should in principle be possible via the triplet, just settingVCPKG_C(XX)_FLAGS
does not work, however: https://github.com/microsoft/vcpkg/discussions/30108wasm32-emscripten-pthread(-release)
) and settingUpstreaming the Mixxx patches
Upstreaming the vcpkg patches
to
microsoft/vcpkg
to
mixxxdj/vcpkg
TBD:
to upstream projects
Nice to have
IDBFS
to persist the.mixxx
directorycpack -G TGZ
is usedbin
etc.mixxx.{data,html,js,wasm,worker.js}
,qtloader.js
andqtlogo.svg
emrun mixxx.html
can be used to launch the web app locallyUseful resources