diff --git a/src/library_webaudio.js b/src/library_webaudio.js index f4269e9759baa..159beae48c478 100644 --- a/src/library_webaudio.js +++ b/src/library_webaudio.js @@ -378,7 +378,7 @@ let LibraryWebAudio = { emscripten_audio_worklet_post_function_3(audioContext, funcPtr, arg0, arg1, arg2); }, - emscripten_audio_worklet_post_function_sig__deps: ['$readAsmConstArgs'], + emscripten_audio_worklet_post_function_sig__deps: ['$readEmAsmArgs'], emscripten_audio_worklet_post_function_sig: (audioContext, funcPtr, sigPtr, varargs) => { #if ASSERTIONS assert(audioContext >= 0); @@ -387,7 +387,7 @@ let LibraryWebAudio = { assert(UTF8ToString(sigPtr)[0] != 'v', 'Do NOT specify the return argument in the signature string for a call to emscripten_audio_worklet_post_function_sig(), just pass the function arguments.'); assert(varargs); #endif - (audioContext ? EmAudio[audioContext].audioWorklet.bootstrapMessage.port : globalThis['messagePort']).postMessage({'_wsc': funcPtr, 'x': readAsmConstArgs(sigPtr, varargs) }); + (audioContext ? EmAudio[audioContext].audioWorklet.bootstrapMessage.port : globalThis['messagePort']).postMessage({'_wsc': funcPtr, 'x': readEmAsmArgs(sigPtr, varargs) }); } }; diff --git a/test/webaudio/audioworklet_post_function.c b/test/webaudio/audioworklet_post_function.c index caabd1f45c599..0efd46f97e781 100644 --- a/test/webaudio/audioworklet_post_function.c +++ b/test/webaudio/audioworklet_post_function.c @@ -7,10 +7,10 @@ // emscripten_audio_worklet_post_function_*() API. // This event will fire on the main thread. -void MessageReceivedOnMainThread(int d, int e, int f) { - printf("MessageReceivedOnMainThread: d=%d, e=%d, f=%d\n", d, e, f); +void MessageReceivedOnMainThread(int d, double e, int f) { + printf("MessageReceivedOnMainThread: d=%d, e=%f, f=%d\n", d, e, f); assert(!emscripten_current_thread_is_audio_worklet()); - assert(d == 1 && e == 2 && f == 3); + assert(d == 1 && e == 2.0f && f == 3); #ifdef REPORT_RESULT REPORT_RESULT(1); // test succeeded, were able to post a message from main thread to audio thread and back! #endif @@ -21,7 +21,7 @@ void MessageReceivedInAudioWorkletThread(int a, int b) { printf("MessageReceivedInAudioWorkletThread: a=%d, b=%d\n", a, b); assert(emscripten_current_thread_is_audio_worklet()); assert(a == 42 && b == 9000); - emscripten_audio_worklet_post_function_viii(EMSCRIPTEN_AUDIO_MAIN_THREAD, MessageReceivedOnMainThread, /*d=*/1, /*e=*/2, /*f=*/3); + emscripten_audio_worklet_post_function_sig(EMSCRIPTEN_AUDIO_MAIN_THREAD, (void *)MessageReceivedOnMainThread, "idi", /*d=*/1, /*e=*/2.0f, /*f=*/3); } // This callback will fire when the audio worklet thread has been initialized.