Skip to content

Commit e1c1e35

Browse files
committed
[Wasm64] Changes to make AUDIO_WORKLET work with MEMORY64
1 parent 90958d9 commit e1c1e35

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

emscripten.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,8 @@ def create_wasm64_wrappers(metadata):
886886
'_emscripten_dlsync_self_async': '_p',
887887
'_emscripten_proxy_dlsync_async': '_pp',
888888
'_wasmfs_rmdir': '_p',
889-
'_wasmfs_unlink': '_p'
889+
'_wasmfs_unlink': '_p',
890+
'emscripten_wasm_worker_initialize': '_p_',
890891
}
891892

892893
wasm64_wrappers = '''

src/library_sigs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ sigs = {
438438
emscripten_console_log__sig: 'vp',
439439
emscripten_console_warn__sig: 'vp',
440440
emscripten_create_audio_context__sig: 'ip',
441+
emscripten_create_wasm_audio_worklet_node__sig: 'iipppp',
442+
emscripten_create_wasm_audio_worklet_processor_async__sig: 'vippp',
441443
emscripten_create_worker__sig: 'ip',
442444
emscripten_current_thread_is_audio_worklet__sig: 'i',
443445
emscripten_date_now__sig: 'd',
@@ -621,6 +623,7 @@ sigs = {
621623
emscripten_stack_snapshot__sig: 'p',
622624
emscripten_stack_unwind_buffer__sig: 'ippi',
623625
emscripten_start_fetch__sig: 'vp',
626+
emscripten_start_wasm_audio_worklet_thread_async__sig: 'vipipp',
624627
emscripten_supports_offscreencanvas__sig: 'i',
625628
emscripten_throw_number__sig: 'vd',
626629
emscripten_throw_string__sig: 'vp',

src/library_webaudio.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ let LibraryWebAudio = {
126126
'wasm_workers_id',
127127
'$_EmAudioDispatchProcessorCallback'],
128128
emscripten_start_wasm_audio_worklet_thread_async: function(contextHandle, stackLowestAddress, stackSize, callback, userData) {
129-
#if !AUDIO_WORKLET
130-
abort('emscripten_create_wasm_audio_worklet() requires building with -s AUDIO_WORKLET=1 enabled!');
131-
#endif
132129

133130
#if ASSERTIONS
134131
assert(contextHandle, `Called emscripten_start_wasm_audio_worklet_thread_async() with a null Web Audio Context handle!`);
@@ -156,7 +153,7 @@ let LibraryWebAudio = {
156153
#if WEBAUDIO_DEBUG
157154
console.error(`emscripten_start_wasm_audio_worklet_thread_async() addModule() failed!`);
158155
#endif
159-
{{{ makeDynCall('viii', 'callback') }}}(contextHandle, 0/*EM_FALSE*/, userData);
156+
{{{ makeDynCall('viip', 'callback') }}}(contextHandle, 0/*EM_FALSE*/, userData);
160157
};
161158

162159
// Does browser not support AudioWorklets?

test/test_browser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def make_main_two_files(path1, path2, nonexistingpath):
418418

419419
# Tests that user .html shell files can manually download .data files created with --preload-file cmdline.
420420
@parameterized({
421-
'default': ([],),
421+
'': ([],),
422422
'pthreads': (['-pthread', '-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME'],),
423423
})
424424
@requires_threads
@@ -5502,7 +5502,8 @@ def test_full_js_library_strict(self):
55025502

55035503
# Tests the AudioWorklet demo
55045504
@parameterized({
5505-
'default': ([],),
5505+
'': ([],),
5506+
'memory64': (['-sMEMORY64', '-Wno-experimental'],),
55065507
'with_fs': (['--preload-file', test_file('hello_world.c') + '@/'],),
55075508
'closure': (['--closure', '1', '-Oz'],),
55085509
'asyncify': (['-sASYNCIFY'],),
@@ -5516,7 +5517,7 @@ def test_audio_worklet(self, args):
55165517

55175518
# Tests that posting functions between the main thread and the audioworklet thread works
55185519
@parameterized({
5519-
'default': ([],),
5520+
'': ([],),
55205521
'closure': (['--closure', '1', '-Oz'],),
55215522
})
55225523
def test_audio_worklet_post_function(self, args):

tools/gen_sig_info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,17 @@ def extract_sigs(symbols, obj_file):
231231
def extract_sig_info(sig_info, extra_settings=None, extra_cflags=None):
232232
tempfiles = shared.get_temp_files()
233233
settings = {
234+
# Enable as many settings as we can here to ensure the maximum number
235+
# of JS symbols are included.
234236
'STACK_OVERFLOW_CHECK': 1,
235237
'MAX_WEBGL_VERSION': 2,
236238
'FULL_ES3': 1,
237239
'USE_SDL': 1,
238240
'FETCH': 1,
239241
'PTHREADS': 1,
240242
'SHARED_MEMORY': 1,
243+
'AUDIO_WORKLET': 1,
244+
'WASM_WORKERS': 1,
241245
# Currently GLFW symbols have different sigs for the same symbol because the
242246
# signatures changed between v2 and v3, so for now we continue to maintain
243247
# them by hand.

0 commit comments

Comments
 (0)