Add support for Web Audio (Emscripten/WebAssembly)#887
Add support for Web Audio (Emscripten/WebAssembly)#887fwcd wants to merge 32 commits intoPortAudio:masterfrom
Conversation
These didn't really work as-is (since they required special support on the JS side) and should be rewritten for the new Wasm Audio Worklets API as per PortAudio/portaudio#887
|
Cool. Great that you're working on this. We look forward to merging it when its ready. Please give a status update from time to time and let us know when you're ready for a code review. Ideally we'd like to hear from multiple users who are successfully using this host API. |
We need pthreads and since WebAudio does not support linking non-pthread and pthread-enabled object files, we have to make this public.
philburk
left a comment
There was a problem hiding this comment.
Thanks so much for adding this new webaudio hostapi. This is very exciting technology. I love writing host-independent code and webasm and webaudio makes the web a compelling platform. I may try to integrate this with multi-platform kotlin/compose.
Please add a YAML target for continuous integration.
We will review this in more detail when you tell us it is ready.
This should hopefully ensure that Emscripten is actually used
|
When building with Any ideas? At first glance this looks like an issue outside this PR's scope. Perhaps something funky happens because we are compiling for a 32-bit platform ( |
While we could try multiplexing streams into a single audio context, we can only set one sink per context. Both therefore, and because the start/stop semantics seem to map nicely to AudioContext's resume/suspend, we will create a context per stream.
|
Status update: There is audio! It currently only supports the default 2-channel output device, but It would be really cool if we could get rid of |
This synchronous mode uses `emscripten_thread_sleep` instead of
`emscripten_sleep` and is intended to run from a separate thread where
blocking is allowed.
In its current state, this seems to depend on
WebAudio/web-audio-api#2423
The alternative would be to proxy audio context-related calls to the
main thread.
|
I've added some highly experimental support for building without This is also why the examples, even with |
Fixes #497
This is a work-in-progress, from-scratch implementation of a Web Audio hostapi, using the Wasm Audio Worklets API, which Emscripten already provides nice C/C++ wrappers for.
Useful resources