dispose the buffer onended

addresses #378
This commit is contained in:
tambien 2019-03-08 11:30:00 -05:00
parent 0e94a0f046
commit d601b4be3a

View file

@ -317,6 +317,14 @@ Tone.BufferSource.prototype._onended = function(){
this._source.stop(this._stopTime + additionalTail);
}
this.onended(this);
//dispose the source after it's come to a stop
setTimeout(function(){
//if it hasn't already been disposed
if (this._source){
this.dispose();
}
}.bind(this), additionalTail * 1000 + 100);
}
};