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 6bafb30 commit bb438f6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 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

0 comments on commit bb438f6

Please sign in to comment.