diff --git a/img/vignette.png b/img/vignette.png index e697d8a..e06ee96 100644 Binary files a/img/vignette.png and b/img/vignette.png differ diff --git a/js/SoundManager.js b/js/SoundManager.js index b8e111e..1204d34 100644 --- a/js/SoundManager.js +++ b/js/SoundManager.js @@ -114,6 +114,9 @@ SoundManager.prototype.playSong = function(song, playBuild, callback) { this.gainNode.gain.cancelScheduledValues(0); // Reset original volume this.setVolume(this.lastVol); + if(this.mute) { + this.setMute(true); + } this.loadBuffer(song, function() { // To prevent race condition if you press "next" twice fast @@ -431,8 +434,10 @@ SoundManager.prototype.getVisualiserData = function() { SoundManager.prototype.setMute = function(mute) { if(!this.mute && mute) { // muting this.lastVol = this.gainNode.gain.value; + } + if(mute) { this.gainNode.gain.value = 0; - } else if(this.mute && !mute) { // unmuting + } else { this.gainNode.gain.value = this.lastVol; } this.core.userInterface.updateVolume(this.gainNode.gain.value); @@ -463,8 +468,10 @@ SoundManager.prototype.setVolume = function(vol) { }; SoundManager.prototype.fadeOut = function(callback) { - // Firefox hackery - this.gainNode.gain.setValueAtTime(this.lastVol, this.context.currentTime); - this.gainNode.gain.exponentialRampToValueAtTime(0.01, this.context.currentTime + 2); + if(!this.mute) { + // Firefox hackery + this.gainNode.gain.setValueAtTime(this.lastVol, this.context.currentTime); + this.gainNode.gain.exponentialRampToValueAtTime(0.01, this.context.currentTime + 2); + } setTimeout(callback, 2000); }