You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also:
- Removing duplication in precondition check.
- Use `dbg()` for debug messages
The use of the HandleAllocator does add about 70 bytes to the JS
payload, but that will be amortized over the different places where
HandleAllocator is also uses.
assert(emAudio.has(handle),`Called ${methodName}() on a nonexisting handle ${handle}`);
38
+
varobj=emAudio.get(handle);
39
+
if(isNode==2){
40
+
// Some method accept either a node or an audio context
41
+
assert(objinstanceofwindow.AudioNode||objinstanceof(window.AudioContext||window.webkitAudioContext),`Called ${methodName}() on a context handle ${handle} that is not an AudioNode, but of type ${typeofobj}`);
42
+
}elseif(isNode){
43
+
assert(objinstanceofwindow.AudioNode,`Called ${methodName}() on a context handle ${handle} that is not an AudioNode, but of type ${typeofobj}`);
44
+
}else{
45
+
assert(objinstanceof(window.AudioContext||window.webkitAudioContext),`Called ${methodName}() on a context handle ${handle} that is not an AudioContext, but of type ${typeofobj}`);
46
+
}
47
+
#endif
48
+
},
49
+
#endif
50
+
31
51
// Call this function from JavaScript to destroy a Wasm-side handle to an AudioContext.
32
52
// After calling this function, it is no longer possible to reference this AudioContext
33
53
// from Wasm code - and the GC can reclaim it after all references to it are cleared.
assert(EmAudio[contextHandle],`Called emscripten_resume_audio_context_sync() on a nonexisting context handle ${contextHandle}`);
99
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_resume_audio_context_sync() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
100
-
#endif
101
-
#if WEBAUDIO_DEBUG
102
-
console.log(`AudioContext.resume() on WebAudio context with ID ${contextHandle}`);
assert(EmAudio[contextHandle],`Called emscripten_audio_context_state() on a nonexisting context handle ${contextHandle}`);
110
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_audio_context_state() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
assert(EmAudio[contextHandle],`Called emscripten_destroy_audio_context() on an already freed context handle ${contextHandle}`);
118
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_destroy_audio_context() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
119
-
#endif
120
-
#if WEBAUDIO_DEBUG
121
-
console.log(`Destroyed WebAudio context with ID ${contextHandle}`);
assert(EmAudio[objectHandle],`Called emscripten_destroy_web_audio_node() on a nonexisting/already freed object handle ${objectHandle}`);
130
-
assert(EmAudio[objectHandle].disconnect,`Called emscripten_destroy_web_audio_node() on a handle ${objectHandle} that is not an Web Audio Node, but of type ${typeofEmAudio[objectHandle]}`);
131
-
#endif
132
-
#if WEBAUDIO_DEBUG
133
-
console.log(`Destroyed Web Audio Node with ID ${objectHandle}`);
assert(contextHandle,`Called emscripten_start_wasm_audio_worklet_thread_async() with a null Web Audio Context handle!`);
152
-
assert(EmAudio[contextHandle],`Called emscripten_start_wasm_audio_worklet_thread_async() with a nonexisting/already freed Web Audio Context handle ${contextHandle}!`);
153
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_start_wasm_audio_worklet_thread_async() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
assert(contextHandle,`Called emscripten_create_wasm_audio_worklet_processor_async() with a null Web Audio Context handle!`);
255
-
assert(EmAudio[contextHandle],`Called emscripten_create_wasm_audio_worklet_processor_async() with a nonexisting/already freed Web Audio Context handle ${contextHandle}!`);
256
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_create_wasm_audio_worklet_processor_async() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
assert(contextHandle,`Called emscripten_create_wasm_audio_worklet_node() with a null Web Audio Context handle!`);
304
-
assert(EmAudio[contextHandle],`Called emscripten_create_wasm_audio_worklet_node() with a nonexisting/already freed Web Audio Context handle ${contextHandle}!`);
305
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_create_wasm_audio_worklet_node() on a context handle ${contextHandle} that is not an AudioContext, but of type ${typeofEmAudio[contextHandle]}`);
assert(EmAudio[contextHandle],`Called emscripten_audio_context_quantum_size() with an invalid Web Audio Context handle ${contextHandle}`);
343
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_audio_context_quantum_size() on handle ${contextHandle} that is not an AudioContext, but of type ${EmAudio[contextHandle]}`);
assert(EmAudio[contextHandle],`Called emscripten_audio_context_sample_rate() with an invalid Web Audio Context handle ${contextHandle}`);
351
-
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_audio_context_sample_rate() on handle ${contextHandle} that is not an AudioContext, but of type ${EmAudio[contextHandle]}`);
assert(srcNode,`Called emscripten_audio_node_connect() with an invalid AudioNode handle ${source}`);
361
-
assert(srcNodeinstanceofwindow.AudioNode,`Called emscripten_audio_node_connect() on handle ${source} that is not an AudiotNode, but of type ${srcNode}`);
362
-
assert(dstNode,`Called emscripten_audio_node_connect() with an invalid AudioNode handle ${destination}!`);
363
-
assert(dstNodeinstanceof(window.AudioContext||window.webkitAudioContext)||dstNodeinstanceofwindow.AudioNode,`Called emscripten_audio_node_connect() on handle ${destination} that is not an AudioContext or AudioNode, but of type ${dstNode}`);
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.');
0 commit comments