File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,9 @@ pc.extend(pc, function () {
198198 if ( this . _state !== STATE_PLAYING || ! this . source )
199199 return false ;
200200
201+ // store current time
202+ this . _updateCurrentTime ( ) ;
203+
201204 // set state to paused
202205 this . _state = STATE_PAUSED ;
203206
@@ -438,6 +441,16 @@ pc.extend(pc, function () {
438441 return this . source ;
439442 } ,
440443
444+ /**
445+ * @private
446+ * @function
447+ * @name pc.SoundInstance#_updateCurrentTime
448+ * @description Sets the current time taking into account the time the instance started playing, the current pitch and the current time offset.
449+ */
450+ _updateCurrentTime : function ( ) {
451+ this . _currentTime = capTime ( ( this . _manager . context . currentTime - this . _startedAt ) * this . pitch + this . _currentOffset , this . duration ) ;
452+ } ,
453+
441454 /**
442455 * @private
443456 * @function
@@ -538,7 +551,7 @@ pc.extend(pc, function () {
538551 }
539552
540553 // recalculate current time
541- this . _currentTime = capTime ( ( this . _manager . context . currentTime - this . _startedAt ) * this . pitch + this . _currentOffset , this . duration ) ;
554+ this . _updateCurrentTime ( ) ;
542555 return this . _currentTime ;
543556 } ,
544557 set : function ( value ) {
You can’t perform that action at this time.
0 commit comments