src/audio/emscripten/SDL_emscriptenaudio.c
changeset 10355 ce8669efcd11
parent 10322 6167a989223c
child 10737 3406a0f8b041
     1.1 --- a/src/audio/emscripten/SDL_emscriptenaudio.c	Fri Sep 16 22:28:12 2016 -0700
     1.2 +++ b/src/audio/emscripten/SDL_emscriptenaudio.c	Sun Sep 18 18:07:47 2016 -0400
     1.3 @@ -346,6 +346,7 @@
     1.4                  SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream);
     1.5                  SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1);
     1.6                  SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {
     1.7 +                    if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; }
     1.8                      audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0);
     1.9                      SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer;
    1.10                      Runtime.dynCall('vi', $2, [$3]);
    1.11 @@ -380,6 +381,7 @@
    1.12          EM_ASM_ARGS({
    1.13              SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0);
    1.14              SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) {
    1.15 +                if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; }
    1.16                  SDL2.audio.currentOutputBuffer = e['outputBuffer'];
    1.17                  Runtime.dynCall('vi', $2, [$3]);
    1.18              };