Skip to content

Commit

Permalink
Addresses issue #9. Adding and removing effects is done seamlessly in…
Browse files Browse the repository at this point in the history
… looped sounds.
  • Loading branch information
alemangui committed Aug 19, 2016
1 parent 4cfc90b commit 0b8219d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
10 changes: 9 additions & 1 deletion distr/Pizzicato.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,15 @@

this.stopWithSustain();

this.offsetTime = Pz.context.currentTime - this.lastTimePlayed;
var elapsedTime = Pz.context.currentTime - this.lastTimePlayed;

// If we are using a buffer node - potentially in loop mode - we need to
// know where to re-start the sound independently of the loop it is in.
if (this.sourceNode.buffer)
this.offsetTime = elapsedTime % (this.sourceNode.buffer.length / Pz.context.sampleRate);
else
this.offsetTime = elapsedTime;

this.trigger('pause');
}
},
Expand Down
Loading

0 comments on commit 0b8219d

Please sign in to comment.