summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-02-04 16:14:16 +0100
committerjmoenig <jens@moenig.org>2014-02-04 16:14:16 +0100
commit0322b6e3db13355e8bf37db7ab6df7d88875d4b4 (patch)
treebbebd3819c401ff85e4e5f7f9ed9109bc3a7362f
parent268ece61031560010acebfa85580e879c9017782 (diff)
downloadsnap-byow-0322b6e3db13355e8bf37db7ab6df7d88875d4b4.tar.gz
snap-byow-0322b6e3db13355e8bf37db7ab6df7d88875d4b4.zip
integrate Dean's sound fix
so JSLint doesn’t complain (no functionality changes). Thanks, Dean!
-rwxr-xr-xhistory.txt1
-rw-r--r--objects.js9
2 files changed, 7 insertions, 3 deletions
diff --git a/history.txt b/history.txt
index 7746ef4..054387a 100755
--- a/history.txt
+++ b/history.txt
@@ -2082,3 +2082,4 @@ ______
* GUI: Import sounds from the project menu, thanks, Brian, for the changeset!
* Objects, Store, GUI: Flat line end option in the settings menu, saved with the project
* German translation update
+* Objects: Enable playing sounds and notes on Firefox, thanks, Dean Brettle, for this fix!!
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;