-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AUDIO_WORKLET] Added support for MEMORY64 and 2GB heap (including tests) #23508
base: main
Are you sure you want to change the base?
Conversation
We can remove the float-by-float JS copy and replace with this simple TypedArray set() calls.
Typed views are recreated if needed but otherwise are reused.
Lots of juggling with the various pointers, and next will be to reduce the code and move all of the output first to stop repeating some of the calculations. Some can also move to the constructor.
The code has also been brought back closer to the original for comparison.
The initial stackAlloc() is overflowing, seeming to need more space so this is accounted for.
Tested with various stack sizes, output sizes, and generators.
The assertions should now cover all cases of changes in address and size of the output views.
(Off home!)
Rough implementation to see what needs doing in JS vs Wasm.
The tests pass the audio context in a void* for convenience, which needs shortening/widening for 64-bit pointers.
I'll try to take a look in the next days, they're definitely all failing because even 2GB tests should fail. One of a couple of examples here: emscripten/src/lib/libwebaudio.js Line 244 in 62304e2
Then for wasm64 the offset fails, e.g.: emscripten/src/lib/libwebaudio.js Line 246 in 62304e2
The offset should be A simple standalone test with just the noise generator is:
With this PR's changes so far it now works, but I've more to do so this is still draft. ( |
Removed magic numbers from emscripten_create_wasm_audio_worklet_processor_async().
Added ahead of WebAudioParamDescriptor test
I wrote a test for the web audio parameters, creating a pair of descriptors and using the first to handle fading. It needs some tidying up but the important parts are done and it correctly gets the C structs to JS. Demo here: https://wip.numfum.com/cw/2025-02-05/index.html
This single line does the fade-in/out:
And the mix is currently done with this:
As before, @sbc100, shall I create a new PR just for these tests? Then another PR that fixes running the tests? |
This now works in Chrome, Firefox and Safari.
All the AW tests are silently failing. I'll look at fixing them next. |
Done. |
This is built on #22753 and expands on the tests in #23394 (which could also be split into their own PR, but they'll all fail due to the required changes).
It adds support for
MEMORY64
to audio worklets and tests that:MEMORY64
and >4GB heapThe tests already prove out various buffer combinations using the
INITIAL_MEMORY
andGLOBAL_BASE
flags.For the code changes, besides parameters expecting
BigInt
it also needed any shifts removing from the offset calculations (signed shifts fail >2GB, unsigned >4GB).The interactive tests can be run with: