kopia lustrzana https://github.com/backface/turtlestitch
integrate Dean's sound fix
so JSLint doesn’t complain (no functionality changes). Thanks, Dean!pull/3/merge
rodzic
268ece6103
commit
0322b6e3db
|
@ -2082,3 +2082,4 @@ ______
|
||||||
* GUI: Import sounds from the project menu, thanks, Brian, for the changeset!
|
* 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
|
* Objects, Store, GUI: Flat line end option in the settings menu, saved with the project
|
||||||
* German translation update
|
* German translation update
|
||||||
|
* Objects: Enable playing sounds and notes on Firefox, thanks, Dean Brettle, for this fix!!
|
||||||
|
|
|
@ -5658,8 +5658,9 @@ Note.prototype.setupContext = function () {
|
||||||
window.msAudioContext ||
|
window.msAudioContext ||
|
||||||
window.oAudioContext ||
|
window.oAudioContext ||
|
||||||
window.webkitAudioContext;
|
window.webkitAudioContext;
|
||||||
if (!ctx.prototype.hasOwnProperty('createGain'))
|
if (!ctx.prototype.hasOwnProperty('createGain')) {
|
||||||
ctx.prototype.createGain = ctx.prototype.createGainNode;
|
ctx.prototype.createGain = ctx.prototype.createGainNode;
|
||||||
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
}());
|
}());
|
||||||
if (!AudioContext) {
|
if (!AudioContext) {
|
||||||
|
@ -5674,10 +5675,12 @@ Note.prototype.setupContext = function () {
|
||||||
|
|
||||||
Note.prototype.play = function () {
|
Note.prototype.play = function () {
|
||||||
this.oscillator = this.audioContext.createOscillator();
|
this.oscillator = this.audioContext.createOscillator();
|
||||||
if (!this.oscillator.start)
|
if (!this.oscillator.start) {
|
||||||
this.oscillator.start = this.oscillator.noteOn;
|
this.oscillator.start = this.oscillator.noteOn;
|
||||||
if (!this.oscillator.stop)
|
}
|
||||||
|
if (!this.oscillator.stop) {
|
||||||
this.oscillator.stop = this.oscillator.noteOff;
|
this.oscillator.stop = this.oscillator.noteOff;
|
||||||
|
}
|
||||||
this.oscillator.type = 0;
|
this.oscillator.type = 0;
|
||||||
this.oscillator.frequency.value =
|
this.oscillator.frequency.value =
|
||||||
Math.pow(2, (this.pitch - 69) / 12) * 440;
|
Math.pow(2, (this.pitch - 69) / 12) * 440;
|
||||||
|
|
Ładowanie…
Reference in New Issue