Fix borked seek

master
William Toohey 10 years ago
parent 03ed4caef0
commit df6c55e2fc
  1. 10
      src/js/SoundManager.js

@ -187,20 +187,22 @@ SoundManager.prototype.playSong = function(song, playBuild, forcePlay) {
return p; return p;
}; };
SoundManager.prototype.stop = function() { SoundManager.prototype.stop = function(dontDeleteBuffers) {
if (this.playing) { if (this.playing) {
if(this.buildSource) { if(this.buildSource) {
this.buildSource.stop(0); this.buildSource.stop(0);
this.buildSource.disconnect(); this.buildSource.disconnect();
this.buildSource = null; this.buildSource = null;
this.buildup = null; if(!dontDeleteBuffers)
this.buildup = null;
} }
// arg required for mobile webkit // arg required for mobile webkit
this.loopSource.stop(0); this.loopSource.stop(0);
// TODO needed? // TODO needed?
this.loopSource.disconnect(); this.loopSource.disconnect();
this.loopSource = null; this.loopSource = null;
this.loop = null; if(!dontDeleteBuffers)
this.loop = null;
this.vReady = false; this.vReady = false;
this.playing = false; this.playing = false;
this.startTime = 0; this.startTime = 0;
@ -224,7 +226,7 @@ SoundManager.prototype.seek = function(time, noPlayingUpdate) {
// Clamp the blighter // Clamp the blighter
time = Math.min(Math.max(time, -this.buildLength), this.loopLength); time = Math.min(Math.max(time, -this.buildLength), this.loopLength);
this.stop(); this.stop(true);
if(!this.loop) { if(!this.loop) {
return; return;

Loading…
Cancel
Save