Skip to content

Commit

Permalink
Disable sound for browsers that don't support it
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Godbolt committed Jun 22, 2011
1 parent 9e17359 commit bf753d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions miracle.js
Expand Up @@ -72,6 +72,12 @@ function pumpAudio(event) {
}

function audio_init() {
if (typeof(webkitAudioContext) === 'undefined') {
// Disable sound without the new APIs.
audioRun = function() {};
soundChip = new SoundChip(10000);
return;
}
var context = new webkitAudioContext();
var jsAudioNode = context.createJavaScriptNode(2048, 0, 1);
jsAudioNode.onaudioprocess = pumpAudio;
Expand Down

0 comments on commit bf753d0

Please sign in to comment.