X-Git-Url: http://id.pley.net/sound.git/blobdiff_plain/aad8eacf291f9ec284ec61b7e3bf5547adb03b41..96498ce8e0ac1fb6908a87e43f9c8a6c88157e76:/sound.js?ds=sidebyside diff --git a/sound.js b/sound.js index 2303927..c8ee706 100644 --- a/sound.js +++ b/sound.js @@ -216,6 +216,8 @@ Sound.prototype = { this.gainNode.gain.value = this._muted ? 0 : this._volume; this.gainNode.connect(Sound.audioContext.destination); + this.startTime = Sound.audioContext.currentTime; + this.node = Sound.audioContext.createBufferSource(); this.node.connect(this.gainNode); this.node.buffer = this.buffer; @@ -364,7 +366,7 @@ Sound.prototype = { getCurrentTime: function() { if (!this.node) return this.nextStartTime; - return this.nextStartTime + Sound.audioContext.currentTIme - this.startTime; + return this.nextStartTime + Sound.audioContext.currentTime - this.startTime; }, setCurrentTime: function(time) {