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
assert(obj,`Called ${methodName}() on a nonexisting handle ${handle}`);
40
+
if(isNode==2){
41
+
// Some methods accept either a node or an audio context
42
+
assert(objinstanceofwindow.AudioNode||objinstanceof(window.AudioContext||window.webkitAudioContext),`Called ${methodName}() on a context handle ${handle} that is not an AudioNode, but of type ${typeofobj}`);
43
+
}elseif(isNode){
44
+
assert(objinstanceofwindow.AudioNode,`Called ${methodName}() on a context handle ${handle} that is not an AudioNode, but of type ${typeofobj}`);
45
+
}else{
46
+
assert(objinstanceof(window.AudioContext||window.webkitAudioContext),`Called ${methodName}() on a context handle ${handle} that is not an AudioContext, but of type ${typeofobj}`);
47
+
}
48
+
#endif
49
+
},
50
+
#endif
51
+
31
52
// Call this function from JavaScript to destroy a Wasm-side handle to an AudioContext.
32
53
// After calling this function, it is no longer possible to reference this AudioContext
33
54
// from Wasm code - and the GC can reclaim it after all references to it are cleared.
@@ -68,7 +89,7 @@ var LibraryWebAudio = {
68
89
} : undefined;
69
90
70
91
#if WEBAUDIO_DEBUG
71
-
console.log(`Creating new WebAudio context with parameters:`);
92
+
dbg(`Creating new WebAudio context with parameters:`);
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}`);
364
-
#endif
365
363
#if WEBAUDIO_DEBUG
366
-
console.log(`Connecting audio node ID ${source} to audio node ID ${destination} (${srcNode} to ${dstNode})`);
364
+
dbg(`Connecting audio node ID ${source} to audio node ID ${destination} (${srcNode} to ${dstNode})`);
0 commit comments