]> id.pley.net Git - sound.git/commitdiff
Fix restarting at current time after pause.
authorJer Noble <jer.noble@apple.com>
Fri, 28 Mar 2014 16:52:42 +0000 (09:52 -0700)
committerJer Noble <jer.noble@apple.com>
Fri, 28 Mar 2014 16:52:42 +0000 (09:52 -0700)
sound.js

index 23039273b02897c7a3d2aeb3e4fcbc3bd022ddb1..c8ee70656bb2d70544b9ed4b1550f09b71ba47b8 100644 (file)
--- 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.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;
                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;
        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) {
        },
 
        setCurrentTime: function(time) {