From 0322b6e3db13355e8bf37db7ab6df7d88875d4b4 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 4 Feb 2014 16:14:16 +0100 Subject: integrate Dean's sound fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so JSLint doesn’t complain (no functionality changes). Thanks, Dean! --- objects.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'objects.js') diff --git a/objects.js b/objects.js index fd19bd6..52126e2 100644 --- a/objects.js +++ b/objects.js @@ -5658,8 +5658,9 @@ Note.prototype.setupContext = function () { window.msAudioContext || window.oAudioContext || window.webkitAudioContext; - if (!ctx.prototype.hasOwnProperty('createGain')) + if (!ctx.prototype.hasOwnProperty('createGain')) { ctx.prototype.createGain = ctx.prototype.createGainNode; + } return ctx; }()); if (!AudioContext) { @@ -5674,10 +5675,12 @@ Note.prototype.setupContext = function () { Note.prototype.play = function () { this.oscillator = this.audioContext.createOscillator(); - if (!this.oscillator.start) + if (!this.oscillator.start) { this.oscillator.start = this.oscillator.noteOn; - if (!this.oscillator.stop) + } + if (!this.oscillator.stop) { this.oscillator.stop = this.oscillator.noteOff; + } this.oscillator.type = 0; this.oscillator.frequency.value = Math.pow(2, (this.pitch - 69) / 12) * 440; -- cgit v1.3.1