Skip to content

Commit

Permalink
fixed extra callback calls in while using cue to the soundFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
endurance21 committed May 9, 2020
1 parent 8c35cce commit 97fe871
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/soundfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,8 +1709,9 @@ define(function (require) {
var cue = this._cues[i];
var callbackTime = cue.time;
var val = cue.val;

if (~~this._prevUpdateTime <= callbackTime && callbackTime <= playbackTime) {
var leftLimit = this._prevUpdateTime || 0 ;
var rightLimit = playbackTime ;
if ( leftLimit <= callbackTime && callbackTime <= rightLimit ) {

// pass the scheduled callbackTime as parameter to the callback
cue.callback(val);
Expand All @@ -1719,6 +1720,7 @@ define(function (require) {
}

this._prevUpdateTime = playbackTime;

};

/**
Expand Down

0 comments on commit 97fe871

Please sign in to comment.