diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-02-13 16:35:47 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-02-13 16:36:23 +0200 |
commit | 28aabecb6f594744fe6d9152bd554a2cfdd4e1b4 (patch) | |
tree | 35a96ef619f3fae09855151c28e69af20e3b13ac | |
parent | 77bb866d10849fe0587cee1f62be339fc3ab09d8 (diff) |
Fix Mozilla Audio Data API usage after my previous commit that added the use of ScriptProcessorNode to Web Audio backend. Fixes #2126.
-rw-r--r-- | src/library_sdl.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index a4be849e..cadc3aee 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1864,7 +1864,7 @@ var LibrarySDL = { } else if (!SDL.audio.timer && !SDL.audio.scriptProcessorNode) { // If we are using the same sampling frequency as the native sampling rate of the Web Audio graph is using, we can feed our buffers via // Web Audio ScriptProcessorNode, which is a pull-mode API that calls back to our code to get audio data. - if (SDL.audio.freq == SDL.audioContext['sampleRate']) { + if (SDL.audioContext !== undefined && SDL.audio.freq == SDL.audioContext['sampleRate']) { var sizeSamplesPerChannel = SDL.audio.bufferSize / SDL.audio.bytesPerSample / SDL.audio.channels; // How many samples per a single channel fit in the cb buffer? SDL.audio.scriptProcessorNode = SDL.audioContext['createScriptProcessor'](sizeSamplesPerChannel, 0, SDL.audio.channels); SDL.audio.scriptProcessorNode['onaudioprocess'] = function (e) { |